Google Meet: add a client for Google's event subscriptions
Merged
EH
2d ago+552+552+012345678901234567890123456789-33-33-01234567890123456789
Context
Follows https://github.com/twentyhq/twenty/pull/30598 in the Google Meet app series started in https://github.com/twentyhq/twenty/pull/30587.
The app will learn about new transcripts from Google instead of polling: each connected user gets a Google Workspace Events subscription that publishes Meet events to a Pub/Sub topic, which pushes them to a Twenty server route. The polling approach in https://github.com/twentyhq/twenty/pull/30599 was closed in favour of this. This PR is the first of the push series and only adds the client for the subscriptions API. Nothing calls it yet.
What this PR does
- Adds
createGoogleMeetEventSubscriptionOrThrow,renewGoogleMeetEventSubscriptionOrThrowanddeleteGoogleMeetEventSubscription, which callworkspaceevents.googleapis.com/v1/subscriptions. Create targets one Google user and thetranscript.v2.fileGeneratedevent, renew asks for the longest lifetime Google allows (7 days), delete tolerates a subscription Google no longer has. - Create and renew return a long-running operation.
waitForGoogleWorkspaceEventsOperationOrThrowpolls it (up to 5 times, 1 second apart) when Google returns it unfinished, andreadGoogleMeetEventSubscriptionOrThrowunwraps the subscription or reports the operation's error. - Lets
fetchGoogleMeetJsonsend a method and a JSON body, so the new calls reuse the existing error handling. Retries stay limited to requests that are safe to repeat: aPOSTis sent once, so a create that succeeded behind a 5xx is not sent again. - Moves the URL building and its path guard into
buildGoogleApiUrlOrThrow, shared by the Meet API and the events API.
Checks
yarn lint,yarn typecheck,yarn test:unit(78 tests) andtwenty app buildpass locally.- Not run: integration tests (they need a running server, CI runs them), and no call was made against the real Google API. The first real call comes when the app subscribes on connect, later in the series.