Google Meet: receive Meet events on a server route
Merged
EH
20h ago+259+259+012345678901234567890123456789-0-0-0123456789
Context
Follows https://github.com/twentyhq/twenty/pull/30611 in the Google Meet app series started in https://github.com/twentyhq/twenty/pull/30587.
Every piece is merged: a subscription per connected Google account (https://github.com/twentyhq/twenty/pull/30604), the check of the Pub/Sub push token (https://github.com/twentyhq/twenty/pull/30607), the event parsing (https://github.com/twentyhq/twenty/pull/30611) and the function that queues the import for an event (https://github.com/twentyhq/twenty/pull/30610). This PR only wires them behind a server route, which completes the push path: Google event, Pub/Sub push, Twenty route, import.
What this PR does
- Adds the
google-meet-events-resolverlogic function with a server route trigger (POST,authorizationforwarded). A Pub/Sub push subscription delivers every workspace's events to this one URL. The file is 90 lines and contains no new logic of its own, only the calls below. - It answers
503while the audience or the service account is not configured, and401unlessisGooglePubsubPushAuthorizedaccepts the request's token, so nothing is accepted unauthenticated. - It reads the event with
parseGoogleMeetEventOrThrow, finds the workspace holding the server-scope claim on the event's subscription, and dispatches togoogle-meet-handle-eventthere. - A message that is not a Google Workspace event, or whose subscription no workspace claims, is acknowledged with
200and skipped, so Pub/Sub does not retry it forever. Unreadable event data and a token that could not be checked both throw, so Pub/Sub retries. - Adds two required server variables:
GOOGLE_MEET_PUBSUB_AUDIENCEandGOOGLE_MEET_PUBSUB_SERVICE_ACCOUNT_EMAIL.
Follow-ups in this series
- A daily job that renews the subscriptions and catches up on calls whose event was missed.
- The setup guide for the Google Cloud project, the Pub/Sub topic, the push subscription and these settings.
Checks
yarn lint,yarn typecheck,yarn test:unit(141 tests) andtwenty app buildpass locally.- Not run: integration tests (they need a running server, CI runs them), and no real Pub/Sub push was received. The end-to-end path needs a Google Cloud project with the topic and push subscription and will be tested with a real account once this is merged.