Workflows
A workflow is a reusable automation that fires on a call event, calls an HTTP API (your CRM, an ITSM, a Power Automate flow, any HTTPS endpoint), and can store fields from the response as variables that the rest of the call can reuse. Use workflows to look up a customer at the moment of pickup, store their CRM/ITSM record id, and push the call result back to that record when the call ends.
Each workflow is built from one Action: a single HTTP call with a method, URL, headers, body and an optional response mapping.
The big picture: get → map → store → reuse
The pattern that makes workflows powerful is looking data up early and reusing it later:
- Get: on Agent Connected, a workflow calls your CRM/ITSM API with the caller’s number.
- Map & store: the Mapping pulls the record id out of the response and stores it as
$CRM_CONTACT_ID$. - Reuse: on Call Ended, a second workflow pushes the call outcome (duration, summary, recording link) back to that same record using
$CRM_CONTACT_ID$.
Stored variables live on the call (in its workflowContext) and persist across triggers, so a value captured at Agent Connected is still available at Call Ended.
Agent Connected ──► GET https://crm/contacts?phone=$CALLER_ID_E164$
mapping: { CRM_CONTACT_ID: "id" } ─┐ stores $CRM_CONTACT_ID$
│
Call Ended ───────► POST https://crm/contacts/$CRM_CONTACT_ID$/calls ◄─┘ reuses it
body: { duration: "$CALL_HANDLE_TIME$", summary: "$CALL_SUMMARY$" }
Creating a workflow
- Open Workflows from the sidebar.
- Click +Add.
- Fill in the fields and click Save.
Fields
| Field | Description |
|---|---|
| Display name | Workflow name. Required. |
| Scope | The Entity the workflow belongs to. Required. |
| Trigger event | The call event that fires the workflow: one of the five below. Required. |
| Action → Method | HTTP method: GET, POST or PUT. |
| Action → URL | The API endpoint to call. Supports $VARIABLE$ tokens (e.g. ?phone=$CALLER_ID_E164$). |
| Action → Headers | Key/value list of HTTP headers (e.g. Authorization). Values support $VARIABLE$. |
| Action → Body (JSON) | JSON object sent with POST/PUT. Values support $VARIABLE$. Toggle on/off. |
| Action → Mapping | Key/value list that stores response fields as variables: { variableName : responseField }. Toggle on/off. |
| Execution order | When several workflows share the same trigger on a flow, they run one after the other, smallest first (default 100). A later workflow can use the variables mapped by an earlier one. Whole number from 0 to 1000. |
| Stop the following workflows if this one fails | If this workflow fails, the next workflows of the same trigger on the flow do not run. |
Trigger events
Pick one event per workflow from the fixed list shown in the portal.
| Event | When it fires | Typical use |
|---|---|---|
| Agent Connected | An agent picks up the call. | Screen-pop / look up the customer and store their CRM/ITSM id for later. |
| Customer Abandoned | The caller hangs up while waiting in queue. | Log a missed call / create a call-back task. |
| Call Connected | The call is connected end to end. | Notify an external system that a conversation started. |
| Call Ended | The call ends, regardless of outcome. | Push the call result (duration, summary, recording) back to the CRM/ITSM. |
| Agent Declined | An alerted agent rejects or lets it ring out (RONA). | Alerting / supervision hooks. |
Look-ups belong on Agent Connected (early, so the value is available for the rest of the call). Write-backs belong on Call Ended (late, when the duration, summary and recording link exist).
Action: calling an API
The Action is one HTTP request.
- Method:
GETto read,POST/PUTto send a body. ForGET, put any query parameters directly in the URL. - URL: the full HTTPS endpoint. Every
$VARIABLE$is replaced before the call is sent. - Headers: add one row per header. Common headers:
| Header | Example value |
|---|---|
Authorization |
Bearer <your-token> |
Ocp-Apim-Subscription-Key |
<your-key> |
Content-Type |
application/json |
- Body (JSON): sent with
POST/PUT. Must be a valid JSON object (no duplicate keys, not an array).
Calling a Power Automate flow
Paste the flow’s HTTP request trigger URL into URL, set Method to POST, and send your fields in the Body:
// Action
"method": "POST",
"url": "https://prod-xx.westeurope.logic.azure.com/workflows/.../triggers/manual/paths/invoke?...sig=...",
"headers": { "Content-Type": "application/json" },
"body": {
"callId": "$callId$",
"caller": "$CALLER_ID_E164$",
"agent": "$AGENT_NAME$",
"summary": "$CALL_SUMMARY$"
}
If the Power Automate flow responds with data, add a Mapping to capture it (see below).
Variables: using call data in the Action
Anywhere in the URL, Headers or Body, wrap a variable name in $...$ and Heedify replaces it with the live value before sending the request. Names are case-sensitive; an unknown token is left unchanged.
Most-used variables
| Variable | Value |
|---|---|
$callId$ |
Unique call id |
$tenantId$ |
Tenant id |
$CALLER_ID$ |
Caller number (digits, no +) or Teams user id |
$CALLER_ID_E164$ |
Caller number in E.164 (+33…): use this for CRM lookups |
$AGENT_ID$ / $AGENT_NAME$ |
Connected agent id / display name |
$FLOW_NAME$ |
Call flow name |
$QUEUE_NAME$ |
First queue the call went through |
$CALL_HANDLE_TIME$ |
Talk time in seconds (available at Call Ended) |
$CALL_TERMINATION_REASON$ |
How the call ended (available at Call Ended) |
$CALL_SUMMARY$ |
AI call summary (available at Call Ended when transcription is on) |
$CALL_SENTIMENT$ |
Call sentiment: positive / neutral / negative / mixed |
$RECORDING_FILE_URL$ |
Link to the recording (available at Call Ended when recording is on) |
$TRANSCRIPT_FILE_URL$ |
Link to the transcript |
Not every variable exists at every moment. Caller, agent, flow and queue values are available from Agent Connected. Duration, termination reason, summary, sentiment and recording/transcript links only become available at Call Ended (summary and transcript require transcription/recording to be enabled on the flow).
All default variables
Every call exposes the variables below. The Available column says from when a variable has a value: before that moment the token is left unchanged.
| Variable | Meaning | Available |
|---|---|---|
| Call | ||
$callId$ |
Unique id of the call | Whole call |
$tenantId$ |
Microsoft 365 tenant id | Whole call |
$flowId$ |
Call flow id (the id of its Teams resource account) | Whole call |
$timestamp$ |
Current time, in Unix seconds | Whole call |
$nowIso$ |
Current time, ISO 8601 (UTC) | Whole call |
$DIRECTION$ |
IN (inbound) or OUT (outbound) |
Whole call |
$INTERACTION_TYPE$ |
Channel of the interaction: VOICE |
Whole call |
| Caller | ||
$CALLER_ID$ |
Caller phone number without +, or Teams user id for a Teams caller |
Whole call |
$CALLER_ID_E164$ |
Caller phone number in E.164 (+33…), or Teams user id. Use it for CRM look-ups. |
Whole call |
$CALLER_TYPE$ |
phone (PSTN caller) or user (Teams caller) |
Whole call |
| Call flow | ||
$FLOW_NAME$ |
Call flow name | Whole call |
$SCOPE$ |
Entity of the call flow | Whole call |
$LANGUAGE$ |
Call flow language (e.g. fr-FR) |
Whole call |
$TIMEZONE$ |
Call flow time zone (e.g. Europe/Paris) |
Whole call |
$IVR_CHOICE$ |
Digits the caller entered at the IVR menu | After the IVR menu |
| Queue | ||
$QUEUE_NAME$ |
Name of the first queue the call went through | Once queued |
$QUEUE_ID$ |
Id of the first queue the call went through | Once queued |
$QUEUE_WAIT$ |
Time waited in queue so far, readable (1 min 12 s) |
Once queued |
$QUEUEING_TIME$ |
Total time spent in queue, in seconds, counted when the call leaves the queue | Agent Connected, Customer Abandoned |
| Agent | ||
$AGENT_ID$ |
Microsoft Entra id of the agent who answered | Agent Connected |
$AGENT_NAME$ / $AGENT_DISPLAYNAME$ |
Display name of the agent who answered | Agent Connected |
$AGENT_RAW_ID$ |
Agent id in Teams format (8:orgid:<id>) |
Agent Connected |
$AGENT_ALERT_TIME$ |
Seconds the agent was alerted before answering | Agent Connected |
$AGENT_DECLINED$ |
Display name of the last agent who declined the call | After a decline |
$CALL_DECLINED_BY$ |
Ids of every agent who declined the call, comma-separated | After a decline |
$declinedAgentId$ / $declinedAgentName$ |
Id / display name of the agent who just declined | Agent Declined only |
| Timing and outcome | ||
$T_CALL_ANSWERED$ |
Time the call flow answered the call, in Unix seconds | Whole call |
$CALL_DURATION$ |
Time since the call flow answered, readable (3 min 05 s) |
Whole call |
$T_CALL_DISCONNECTED$ |
Time the call ended, in Unix seconds | Call Ended |
$CALL_HANDLE_TIME$ |
Talk time, in seconds | Call Ended |
$CALL_TERMINATION_REASON$ |
How the call ended | Call Ended |
| Recording, transcript and AI | ||
$RECORDING_FILE_URL$ |
Link to the recording | Call Ended, recording on |
$RECORDING_FILE_PATH$ |
Path of the recording file in Heedify storage | Call Ended, recording on |
$TRANSCRIPT_FILE_URL$ |
Link to the transcript | Call Ended, transcription on |
$TRANSCRIPT_FILE_PATH$ |
Path of the transcript file in Heedify storage | Call Ended, transcription on |
$TRANSCRIPT_TYPE$ |
FAST or REAL_TIME |
Call Ended, transcription on |
$CALL_TRANSCRIPTION$ / $transcriptionText$ |
Full transcript text | Call Ended, transcription on |
$CALL_SUMMARY$ |
AI summary of the call | Call Ended, transcription on |
$SUMMARY_FILE_URL$ |
Link to the summary file | Call Ended, transcription on |
$CALL_SENTIMENT$ |
positive, neutral, negative or mixed |
Call Ended, transcription on |
$CALL_ACTION_ITEMS$ |
Action items found in the call, as a JSON array | Call Ended, transcription on |
$CALL_SENTIMENT_TIMELINE$ |
Sentiment over the call, as a JSON array of {segment, sentiment, score, fromSec, toSec} |
Call Ended, transcription on |
| Other sources | ||
$SIP_<NAME>$ |
A SIP header received with the call (Direct Routing, SBC). The name is uppercased and every character other than a letter or digit becomes _: X-Ticket gives $SIP_X_TICKET$, and X-MS-Custom-Ticket also gives $SIP_TICKET$. |
Whole call |
$VOIP_<NAME>$ |
A VoIP header sent by an Azure Communication Services client, named the same way | Whole call |
$<your name>$ |
A value stored by the Mapping of an earlier workflow | After that workflow |
The Agent context tab of a call flow uses the same variables, read when the agent’s phone starts ringing: agent values and Call Ended values are not available there. See Agent context.
Mapping: storing the response for later
A Mapping turns fields from the API response into named variables you can reuse for the rest of the call. Each line is:
variableName ⟶ responseField
- Left (key): the variable name you invent. Use it later as
$variableName$. Pick names that won’t clash with the built-ins above. - Right (value): the field to read from the response JSON.
Example: look up a customer at pickup and store their CRM contact id and tier:
// Workflow A - Trigger: Agent Connected
"action": {
"method": "GET",
"url": "https://crm.example.com/contacts?phone=$CALLER_ID_E164$",
"headers": { "Authorization": "Bearer <your-token>" },
"mapping": {
"CRM_CONTACT_ID": "id",
"CRM_TIER": "tier"
}
}
After Workflow A runs, $CRM_CONTACT_ID$ and $CRM_TIER$ are available to every later workflow on the same call.
Then push the result back when the call ends:
// Workflow B - Trigger: Call Ended
"action": {
"method": "POST",
"url": "https://crm.example.com/contacts/$CRM_CONTACT_ID$/activities",
"headers": { "Authorization": "Bearer <your-token>" },
"body": {
"type": "phone_call",
"agent": "$AGENT_NAME$",
"durationSec": "$CALL_HANDLE_TIME$",
"outcome": "$CALL_TERMINATION_REASON$",
"summary": "$CALL_SUMMARY$",
"recording": "$RECORDING_FILE_URL$"
}
}
The same pattern works for an ITSM: store the ticket id at Agent Connected, append the call notes/recording to that ticket at Call Ended.
For a complete, step-by-step example with a real CRM, see HubSpot integration.
Worked example: CRM/ITSM screen-pop and write-back
| Step | Trigger | Action | Stores / uses |
|---|---|---|---|
| 1. Look up | Agent Connected | GET …/contacts?phone=$CALLER_ID_E164$ |
stores $CRM_CONTACT_ID$ |
| 2. Open ticket (optional) | Agent Connected | POST …/tickets with { "contactId": "$CRM_CONTACT_ID$" } |
stores $TICKET_ID$ |
| 3. Write back | Call Ended | POST …/tickets/$TICKET_ID$/notes with summary, duration, recording |
uses $CRM_CONTACT_ID$, $TICKET_ID$, $CALL_SUMMARY$ |
Order matters: a workflow that stores a variable must run before the workflow that uses it. The look-up (step 1) is on an early trigger; the write-back (step 3) is on Call Ended.
Testing a workflow
Click Test in the workflow form to open Test this workflow. It sends the request from your browser with test values, so you can check the URL, headers, body and mapping before attaching the workflow to a call flow.
- Enter a test value for each variable the request uses. Variables are replaced exactly as during a call: an empty one is sent as an empty string.
- Click Send request.
- Check the Request sent, the Response and the Mapped variables. A mapped field that the response does not contain is marked not found in the response.
- The test uses the form as it is now, even if it is not saved yet.
- A GET request is sent without its body.
- The timeout is 15 seconds, the same as during a call.
- If no response can be read, the API most often does not accept calls from the portal (CORS). It can still work during a real call, which is sent from the Heedify servers: check the URL, then test with a real call.
Validation
- Action URL must start with https://: plain HTTP is refused.
- Body must be valid JSON: an object, no duplicate keys, not an array.
- Mapping and Header values must be strings.
Attaching a workflow
Workflows run for the Entity (Scope) you selected, on the trigger you picked. You can also reference them from: