Google Meet: parse Meet events from Pub/Sub push messages
Merged
EH
2d ago+298+298+012345678901234567890123456789-1-1-0123456789
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'sce-sourceattribute, the event type fromce-typeand the transcript name from the base64data. 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, throwsEVENT_DATA_UNREADABLEinstead 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) andtwenty app buildpass locally.- Not run: integration tests (they need a running server, CI runs them), and no real Pub/Sub message was parsed.