Skip to main content

Automation Examples

End-to-end examples showing how to combine multiple actions into automation chains.

Route by event type

Filter incoming webhooks and forward only specific events to your service.

Actions:

  1. Condition — only continue for order events
{
"type": "condition",
"name": "Filter order events",
"config": {
"conditions": [
{"body.type": {"$in": ["order.created", "order.updated", "order.completed"]}}
],
"on_match": "continue",
"on_no_match": "stop"
}
}
  1. HTTP Request — forward to your service
{
"type": "http_request",
"name": "Forward to order service",
"config": {
"url": "https://api.example.com/webhooks/orders",
"method": "POST",
"headers": {"Content-Type": "application/json"},
"body": "$request.body.json$"
}
}

Extract, transform, and forward

Pull specific fields from the webhook and send a transformed payload.

Actions:

  1. Extract JSON — pull order details from the body
{
"type": "extract_json",
"name": "Extract order fields",
"config": {
"source": "body",
"extractions": [
{"path": "order.id", "variable": "order_id"},
{"path": "order.customer.email", "variable": "email"},
{"path": "order.total", "variable": "total"}
]
}
}
  1. HTTP Request — forward a simplified payload
{
"type": "http_request",
"name": "Send to CRM",
"config": {
"url": "https://crm.example.com/api/events",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer $store.crm_token$"
},
"body": "{\"order_id\": \"$variable.order_id$\", \"email\": \"$variable.email$\", \"total\": $variable.total$}"
}
}

Slack notification on specific events

Send a formatted Slack message when a payment succeeds.

Actions:

  1. Condition — only process successful payments
{
"type": "condition",
"name": "Payment succeeded?",
"config": {
"conditions": [
{"body.type": {"$eq": "payment_intent.succeeded"}}
],
"on_match": "continue",
"on_no_match": "stop"
}
}
  1. Extract JSON — get payment details
{
"type": "extract_json",
"name": "Extract payment info",
"config": {
"source": "body",
"extractions": [
{"path": "data.object.amount", "variable": "amount"},
{"path": "data.object.currency", "variable": "currency"},
{"path": "data.object.customer", "variable": "customer_id"}
]
}
}
  1. HTTP Request — post to Slack
{
"type": "http_request",
"name": "Notify Slack",
"config": {
"url": "https://hooks.slack.com/services/T00/B00/xxx",
"method": "POST",
"headers": {"Content-Type": "application/json"},
"body": "{\"text\": \"Payment received: $variable.amount$ $variable.currency$ from customer $variable.customer_id$\"}"
}
}

Store data and reference it later

Persist a value for use by future webhook requests.

Actions:

  1. Extract JSON — pull the API token from the webhook
{
"type": "extract_json",
"name": "Extract token",
"config": {
"source": "body",
"extractions": [
{"path": "credentials.api_key", "variable": "api_key"}
]
}
}
  1. Store Variable — save to Datastore with 1-hour TTL
{
"type": "store_variable",
"name": "Cache API key",
"config": {
"key": "webhook_api_key",
"value": "$variable.api_key$",
"ttl_seconds": 3600
}
}
  1. HTTP Request — use the stored token in a subsequent call
{
"type": "http_request",
"name": "Call external API",
"config": {
"url": "https://api.example.com/sync",
"method": "POST",
"headers": {
"Authorization": "Bearer $store.webhook_api_key$"
},
"body": "$request.body.json$"
}
}

Script-based transformation

Use a run_script action for complex logic that template interpolation can't express.

Actions:

  1. Run Script — transform a GitHub push event into a Slack message
{
"type": "run_script",
"name": "Transform GitHub to Slack",
"config": {
"code": "function handle(request) {\n var event = request.headers['x-github-event'];\n if (event !== 'push') return [];\n\n var repo = request.body.repository.full_name;\n var pusher = request.body.pusher.name;\n var commits = request.body.commits.length;\n\n return [{\n url: 'https://hooks.slack.com/services/T00/B00/xxx',\n method: 'POST',\n body: {\n text: pusher + ' pushed ' + commits + ' commit(s) to ' + repo\n }\n }];\n}"
}
}

Dynamic response

Return a custom response to the webhook sender based on extracted data.

Actions:

  1. Extract JSON — get the event ID
{
"type": "extract_json",
"name": "Extract event ID",
"config": {
"source": "body",
"extractions": [
{"path": "id", "variable": "event_id"},
{"path": "type", "variable": "event_type"}
]
}
}
  1. Modify Response — return a confirmation with the event ID
{
"type": "modify_response",
"name": "Confirm receipt",
"config": {
"status_code": 200,
"headers": {"Content-Type": "application/json"},
"body": "{\"received\": true, \"event_id\": \"$variable.event_id$\", \"type\": \"$variable.event_type$\"}"
}
}