Skip to main content
Webhook

Set up Torq webhooks to create endpoints for external events and trigger workflows.

Updated over a week ago

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.

  1. Go to Integrations > Triggers > Webhook and click Add.

  2. Type a meaningful name for the integration - this cannot be changed later.

  3. By default, the integration will work only with recognized content types. Check the Accept raw HTTP requests checkbox to work with unrecognized content types.

  4. (Optional) Add authentication headers as required. We recommend adding authentication headers for security purposes.

  5. Click Add to save the integration.

  6. Copy the URL link.

  7. 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.

Screenshot of creating a Webhook integration in Torq and copying the endpoint URL.

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.

Screenshot of selecting to accept raw http response for a webhook integration.

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:

Screenshot showing how to reference and access data from the webhook event.

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

Screenshot of triggering a workflow by accessing the webhook URL in a browser.

The key and value pairs are available in the trigger event JSON and can be referenced during the workflow run.

Screenshot of the event log for the Webhook integration after triggering the workflow from a browser.
Did this answer your question?