> ## 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.

# WhatsApp in Twilio Flex

> Route AI WhatsApp conversations into Flex as messaging tasks with the full transcript and contact profile attached.

WhatsApp conversations route through the Flex Conversations service as messaging tasks. When the AI hands off, your rep replies from the Flex UI and the reply lands on the contact's WhatsApp thread.

## Pre-requisites

<Warning>
  **Set up AI WhatsApp first.** Flex WhatsApp handoff depends on AI WhatsApp being wired up end-to-end — start with [AI WhatsApp Support](/whatsapp/introduction) and come back here.
</Warning>

* **AI WhatsApp configured and receiving messages** — see [AI WhatsApp Support](/whatsapp/introduction).
* **Twilio Flex credentials saved** — see [Connect Twilio Flex](/integrations/twilio-flex/connect).
* **Both webhooks registered** (TaskRouter + Conversations service).

## How messages land in Flex

```mermaid theme={"dark"}
flowchart LR
  A[Contact messages WhatsApp] --> B[AI replies]
  B --> C{AI can resolve?}
  C -- Yes --> D[Conversation closes]
  C -- No --> E[Handoff attribute set on task]
  E --> F[Workflow routes to human queue]
  F --> G[Rep replies from Flex]
```

## What the rep sees

* A **messaging task** in the Flex UI with the contact's WhatsApp profile name and number.
* The full AI-to-contact transcript in the conversation thread.
* The handoff note above the transcript with summary, sentiment, and reason.
* The six `handoff*` attributes on the task panel.
* Any `flex_*` custom data the workflow set during routing.
* Replies typed in the Flex UI send to the contact's WhatsApp.

## Channel-specific details

<AccordionGroup>
  <Accordion title="24-hour session window" icon="clock">
    WhatsApp's <Tooltip tip="Meta's rule: businesses can send free-form messages to a contact only within 24 hours of the contact's last message. Outside that window, only approved templates are allowed.">24-hour customer care window</Tooltip> applies. If your rep tries to reply outside the window, WhatsApp rejects the message unless it matches an approved template.
  </Accordion>

  <Accordion title="Template messages outside the window" icon="file-lines">
    To reach a contact outside the 24-hour window, reps must send an approved WhatsApp template. Template approval and variables happen in your WhatsApp Business account — not in OpenCX or Flex.
  </Accordion>

  <Accordion title="Media attachments" icon="paperclip">
    Images, documents, and audio sent by the contact appear on the Flex conversation as attachments. Size limits follow WhatsApp's per-media-type limits.
  </Accordion>

  <Accordion title="Contact profile name mapping" icon="id-card">
    The name on the task is pulled from the contact's WhatsApp profile. If the contact's profile name changes later, Flex won't retroactively update existing tasks — new tasks pick up the new name.
  </Accordion>
</AccordionGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="AI WhatsApp Support" icon="whatsapp" href="/whatsapp/introduction">
    The channel itself — numbers, templates, profile setup.
  </Card>

  <Card title="Connect Twilio Flex" icon="plug" href="/integrations/twilio-flex/connect">
    Credentials, webhook, workflow filters.
  </Card>

  <Card title="Twilio Flex overview" icon="headset" href="/integrations/twilio-flex/overview">
    What else Flex lights up across every channel.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/integrations/twilio-flex/troubleshooting">
    Missing task, wrong queue, events routed to the wrong org.
  </Card>
</CardGroup>
