chore: add campaign id in render context for webhook

This commit is contained in:
Abhishek Kumar 2026-05-12 19:32:41 +05:30
parent 7f0dac1ad5
commit 7249a9f8ed
3 changed files with 9 additions and 0 deletions

View file

@ -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 {},

View file

@ -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 |

View file

@ -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
```