Webhook

The Webhook connector lets you listen to events from your backend. This connector is designed to be used with the Webhook trigger. To use the Webhook trigger in your integration, you must first configure a Webhook connector.

Before you begin

Before using the Webhook connector, do the following tasks:

  • In your Google Cloud project:
    • Enable the following services:
      • secretmanager.googleapis.com (Secret Manager API)
      • connectors.googleapis.com (Connectors API)

      To understand how to enable services, see Enabling services.

    • Grant the following IAM roles to the service account that you want to use for the connector:
      • roles/secretmanager.viewer
      • roles/secretmanager.secretAccessor

      A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs. If you don't have a service account, you must create a service account. For more information, see Creating a service account.

    If these services or permissions have not been enabled for your project previously, you are prompted to enable them when configuring the connector.

Configure the connector

Configuring the connector requires you to create a connection to your data source (backend system). A connection is specific to a data source. It means that if you have many data sources, you must create a separate connection for each data source. To create a connection, do the following steps:

  1. In the Cloud console, go to the Integration Connectors > Connections page and then select or create a Google Cloud project.

    Go to the Connections page

  2. Click + Create new to open the Create Connection page.
  3. In the Location section, choose the location for the connection.
    1. Region: Select a location from the drop-down list.

      For the list of all the supported regions, see Locations.

    2. Click Next.
  4. In the Connection Details section, complete the following:
    1. Connector: Select Webhook from the drop down list of available Connectors.
    2. Connector version: Select the Connector version from the drop down list of available versions.
    3. Connection Name: Enter a name for the Connection instance.

      Connection names must meet the following criteria:

      • Connection names can use letters, numbers, or hyphens.
      • Letters must be lower-case.
      • Connection names must begin with a letter and end with a letter or number.
      • Connection names cannot exceed 63 characters.
    4. Description: Optionally, enter a description for the connection instance.
    5. Service Account: Select a service account that has the required roles.
    6. Event Subscription: Event subscription will be enabled by default and is mandatory for webhook connector.
    7. Optionally, click + Add label to add a label to the Connection in the form of a key/value pair.
    8. Click Next.
  5. In the Event Subscription Details section, complete the following:
    1. Listener Authentication: Select an authentication type for event listener and enter the relevant details.

      The following authentication types are supported by the webhook listener:

    2. Event Type Field Location: Mandatory field which denotes the location (Header, Query Param or Request Body) where event type associated with the incoming event request will be present.
    3. Event Type Field Name: Mandatory field in the configured location identifies the type of event associated with the incoming event request.
    4. {
      "event_type": "user.created",
      ...
      // other request fields
      ...
      }
      In the example above, the event_type field in request body signifies that the request pertains to a "user.created" event.
    5. Select Enable private connectivity for secured connectivity between your backend application and your connection. If you select this option, you must perform additional configuration steps after creating the connection. For more information, see Private connectivity for event subscription.
    6. Enter the dead-letter configuration. If you configure dead-letter, the connection writes the unprocessed events to the specified Pub/Sub topic. Enter the following details:
      1. Dead-letter project ID: The Google Cloud project ID where you have configured the dead-letter Pub/Sub topic.
      2. Dead-letter topic: The Pub/Sub topic where you want to write the details of the unprocessed event.
    7. Click Next.
  6. Review: Review your connection and listener authentication details.
  7. Click Create.

Use the Webhook connection in an integration

After you create the connection, it becomes available in both Apigee Integration and Application Integration. You can use the connection in an integration through the Connectors task.

  • To understand how to create and use the Connectors task in Apigee Integration, see Connectors task.
  • To understand how to create and use the Connectors task in Application Integration, see Connectors task.

Get help from the Google Cloud community

You can post your questions and discuss this connector in the Google Cloud community at Cloud Forums.

What's next