Articles in this section

Reference webhook request headers and query parameters in transformations with handlebars

You can reference webhook query parameters with handlebars expressions when building a transformation. This technique is particularly useful in the following circumstances:

  • Dynamic event processing: A webhook receives events with types sent in the header (X-Event-Type). In such cases, you can extract and process the event type directly in the transformation, instead of building separate webhooks for each event type.

  • Routing and filtering: You can extract query parameters like orderId=12345 to route or filter data dynamically before exporting.

  • Custom authentication: You can access authorization headers to validate incoming webhook requests or to enhance security measures for workflows.

Use the following steps to reference webhook headers and query parameters with a handlebars expression:

  1. Click the settings gear (settings_gear.svg) for the transformation row.

  2. Select Handlebars expression from the Field transformation type drop-down list.

  3. Click (pencil_handlebars.svg) to open the Build handlebars expression AFE.

webhookQueryParamHeaders.png

Webhooks created in the Celigo platform have the following JSON structure:

{
  "record": {},
  "queryParams": {
    "param1": "value1",
    "param2": "value2"
  },
  "headers": {
    "key-1": "value",
    "key-2": "value"
  },
  "job": {
    "_id": "674893fd5438cd338353f770",
    "type": "export",
    "startedAt": "2024-11-28T16:02:05.497Z",
    "parentJob": {
      "_id": "674893fd5438cd338353f771",
      "type": "flow",
      "startedAt": "2024-11-28T16:02:00.497Z",
      "flowExecutionGroupId": "674893fd5438cd338353f772"
    }
  },
  "testMode": true,
  "lastExportDateTime": "2024-11-28T16:02:05.497Z",
  "currentExportDateTime": "2024-11-28T16:02:05.497Z",
  "settings": {
    "integration": {},
    "flow": {},
    "flowGrouping": {},
    "connection": {},
    "iClient": {},
    "export": {}
  }
}