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

# Messaging

When an agent is configured with a phone number, it answers texts. Each sender is one conversation, and the reply goes back from the number the text came in on.

## Phone Numbers

```bash theme={null}
telnyx-acp add phone +15550001234
telnyx-acp deploy
```

`deploy` puts the number on a messaging profile and points its webhook at the agent. A number that is missing from the account, or not active yet, stops the `deploy`. `telnyx-acp status` shows whether the webhook still points at the agent. `remove phone` plus the next `deploy`, or `delete`, put the number back where it was. The same number answers calls, which [Voice](/docs/agents/voice) covers.

To use a messaging profile that already exists, without touching numbers, add it as a channel:

```bash theme={null}
telnyx-acp add channel messaging_profile:<id>
```

The sender's number is the conversation, so the same person always reaches the same conversation. A redelivered text is recognized by its message id and never runs twice (the reply itself can go out twice only when the API's answer was lost between sending and recording it), and media-only messages are ignored.

A reply the messaging API refuses with a 5xx or a 429, or does not answer, is sent again after 30 seconds, then 1, 2, 5, 10, 20 and 30 minutes, about an hour in all; any other 4xx is final at once. Each failed try is one `{"delivery":"failed"}` or `{"delivery":"gave up"}` line in `telnyx-acp logs`, with the status and the API's reason.

Inside the Managed Harness follows a text through the code: [Phone](/docs/agent-sdk/inside/configuration/phone) and [Channels](/docs/agent-sdk/inside/configuration/channels) for what `deploy` wires, [The Messaging Webhook](/docs/agent-sdk/inside/request-handling/messaging-webhook) for receiving, and [Delivery](/docs/agent-sdk/inside/turn-taking/delivery) for the reply.

## Testing Without a Phone

`telnyx-acp invoke <name> --conversation <id> "<text>"` is one text turn against the deployed agent from any machine, and the fastest check that the deployment, the model and the instructions are right. It goes straight to the instance over the mount, so it says nothing about the number.

`telnyx-acp text "<message>"` tests the number. It sends an SMS from one of the account's own numbers to the agent's through the messaging API, the text arrives at the webhook as any phone's would, and the reply is read back from the conversation the sender's number names:

```sh theme={null}
$ telnyx-acp text "what do you remember about me?"
support-agent › I remember that your name is Alex and you live in Amsterdam.

The conversation is +15550001111; another `telnyx-acp text` from it continues it.
```

The sender is the first active number on a messaging profile other than the agent's own, or `--from <number>`; a number on the agent's profile cannot be the sender, since the reply would come back in on that profile as a new conversation. `--to` picks one of the agent's numbers when it has several. Both numbers are Telnyx's, so the text never crosses a carrier: that is why it works without 10DLC registration.

> [!NOTE]
>
> A text from a phone is a different matter. A US handset gets a reply only once the agent's number is 10DLC-registered (a brand, a campaign, the number assigned to it, in Mission Control under Messaging → 10DLC); until then the reply fails with error 40010. A phone outside the US cannot reach a US long code at all: its messaging is domestic. `deploy` and `status` say so on the number's line, `domestic texts only: this number cannot receive or send international SMS, so a phone abroad cannot reach it`, when the number's features say so. A messaging profile `deploy` creates is open to every destination, so a number that can text abroad replies abroad. `telnyx-acp text` is the way to test texting during development.
