Skip to main content

Google Chat

Google Chat event integrations receive interaction events directly from Google Chat over HTTP and trigger handler functions as users message, add, or interact with your Chat app. Use them to build Chat apps, bots, and interactive cards without polling any API.

note

The Google Chat listener must be reachable over a public HTTPS URL. For local development, use a tunneling tool such as ngrok to create a public URL for your local port.

After starting the integration, configure your Chat app in the Google Cloud Console under Google Chat API → Configuration: set the HTTP endpoint URL to your listener's public URL and choose an Authentication audience that matches your service's configuration. See the setup guide for details.

Creating a Google Chat listener​

  1. Click + Add Artifact in the canvas or click + next to Entry Points in the sidebar.

  2. In the Artifacts panel, select Google Chat under Event Integration.

  3. In the creation form, fill in the following fields:

    Create Google Chat form showing the Listener Name, Port, Auth Config, and HTTP Listener Config fieldsCreate Google Chat form showing the Listener Name, Port, Auth Config, and HTTP Listener Config fields
    FieldDescriptionDefault
    Listener NameIdentifier for the listener created with this service.chatListener
    PortThe port or HTTP listener to listen on.8000
    Auth ConfigAuthentication for the Chat API client: a service account, OAuth 2.0, or bearer token config.Required
    HTTP Listener ConfigOptional inbound HTTP listener settings.{}
  4. Click Create.

  5. WSO2 Integrator opens the service in the Service Designer. The canvas shows the attached listener pill and an empty Event Handlers section.

  6. Click + Add Handler to define how incoming events are processed.

Service configuration​

Service configuration controls the Google Chat trigger's audience validation, and the name, port, and auth settings of each attached listener.

In the Service Designer, click Configure to open the Google Chat Configuration panel.

The left panel shows Attached Listeners. Pick a listener under Attached Listeners to configure its connection settings in the main configuration panel.

Google Chat Configuration panel showing the Google Chat audience settings and the Attached Listeners list with the Name, Listen On, Auth Config, and HTTP Listener Config fieldsGoogle Chat Configuration panel showing the Google Chat audience settings and the Attached Listeners list with the Name, Listen On, Auth Config, and HTTP Listener Config fields

Main configurations​

FieldDescription
HTTP Endpoint URL Config or Project NumberThe audience the listener validates incoming bearer tokens against. Must match the Authentication audience configured for your Chat app. Required.

Listener configurations​

FieldDescription
NameThe name of the listener. Required.
Listen OnThe port or HTTP listener to listen on. Defaults to 8000.
Auth ConfigAuthentication for the Chat API client: a service account, OAuth 2.0, or bearer token config. Required.
HTTP Listener ConfigOptional inbound HTTP listener settings.

Click Attach Listener to attach an additional listener to the same service.

Click Save Changes to apply updates.

Event handlers​

An event handler is a remote function that WSO2 Integrator calls for each Google Chat interaction event received.

Adding an event handler​

In the Service Designer, click + Add Handler. A Select Handler to Add panel opens on the right listing the available event types.

Select Handler to Add drawer listing the Google Chat event handlersSelect Handler to Add drawer listing the Google Chat event handlers

Pick On Message, then click Save. This opens the Flow Designer for onMessage.

Flow canvas for the Google Chat onMessage handler with a built-in Error Handler blockFlow canvas for the Google Chat onMessage handler with a built-in Error Handler block

Every handler is scaffolded with a built-in Error Handler block. Use the flow canvas to add integration steps such as database writes, HTTP calls, and transformations, and edit the Error Handler block to define recovery logic for errors raised in the flow. Repeat these steps to add the other handlers you need.

Handler types​

chat:ChatService exposes one optional handler per Chat event type. Implement only the ones you need.

HandlerTriggered when
onMessageA user sends a message, @mentions the app, or invokes a slash command.
onAddedToSpaceThe app is added to a space.
onRemovedFromSpaceThe app is removed from a space.
onCardClickedA user clicks a button or interactive element on a card.
onWidgetUpdatedA widget requests an autocomplete or similar update.
onAppCommandA user invokes a Chat app command.
onAppHomeA user opens the app's home page.
onSubmitFormA user submits a form from the app's home page.

Each handler receives the event and, for most event types, an event-specific caller (chat:MessageCaller, chat:CardClickedCaller, chat:WidgetUpdatedCaller, chat:AppHomeCaller, or chat:SubmitFormCaller) pre-configured with the event's space context. Use the caller to respond synchronously within the event window. chat:MessageCaller and chat:CardClickedCaller can also call Chat APIs asynchronously (sendMessage, updateMessage, deleteMessage, getSpace).

What's next​