Skip to main content

Call webhook with request data

Data Sources

Any package parameter of type String can be configured to get its value from the webhook request data. There are 3 request data sources:

Body

The whole request body will be converted to string and set as parameter value. A body with one of the following content types: application/json, application/xml and text/plain will be applied directly as it is received. In case a different content type is detected, it will be converted to Base64 encoded string and used this way.

note
  • The request body size should be less than or equal to 2 MB (exceeding the limit will result in 413 Request Entity Too Large response).
  • The request should be HTTP POST.

Headers

All request headers will be collected and converted to JSON key-value format.

For example request headers

Host: cozyroc.com
Origin: https://cozyroc.com
Referer: https://cozyroc.com/

will be converted to

{
"Host": ["cozyroc.com"],
"Origin": ["https://cozyroc.com"],
"Referer": ["https://cozyroc.com/"]
}

Query String

The request query string will be converted to JSON key-value format.

For example request query string

?user=john&code=68a0711871ab41e89f35d6e6e3a9f8b1

will be converted to

{
"user": ["john"],
"code": ["68a0711871ab41e89f35d6e6e3a9f8b1"]
}

Parameterization

  1. While developing a package create one or more parameters that will hold the webhook request data.

img

  1. Upload your package and add a webhook trigger.

img

  1. Your parameters will be available in the Parameters section of the webhook page.

img

  1. Configure the webhook data source for each of your parameters.

img

  1. After the configuration is done, your parameters should look like this:

img

  1. Click Create to save your webhook configuration.

Testing Webhook

  1. Copy Url from the webhook page.

img

  1. Open your favorite API client (e.g. Postman, Insomnia or Visual Studio Code with Thunder Client extension). In this guide we are going to use Postman.

  2. Choose the HTTP verb. We currently support HTTP GET and HTTP POST for all webhook endpoints. HTTP GET should be used only for verification purposes and won't trigger an execution. Also note that request body is available only for HTTP POST requests.

  3. Edit your request data.

img

  1. If the request is successful you should receive 200 OK as a response. If the webhook is disabled you will receive 403 Forbidden as a response.

  2. After the package execution is completed you can verify the execution parameters on execution details page.

execution-result

Call History

The Call History tab contains the list of all HTTP calls to the current inbound webhook. The time when the HTTP call event has occured (Timespamp), the request HTTP method (Method) and the response status code (Response) are directly available in the table. If you click on the link item dispayed in the first column a dialog will appear with all the details related to the call.

execution-result

Webhook Log Details contains the following sections:

  • Webhook Name
  • Timestamp
  • Method
  • Status Code
  • Query (Request querystring)
  • Headers (Request headers)
  • Body (Request body)
  • Response Content
  • Response Type

execution-result