Webhook connector
The Webhook connector is a sink that sends the rows of a query to an HTTP endpoint with a POST or a PUT request. Use it to start a process or to notify a service when a query finds a row.
Example
The following example sends each row of the query as a JSON message:
CREATE TABLE alert_webhook (
order_id STRING,
amount DOUBLE
) WITH (
'connector' = 'webhook2',
'url' = 'https://<service-host>/alerts',
'http-method' = 'POST',
'http-headers' = 'Content-Type:application/json'
);
INSERT INTO alert_webhook
SELECT order_id, amount
FROM orders
WHERE amount > 1000;
Properties
| Property | Description |
|---|---|
connector | webhook2 |
url | The address that receives the requests. It is mandatory. |
http-method | POST or PUT. It is mandatory. |
template | A JSON message with placeholders in the form ${column}, which the connector replaces with the values of the row. Without a template, the connector sends the row in the schema of the table. |
http-headers | Additional headers of the request, for example for authentication. |
max-retries | The number of retries when a request fails. The default is 4. |
initial-expiry | The time before the first retry. The default is 1 second. |
back-off-rate | The factor by which the wait grows after each retry. The default is 3. |
ignore-failed-records | Whether the job continues when a request ultimately fails. The default is false, which fails the job. |
disable-ssl-verification | Whether the connector skips the check of the certificate of the endpoint. The default is false. |
To create a webhook table with the form of the Streaming SQL Console, see Creating a webhook sink. For an example, see Webhook example.
