Creating a webhook sink

A webhook table sends the rows of a query to an HTTP endpoint. Use it to call an external service for every result row.

  1. In the Streaming SQL Console, click Projects in the left navigation pane, and click the name of your project.
    The project opens, with the Explorer panel on the left. To open the Streaming SQL Console, see Accessing Cloudera SQL Stream Builder.
  2. In the Explorer, open the menu of Virtual Tables, and click New Webhook Table.
  3. In Table Name, enter a name.
  4. In HTTP Endpoint, enter the URL.
  5. In HTTP Method, select PUT or POST.
    The default is PUT.
  6. Optional: Optional: Change the retry settings.
    Table 1. Retry settings
    Setting Default Description
    Max Retries 4 How many times Cloudera SQL Stream Builder (SSB) retries a failed request.
    Initial Expiry 1s The wait before the first retry.
    Back-off Rate 3 The factor by which the wait grows with each retry.
  7. Optional: Optional: Turn off SSL Validation to accept certificates that cannot be verified.
    It is on by default.
  8. Optional: Optional: Turn on Ignore Failed Records to continue when a request fails after all retries.
    It is off by default.
  9. On the Request Template tab, enter the JSON body.
    Use ${column} placeholders for the values of the query. For example:
    {
      "icao": "${icao}",
      "altitude": "${altitude}"
    }
    Each placeholder becomes a column of the table, of type STRING. Without a template, the table has one STRING column, f0, and the request body is its value.
  10. Optional: Optional: On the HTTP Headers tab, add the headers.
    For each one, enter a Header Name and a Value.
  11. Click Create.
    A notification confirms that the table was saved.

Write to the table with an INSERT statement. For an example, see Webhook example. For the connector, see Webhook connector.