- 30 Jan 2023
- 2 Minutes to read
- Updated on 30 Jan 2023
- 2 Minutes to read
The Webhook integration generates a unique endpoint in Torq (URL). You can send external events to this address or have users use it to trigger workflows. Torq webhooks recognize several content types, which are transformed to JSON format in Torq. This means that the event data will be accessible as key-value pairs from the event JSON.
You can also send unrecognized content types to a Torq endpoint (URL), but the data will not be transformed or structured.
Create a Webhook integration
Perform these steps in Torq.
- Go to Integrations > Triggers.
- Locate Webhook and click Add.
- Type a meaningful name for the integration instance.
- 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 create the integration.
- Locate the integration and copy the URL link.
- 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 and they are accessible from the event JSON.
Unrecognized content types
For an unrecognized content type to be ingested as an event in Torq, make sure you enable Accept raw HTTP requests mode. You can enable this mode when you create a new integration or by editing an existing integration.
If this mode is off, you'll get an error. When you send an unrecognized content type to Torq, the event data will not be accessible as key/value pairs from the event JSON. Rather, the data will be accessible from $.event.body in string form.
To extract data from the event, such as IP addresses, email addresses, and so on, you'll need to use a step that extracts data, and pass the $.event.body expression as input.
Trigger workflows with the Webhook URL
The webhook URL (endpoint) can be embedded in the form of 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 and have them available in 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.