ZIS bundle: Parsing and sending an event to an external API
The following example bundle uses the Transform action to parse an event payload into a string. The bundle then posts the string to a RequestBin endpoint URL. The URL represents an external API.
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 an external API","resources": {"external_api.post_message": {"type": "ZIS::Action::Http","properties": {"name": "external_api.post_message","definition": {"method": "POST","url.$": "$.external_api_url","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": "$.external_api.message","Next": "PostMessageToExternalApi"},"PostMessageToExternalApi": {"Type": "Action","ActionName": "zis:INTEGRATION:action:external_api.post_message","Parameters": {"external_api_url": "REQUESTBIN_URL","message.$": "A thing happened, and the incoming event payload is: {{$.external_api.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:flow:parse_and_dump_event_flow"}}}}
Replace the following placeholders with your own values:
- "INTEGRATION" with the name of your integration
- "REQUESTBIN_URL" with a RequestBin endpoint URL. Example: "https
://abc123.x.pipedream.net".