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

# Embed a fully custom chat interface

> Build a mobile app, native desktop client, or custom portal that uses Text messaging without the standard widget.

**APIs involved:** [Customer Chat API](/docs/api/customer-chat/), [Customer Accounts API](/docs/api/customer-accounts/), [Chat Widget JS API](/docs/api/chat-widget-js-api/)

Suppose the standard Text widget doesn't fit your product — you're building a mobile app, a native desktop client, or a customer portal with its own design system.

The [Customer Chat API](/docs/api/customer-chat/) covers everything needed: starting chats, sending messages, receiving replies, and reading history. The Web API handles one-off requests; the RTM API gives you a persistent WebSocket connection so messages appear the instant they arrive.

<Steps>
  <Step title="Authenticate the customer">
    Get a `customer_access_token` from the [Customer Accounts API](/docs/api/customer-accounts/). Which grant type you use depends on your architecture:

    <Tabs>
      <Tab title="Cookie grant">
        For browser-based apps. Call `POST /customer/token` with `grant_type: cookie`. The Customer Accounts API sets a session cookie and returns a `customer_access_token` your client uses for all Customer Chat API calls.
      </Tab>

      <Tab title="Agent token grant">
        For mobile apps or backend-issued sessions. Your server calls `POST /customer/token` with `grant_type: agent_token`, authorized with an agent token. The response returns a `customer_access_token` scoped to that customer's identity.
      </Tab>

      <Tab title="Identity token grant">
        For transferring a session between devices or browsers. Generate an identity transfer token on the source device, then exchange it for a `customer_access_token` on the target device to continue the same conversation.
      </Tab>
    </Tabs>
  </Step>

  <Step title="Start or resume a chat">
    Call [`start-chat`](/docs/api/customer-chat/v3.6/chats/start-chat) to open a new conversation, or [`resume-chat`](/docs/api/customer-chat/v3.6/chats/resume-chat) if the customer has an existing thread. Both return a `chat_id` you'll use for all subsequent calls in that conversation.
  </Step>

  <Step title="Send and receive messages">
    Call [`send-event`](/docs/api/customer-chat/v3.6/events/send-event) to deliver customer messages to agents. To receive agent replies in real time, connect to the RTM API and subscribe to the `incoming_event` push — each agent message arrives as a push event with the message content and `chat_id`.
  </Step>
</Steps>

If you're building a hybrid — a custom interface that supplements rather than replaces the widget — the [Chat Widget JS API](/docs/api/chat-widget-js-api/) lets you control widget visibility and pass data from your custom UI to the widget without the two conflicting.
