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

# SMS in Twilio Flex

> Route AI SMS conversations into Flex as messaging tasks so reps reply from the Flex UI to the contact's phone.

Inbound SMS 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 phone as an SMS.

## Pre-requisites

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

* **AI SMS configured and receiving messages** — see [AI SMS Support](/sms/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 texts number] --> 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 phone number as the subject.
* The full AI-to-contact SMS 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 as SMS to the contact's number.

## Channel-specific details

<AccordionGroup>
  <Accordion title="Opt-out keywords" icon="ban">
    Twilio's default opt-out keywords (`STOP`, `UNSUBSCRIBE`, etc.) are handled upstream by your carrier — the OpenCX AI never sees a message from an opted-out number, and no Flex task is created.
  </Accordion>

  <Accordion title="10DLC and toll-free rules still apply" icon="flag">
    Flex SMS inherits the same <Tooltip tip="10-digit long-code registration. US carriers require every business-to-person SMS number to be registered before high-throughput messaging is allowed." cta="Learn more" href="/sms/compliance">10DLC</Tooltip> or toll-free verification rules as any other Twilio SMS integration. OpenCX does not add or waive those — fix any registration issues with Twilio.
  </Accordion>

  <Accordion title="Session matching by phone number" icon="fingerprint">
    OpenCX matches an inbound SMS to an existing session by the contact's phone number. A new number is a new session; an existing number continues the last session until it closes.
  </Accordion>

  <Accordion title="MMS behavior" icon="image">
    MMS attachments flow through to the Flex conversation as media attachments. Reps can view them inline and reply with their own attachments; MMS quotas and size limits follow your Twilio plan.
  </Accordion>
</AccordionGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="AI SMS Support" icon="comment-sms" href="/sms/introduction">
    The channel itself — numbers, routing, compliance.
  </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>
