Tried numbers can send and receive text messages. There are four ways to use SMS:
- One-off messages with
POST /send-sms. - SMS conversations where an agent replies to each inbound text, started by you with
POST /create-sms-chator by the customer texting your number. - The
send_smstool, so a voice agent can text the caller during a call (for example a booking link). - Info collection by SMS, where the agent asks the caller for details by text and the reply is parsed into the call's variables.
SMS is sent and received through Telnyx (TELNYX_API_KEY, TELNYX_MESSAGING_PROFILE_ID) on numbers that support messaging. Without keys, messages are stored and marked sent by the mock provider, and you can simulate replies in the dashboard.
Set up messaging#
Use a Telnyx number#
Buy the number through Telnyx so it is on your messaging profile. See Get a phone number.
Point the webhook at Tried#
In the Telnyx portal, set the messaging profile webhook to https://<api>/telnyx/webhook.
Verify signatures#
Set TELNYX_PUBLIC_KEY on the API (the Ed25519 public key from the Telnyx portal). Webhooks without a valid telnyx-signature-ed25519 and telnyx-timestamp are refused with 401.
Send a message#
curl -X POST https://api.tried.com.au/send-sms \
-H "Authorization: Bearer $TRIED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from_number": "+61255501234",
"to_number": "+61412345678",
"content": "Your appointment is confirmed for Tuesday at 3pm."
}'| Field | Type | Description |
|---|---|---|
from_number |
string | A number in your workspace. |
to_number |
string | Recipient in E.164. |
content |
string, up to 1600 chars | Message text. Default empty. |
media_urls |
string[], up to 10 | http(s) URLs to send as MMS. |
Either content or media_urls is required. The response is HTTP 201 with the message:
{
"message_id": "sms_6c1f...",
"chat_id": null,
"call_id": null,
"direction": "outbound",
"from_number": "+61255501234",
"to_number": "+61412345678",
"content": "Your appointment is confirmed for Tuesday at 3pm.",
"status": "sent",
"provider_message_id": "40318...",
"error": null,
"created_timestamp": 1792000000000
}status is one of queued, sent, delivered, failed or received. A failed send keeps the message with status: "failed" and the carrier error in error.
List messages with GET /list-sms-messages, filtered by chat_id or call_id, with limit up to 500 (default 100).
Two-way SMS conversations#
An SMS chat is a conversation between one of your numbers and a customer, driven by an agent. Each inbound text gets an agent reply using the agent's prompt and tools.
curl -X POST https://api.tried.com.au/create-sms-chat \
-H "Authorization: Bearer $TRIED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from_number": "+61255501234",
"to_number": "+61412345678",
"retell_llm_dynamic_variables": { "first_name": "Sam" }
}'| Field | Type | Description |
|---|---|---|
from_number |
string | Your number. |
to_number |
string | The customer. |
override_agent_id |
string | Agent to use. Default: a weighted pick from the number's outbound_agents. |
retell_llm_dynamic_variables |
object | Variables for the agent. |
metadata |
object | Stored on the chat. |
initial_message |
string | First message. Without it, the agent's begin message is sent (or the agent writes one). |
GET /get-sms-chat/:id returns the chat with its messages. POST /end-sms-chat/:id ends it.
When a customer texts first#
An inbound text to a number with no ongoing chat for that customer starts a new chat with a weighted pick from the number's inbound_agents, and the agent replies.
Opt-out keywords#
A message that is exactly stop, stopall, unsubscribe, cancel, end or quit (any case) flags the customer's contact as do-not-call and ends their open chat. Later sends to that contact are stored as failed with Recipient opted out (do-not-contact).
SMS in the dashboard#
On Phone Numbers, the Advanced Add-Ons section has an SMS card that opens Chat History. The SMS tab lists conversations with the customer, your number and the message count. Click one to read it.
In mock mode there is no real inbound SMS. Type in Reply as the customer and click Receive to feed a customer message into the chat; the agent answers it. End conversation ends the chat.
Texting during a call#
Give a voice agent a send_sms tool. During a phone call it texts the caller from the agent's number (the number the caller dialled, or the number the agent called from). The message appears in the call's transcript with role sms. To ask for details by text, use sms_content.type: info_collection: the caller's reply is parsed (by the LLM, or a heuristic in mock mode) into the call's collected dynamic variables. Info collection replies are matched for 24 hours.
Limits and gotchas#
- With
TRIED_KYC_REQUIRED=1, sending returns 403 until the business profile is approved. - Australian sender ID registration is a carrier step, not application code. Deployment step
- SMS runs through Telnyx. Twilio messaging is not built.
- Inbound MMS media URLs are stored on the message as
media_urls.