Google Meet: parse Meet events from Pub/Sub push messages

Merged
EH
2d ago
+298-1

Context

Follows https://github.com/twentyhq/twenty/pull/30610 in the Google Meet app series started in https://github.com/twentyhq/twenty/pull/30587.

Google's Meet events reach Twenty as Pub/Sub push messages. This PR adds the helpers that read such a message. The server route that uses them is the next PR: this PR first included it and was split so each half stays small. Nothing calls these helpers yet.

What this PR does

  • Adds parseGoogleMeetEventOrThrow. It reads the subscription from the message's ce-source attribute, the event type from ce-type and the transcript name from the base64 data. A message that is not a Google Workspace event returns nothing.
  • Adds parseGoogleMeetEventDataOrThrow. A message without data yields an empty event; data that is not JSON, or not a JSON object, throws EVENT_DATA_UNREADABLE instead of being treated as empty.
  • Adds isGooglePubsubPushAuthorized, which turns the token check of https://github.com/twentyhq/twenty/pull/30607 into a yes or no answer: an invalid token is a no, while a failure to check the token (for instance Google's keys being unreachable) still throws.

Checks

  • yarn lint, yarn typecheck, yarn test:unit (135 tests) and twenty app build pass locally.
  • Not run: integration tests (they need a running server, CI runs them), and no real Pub/Sub message was parsed.