> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open.cx/llms.txt
> Use this file to discover all available pages before exploring further.

# Post Call Context Action

> Find the transferred call in Aircall by caller number and attach a call comment and a live insight card from an OpenCX workflow.

The **Post Call Context to Aircall** action lives inside the workflow builder. After the AI transfers a call to your Aircall line, it finds that call in Aircall and posts a persistent call comment and/or a live insight card for the receiving agent.

<Tip>
  Pair it with the **Voice Call Transferred** trigger — it fires right after the AI completes a transfer and carries the caller, destination, and transfer reason in its payload.
</Tip>

## Configure the action

<Steps>
  <Step title="Create a workflow on the Voice Call Transferred trigger">
    In the flow builder, pick the **Voice Call Transferred** trigger. Optionally restrict it to the transfer destination that points at your Aircall number, so the workflow doesn't fire for transfers going elsewhere.
  </Step>

  <Step title="Drop the node into your workflow">
    Add a `Post Call Context to Aircall` node from the **Integrations** category.
  </Step>

  <Step title="Paste your credentials">
    Fill **Aircall API ID** and **Aircall API Token** with the values from [Connect](/integrations/aircall/connect).
  </Step>

  <Step title="Point it at the caller">
    Set **Caller Phone Number** to `{{trigger.ticket.contact.phone_number}}`. This is the number OpenCX searches for in Aircall to find the transferred call.
  </Step>

  <Step title="Generate a call summary (optional)">
    To include a full AI summary of the call in the note, add an **Ask AI About Ticket** step *before* this action. Point its **Ticket Number** at `{{trigger.ticket.ticketNumber}}`, prompt it to summarize the call for the receiving agent, and give it an expected output with a `summary` string field. Reference its output in the comment (e.g. `{{ask_summary.result.summary}}`).
  </Step>

  <Step title="Write the context">
    Fill **Call Comment** with the note you want on the call record (e.g. the AI summary and transfer reason), build a live card with **Insight Card Title** + **Insight Card Fields**, and/or set **Call Tags**. At least one of the three must be provided.
  </Step>
</Steps>

A typical configuration (with an Ask AI About Ticket step id'd `ask_summary` before this action):

* **Call Comment**:

  ```text theme={"dark"}
  Transferred from OpenCX AI agent.

  Reason: {{trigger.transfer_reason}}

  Summary:
  {{ask_summary.result.summary}}

  View session in OpenCX:
  https://platform.open.cx/inbox/?s={{trigger.ticket.ticketId}}&org={{organization.id}}
  ```

* **Insight Card Title**: `OpenCX AI Call Context`

* **Insight Card Fields**: `Reason → {{trigger.transfer_reason}}`, `Session → View session in OpenCX` with **Link** set to the same session URL as the comment

* **Call Tags**: `opencx`

<Tip>
  The whole note is just workflow text — edit the template, reorder sections, or drop any of them. Newlines in the comment are preserved in the Aircall note, so you can format it into sections. Generating the summary as a workflow step (instead of baking it into the trigger) means transfers that don't post context to Aircall never pay for summarization.
</Tip>

<Note>
  Aircall call comments are plain text — no markdown or HTML. Include links as full raw URLs (as in the template above). For a guaranteed clickable link during the call, use an insight card field's **Link** input, which Aircall renders as a native hyperlink in the agent's phone app. `{{trigger.ticket.ticketId}}` is the OpenCX session UUID, so `https://platform.open.cx/inbox/?s={{trigger.ticket.ticketId}}&org={{organization.id}}` deep-links straight to the session in the inbox.
</Note>

## Inputs reference

<AccordionGroup>
  <Accordion title="Aircall API ID / API Token" icon="key">
    Required. The API key pair from your [Aircall dashboard](https://dashboard.aircall.io/view-api-keys). Sent as HTTP Basic auth.
  </Accordion>

  <Accordion title="Caller Phone Number" icon="phone">
    Required. The number used to search Aircall for the transferred call. Usually `{{trigger.ticket.contact.phone_number}}`. Both `+`-prefixed (E.164) and bare-digit spellings are tried automatically, E.164 first.
  </Accordion>

  <Accordion title="Call Comment" icon="note-sticky">
    Optional. Posted as a note on the Aircall call record; persists after the call ends.

    <Warning>
      Aircall allows at most **5 comments per call** and comments cannot be edited or deleted once posted. Emojis are stripped by Aircall.
    </Warning>
  </Accordion>

  <Accordion title="Insight Card Title / Fields" icon="id-card">
    Optional. Builds the card shown in the agent's Aircall phone app **during** the call — it is not stored after the call ends. Each field is a `{ label, text, link }` line; the whole card payload must stay under **10KB** (the action validates this before posting).
  </Accordion>

  <Accordion title="Call Tags" icon="tag">
    Optional. Tag names to add to the Aircall call (e.g. `opencx`). Tags that don't exist in your Aircall account yet are created automatically; existing tags are matched case-insensitively so no duplicates are created. Tags already on the call are kept.
  </Accordion>

  <Accordion title="Max Wait (seconds)" icon="clock">
    Defaults to `30` (maximum `40`). A freshly transferred call can take a few seconds to become searchable in Aircall, so the action polls every few seconds until it finds the call or this budget runs out. Set to `0` to try exactly once.
  </Accordion>
</AccordionGroup>

## How the call is matched

The action searches Aircall's call log for the caller's number, newest call first, bounded to the last 15 minutes:

1. Every spelling of the number is tried — `+13025494224` first (Aircall stores E.164), then `13025494224` — so it doesn't matter which format your contact record uses.
2. If the search comes back empty, the action waits a few seconds and retries until **Max Wait** elapses, absorbing Aircall's search-indexing lag.
3. Among matches, calls that are still **ringing or ongoing** win — the transferred call is by definition live when the workflow fires — so an older, already-ended call from the same number can never shadow the fresh transfer. Among those, inbound calls are preferred, then the newest.

## Output

| Key                 | Meaning                                          |
| ------------------- | ------------------------------------------------ |
| `success`           | `true` when everything requested was posted.     |
| `callId`            | The Aircall call ID the context was attached to. |
| `commentPosted`     | Whether a comment was posted.                    |
| `insightCardPosted` | Whether an insight card was displayed.           |
| `tagsApplied`       | How many tags were set on the call.              |
| `lookupAttempts`    | How many search rounds it took to find the call. |

## Good To Know

<AccordionGroup>
  <Accordion title="Insight cards are ephemeral" icon="hourglass-half">
    Aircall only shows insight cards on **ongoing** calls and discards them when the call ends. For context that must survive the call, use the comment as well.
  </Accordion>

  <Accordion title="Workflow-scoped credentials" icon="key">
    The API key is read from the node's own configuration every time the workflow runs — it is not stored at the organization level. Rotate the key and you will need to update every node that references it.
  </Accordion>

  <Accordion title="Errors surface as run failures" icon="triangle-exclamation">
    Bad credentials, no matching call within the wait budget, or a rejected post (e.g. the 6th comment on a call) fail the workflow run on this node with a descriptive error — nothing is swallowed silently.
  </Accordion>
</AccordionGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Connect" icon="plug" href="/integrations/aircall/connect">
    Generate the Aircall API ID and token.
  </Card>

  <Card title="Overview" icon="phone" href="/integrations/aircall/overview">
    How the transfer + context flow fits together.
  </Card>

  <Card title="AI Phone agent configuration" icon="gear" href="/phone/agent-config">
    Add the transfer destination that forwards calls to Aircall.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/integrations/aircall/troubleshooting">
    Call not found, credential errors, comment limits.
  </Card>
</CardGroup>
