GCP.WorkspaceEvents reference
Subscription
Section titled “Subscription”Source:
src/GCP/WorkspaceEvents/Subscription.ts
A Google Workspace Events subscription.
Subscriptions have no labels field, so Alchemy stamps ownership onto
the destination Pub/Sub topic (alchemy-wesub-*) for list / nuke.
targetResource, the Pub/Sub topic, payload options, and Drive options
are identity — changing them replaces the subscription. Event types and
expiration update in place. Creating a subscription requires Workspace
Events OAuth scopes for the target resource (Chat, Drive, or Meet).
Subscription: Creating a Subscription
Section titled “Subscription: Creating a Subscription”Chat space messages to a Pub/Sub topic
const topic = yield* GCP.PubSub.Topic("ChatEvents", {});const sub = yield* GCP.WorkspaceEvents.Subscription("SpaceEvents", { targetResource: "//chat.googleapis.com/spaces/SPACE_ID", eventTypes: ["google.workspace.chat.message.v1.created"], pubsubTopic: topic.name,});Generated topic
const sub = yield* GCP.WorkspaceEvents.Subscription("MeetEvents", { targetResource: "//meet.googleapis.com/spaces/SPACE_ID", eventTypes: ["google.workspace.meet.conference.v2.started"],});Subscription: Updating a Subscription
Section titled “Subscription: Updating a Subscription”// Same logical id, changed props: the engine updates it in place.const sub = yield* GCP.WorkspaceEvents.Subscription("SpaceEvents", { targetResource: "//chat.googleapis.com/spaces/SPACE_ID", eventTypes: [ "google.workspace.chat.message.v1.created", "google.workspace.chat.message.v1.updated", ], pubsubTopic: topic.name, ttl: "86400s",});