diff --git a/api/tasks/run_integrations.py b/api/tasks/run_integrations.py index d73a39b..f60829c 100644 --- a/api/tasks/run_integrations.py +++ b/api/tasks/run_integrations.py @@ -1,6 +1,7 @@ """Execute integrations (QA analysis, webhooks) after workflow run completion.""" import random +from datetime import UTC, datetime from typing import Any, Dict, Optional import httpx @@ -316,6 +317,8 @@ def _build_render_context( "workflow_run_name": workflow_run.name, "workflow_id": workflow_run.workflow_id, "workflow_name": workflow_run.workflow.name if workflow_run.workflow else None, + "campaign_id": workflow_run.campaign_id, + "call_time": (workflow_run.created_at or datetime.now(UTC)).isoformat(), # Nested contexts "initial_context": workflow_run.initial_context or {}, "gathered_context": workflow_run.gathered_context or {}, diff --git a/docs/developer/webhooks.mdx b/docs/developer/webhooks.mdx index 81dff12..9988f72 100644 --- a/docs/developer/webhooks.mdx +++ b/docs/developer/webhooks.mdx @@ -26,6 +26,8 @@ The following variables are available in your `payload_template` using double-br | `workflow_run_name` | string | Name of the run | | `workflow_id` | integer | ID of the workflow | | `workflow_name` | string | Name of the workflow | +| `campaign_id` | integer \| null | ID of the campaign this run belongs to (null for ad-hoc runs) | +| `call_time` | string | ISO-8601 UTC timestamp of when the run was created | | `initial_context` | object | Context passed when the call was initiated | | `gathered_context` | object | Data extracted during the call by agent nodes | | `cost_info` | object | Call cost breakdown | diff --git a/docs/voice-agent/webhook.mdx b/docs/voice-agent/webhook.mdx index 511ac5c..5d3cb32 100644 --- a/docs/voice-agent/webhook.mdx +++ b/docs/voice-agent/webhook.mdx @@ -26,12 +26,16 @@ The payload can contain a valid JSON, and you can reference variables while cons - `{{workflow_run_id}}` Unique ID of the Agent run - `{{workflow_id}}` ID of the Agent - `{{workflow_name}}` Name of the workflow +- `{{campaign_id}}` ID of the campaign this run belongs to (empty for ad-hoc runs) +- `{{call_time}}` ISO-8601 UTC timestamp of when the call was initiated - `{{initial_context.*}}` [Initial context variables](/core-concepts/context-and-variables#initial_context) - `{{gathered_context.*}}` [Extracted variables](/core-concepts/context-and-variables#gathered_context) - `{{cost_info.call_duration_seconds}}` Call duration - `{{recording_url}}` Call recording URL - `{{transcript_url}}` Transcript URL +For the full list of available variables, authentication options, and receiver examples, see the [Webhook Payloads developer reference](/developer/webhooks). + An example of the payload is given below ```