The Webhook integration generates a unique endpoint in Torq (URL). You can send external events to this address or use it to trigger workflows. Torq webhooks recognize several content types, which are transformed into JSON format. This means the event data will be accessible as key-value pairs from the event JSON.
You can also configure webhooks to accept raw HTTP requests. Raw data will not be transformed or structured.
Create a Webhook Trigger Integration
Perform these steps in Torq.
Go to Integrations > Triggers > Webhook and click Add.
Type a meaningful name for the integration - this cannot be changed later.
By default, the integration will work only with recognized content types. Check the Accept raw HTTP requests checkbox to work with unrecognized content types.
(Optional) Add authentication headers as required. We recommend adding authentication headers for security purposes.
Click Add to save the integration.
Copy the URL link.
You can provide the integration URL (endpoint) in other platforms to pass events from the other platforms to Torq or use the URL as a hyperlink that users can click to trigger a workflow.
Recognized Content Types
Torq Webhooks recognize the following content types. Torq automatically converts XML and form URL-encoded formats to JSON, accessible from the event JSON.
application/json
application/xml
text/xml
application/x-www-form-urlencoded
Raw Mode
Set up a webhook to accept unrecognized content types or get access to the raw HTTP request, including the HTTP method, headers, and more.
To enable raw mode, select the Accept raw HTTP requests checkbox when creating a new integration or editing an existing one.
An example of a trigger event in raw mode:
{ "body": { "hello": "world" }, "headers": { "Accept": [ "*/*" ], "Authorization": [ "bearer ***nskjaNjsnsjs" ], "Content-Length": [ "20" ], "Content-Type": [ "application/x-www-form-urlencoded" ], "User-Agent": [ "curl/8.1.2" ], "X-Real-Ip": [ "77.137.**.182" ] }, "http_method": "POST" }
In raw mode, if an unrecognized request is received, the event data won't be accessible as key/value pairs within the event JSON. Instead, the data will be accessible in string form from $.event.body
. When the event body is in string format, you can extract data such as IP addresses, email addresses, and so on by using one of the extraction utility steps and passing the $.event.body
expression as input. For example:
Trigger Workflows with the Webhook URL
The webhook URL (endpoint) can be embedded as a hyperlink, for example, in service tickets (JIRA, ServiceNow). Users can click the link to trigger a Torq workflow straight from the ticket. The webhook URL can be entered in a browser for the same result.
You can also provide key and value pairs with the URL to pass them into the trigger event JSON.
Add key and value pairs to the webhook URL: https://hooks.torq.io/v1/webhooks/997f45e6- - - -ac483691e340?key1=value1&key2=value2&key3=value3
The key and value pairs are available in the trigger event JSON and can be referenced during the workflow run.