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

# Route messages from external channels

> Bridge SMS, WhatsApp, or custom mobile apps into Text so external conversations land alongside your web chats.

**APIs involved:** [Customer Chat API](/docs/api/customer-chat/), [Customer Accounts API](/docs/api/customer-accounts/), [Agent Chat API](/docs/api/agent-chat/), [Configuration API](/docs/api/configuration/)

Suppose your customers contact you through SMS, WhatsApp, or a proprietary mobile app and you want those conversations to land in Text alongside your web chats. Your server acts as the bridge — it receives messages from the external channel, opens chats in Text on the customer's behalf, and relays agent replies back. Your agent token needs the `customers:own` scope to issue customer tokens.

<Steps>
  <Step title="Authenticate the customer">
    Use the **agent token grant** on the [Customer Accounts
    API](/docs/api/customer-accounts/): your server calls `POST /customer/token` with
    `grant_type: agent_token`, authorized with an agent access token. The
    response contains a `customer_access_token`. Use that token to authorize all
    subsequent Customer Chat API calls on behalf of that customer. Pass
    `entity_id` if the customer already exists in Text, or omit it to create a
    new customer identity.
  </Step>

  <Step title="Open a conversation">
    Call [`start-chat`](/docs/api/customer-chat/v3.6/chats/start-chat) on the
    [Customer Chat API](/docs/api/customer-chat/) and send the customer's first
    message as an event. From that point, the conversation is visible to your
    agents.
  </Step>

  <Step title="Relay agent replies back to the channel">
    Subscribe to [`incoming_event`](/docs/api/webhooks/v3.6/#incoming_event). When an
    agent replies, your server receives the event and delivers it to the
    original channel.
  </Step>

  <Step title="Configure routing">
    Each external channel typically maps to a Text group. Set up routing rules
    via the [Configuration API](/docs/api/configuration/) so SMS chats, WhatsApp
    chats, and web chats land in the right queues with the right agents.
  </Step>
</Steps>
