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

# SMS

> Test an agent that answers by text message.

Connect an agent that customers reach by texting a phone number. Each Digital Human texts your agent's number from its own number over the real carrier network, and your agent replies by text.

## Connect

> [tab] Website
>
> **1. Turn on SMS testing**
>
> SMS testing is on Growth, Scale, and Enterprise plans. Click **Request SMS testing** in the run dialog and describe what your agent texts. You can run SMS simulations once Bluejay approves it.
>
> **2. Create the agent**
>
> Create a Text agent with the **SMS** connection type. Enter your agent's number in E.164 format, for example `+15551234567`. The number must be able to send and receive texts.
>
> * **Inbound**: each Digital Human texts your agent first.
> * **Outbound**: your agent texts each Digital Human first. Set up a trigger, as in [Outbound agents](#outbound-agents).
>
> **3. Give the Digital Humans numbers**
>
> Each Digital Human texts from its own number, so give each one a number. See [Digital Human numbers](https://docs.getbluejay.ai/integrations/phone-number.md#digital-human-numbers).
>
> **4. Run a simulation**
>
> [Create a simulation](https://docs.getbluejay.ai/test/simulations/create.md) for the agent and run it. Bluejay grades each conversation against your success criteria and custom metrics.

> [tab] API
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> curl -X POST https://api.getbluejay.ai/v1/add-agent \
>   -H "X-API-Key: $BLUEJAY_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "name": "Support Texts",
>     "system_prompt": "You help customers by text.",
>     "goals": ["Answer order status questions by text"],
>     "type": "INBOUND",
>     "mode": "TEXT",
>     "connection_type": "SMS",
>     "phone_number": "+15551234567"
>   }'
> ```
>
> Queue runs with [Queue Simulation Run](https://docs.getbluejay.ai/api-reference/endpoint/queue-simulation-run-v2.md) and the simulation's ID. Your organization still needs SMS testing turned on, as in the **Website** tab.

## How a conversation runs

The two sides take turns. The Digital Human waits for its **Patience** before each reply. See [Behavior](https://docs.getbluejay.ai/test/simulations/digital-humans.md#behavior).

Your agent must reply from the number saved on the agent.

### How a conversation ends

A conversation ends when:

* The Digital Human ends it.
* The conversation reaches the simulation's maximum number of turns, 100 messages from both sides by default. The Digital Human then sends a goodbye text.
* No text arrives for 5 minutes. A simulation can set this from 5 to 30 minutes.

## Outbound agents

Your agent must text first, so tell it when a run starts. Set an **Outbound Trigger Webhook URL** on the agent. Bluejay sends one `POST` for each conversation with the Digital Human's number, and your system then texts that number. See [Outbound trigger webhook](https://docs.getbluejay.ai/test/simulations/reference.md#outbound-trigger-webhook) for the body, headers, and retries.

Without a trigger, each Digital Human waits until the run times out.

## Text after a call

If your voice agent texts the customer after a call, for example a booking confirmation, test the call and the text together with a [Customer Journey](https://docs.getbluejay.ai/test/simulation-types/customer-journeys.md). See [Test a Text Follow-Up After a Call](https://docs.getbluejay.ai/cookbook/call-then-text-follow-up.md).

## Monitor

To check an SMS agent on a schedule, use [Uptime Monitoring](https://docs.getbluejay.ai/monitor/uptime/overview.md). To grade your production text conversations, send them to [Logs](https://docs.getbluejay.ai/monitor/logs#text-and-sms).

## Troubleshooting

| What you see | What to do |
| - | - |
| `403`: sms\_testing\_not\_enabled | Your organization does not have SMS testing turned on. Request it from the run dialog, or from **Request** in the **SMS Testing** section of your settings. |
| `400` that names Digital Humans without a phone number | Give each Digital Human in the run a number. |
| `409`: a TEXT simulation is already running with the same phone number pair | A pair of numbers can be in only one running SMS conversation at a time. Wait for the other run to finish or cancel it. From the API, set terminate\_overlapping\_simulations to `true` to end the other conversations. |
| An Outbound conversation never starts | Check that the agent has an **Outbound Trigger Webhook URL** and that your system texts from the agent's number. |
| The transcript has only the Digital Human's first text | No reply reached Bluejay from the agent's number. Check that your agent replies from the number saved on the agent. |

## Related

* [Phone Number](https://docs.getbluejay.ai/integrations/phone-number.md)
* [Email](https://docs.getbluejay.ai/integrations/email.md)
* [Create a Simulation](https://docs.getbluejay.ai/test/simulations/create.md)
* [Digital Human Reference](https://docs.getbluejay.ai/test/simulations/digital-humans.md)
* [Agents API](https://docs.getbluejay.ai/api-reference/endpoint/add-agent.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.