ZIS Bundle: Parsing and sending an event to webhook.site
The following example bundle uses the Transform action to parse an event payload and put together a string which is then posted to a webhook.site.
The bundle allows you to see the incoming event payload ($.input
) and other data available in the ZIS Flow object ($.subdomain
, $.integration_key
, $.account_id
). See Data accessible to Actions in Flows.
{
"zis_template_version": "2019-10-14",
"name": "Simple event parser",
"description": "React to incoming events by parsing the entire payload and sending it to webhook.site",
"resources": {
"webhook_site.post_message_action": {
"type": "ZIS::Action::Http",
"properties": {
"name": "webhook_site.post_message_action",
"definition": {
"method": "POST",
"url.$": "https://webhook.site/{{$.path}}",
"requestBody": {
"text.$": "$.message"
}
}
}
},
"parse_and_dump_event_flow": {
"type": "ZIS::Flow",
"properties": {
"name": "parse_and_dump_event_flow",
"definition": {
"StartAt": "ParseEvent",
"States": {
"ParseEvent": {
"Type": "Action",
"ActionName": "zis:common:transform:Jq",
"Parameters": {
"expr": "[((. | to_entries) | map(\"\" + .key + \": \" + (.value | tostring)) | join(\",\") | tostring)]",
"data.$": "$"
},
"ResultPath": "$.webhooksite.message",
"Next": "PostMessageToWebhook_Site"
},
"PostMessageToWebhook_Site": {
"Type": "Action",
"ActionName": "zis:{integration_name}:action:webhook_site.post_message",
"Parameters": {
"path": "{webhook_site_path}",
"message.$": "A thing happened, and the incoming event payload is: {{$.webhooksite.message}}"
},
"End": true
}
}
}
}
},
"parse_and_dump_event_job_spec": {
"type": "ZIS::JobSpec",
"properties": {
"name": "parse_and_dump_event_job_spec",
"event_source": "support",
"event_type": "ticket.CommentAdded",
"flow_name": "zis:{integration_name}:flow:parse_and_dump_event_flow"
}
}
}
}
Replace the following placeholders with your own values:
{integration_name}
with the name of your integration{webhook_site_path}
with the unique identifier from a https://webhook.site/ test URL https://webhook.site/{webhook_site_path}. Example:36cd21b5-8ed3-42e7-b524-6cd946c51ef8
.