Skip to main content
connic
Connectors

Telnyx Messaging

Start agents with incoming SMS/MMS, WhatsApp, and RCS messages, and send replies, media, and approved WhatsApp templates through Telnyx.

Last updated
ModesInbound, outbound
YAML typetelnyx_messaging
CredentialsA Connection of type Telnyx, shared with Telnyx Voice
BridgeNot supported
Custom domainNot supported
Linked agentsOne or more. An incoming message starts every linked agent; on outbound, each link sets how its agent sends.
While pausedInbound: Telnyx gets 200 and no run starts. The message isn't stored or replayed. Outbound: nothing is sent.

Set up

  1. In Telnyx, prepare the sender: a number with SMS or MMS, or an enabled, registered WhatsApp number or RCS agent, with a messaging profile assigned. For inbound SMS and WhatsApp, give the number a messaging profile of its own and move other numbers and short codes to a different profile.

  2. Open the agent. In Connector Flow, click Add inbound connector for inbound or Add outbound connector for outbound. Then click Create New Connector and select Telnyx Messaging.

  3. Choose the Mode. Under Connection, pick a Telnyx Connection or create one with the API key and the account's public key. Select the Channel, then the Telnyx sender. Senders the connector can't use, such as a number without a messaging profile or one on a shared profile, are listed but disabled, with the reason. For a WhatsApp number that isn't hosted on Telnyx, enter its WhatsApp messaging profile ID. For outbound, optionally set a Default recipient and a Default WhatsApp template. Click Create.

  4. For inbound, connic sets the webhook on the sender's messaging profile or RCS agent; see Provider setup. An external WhatsApp number needs the webhook entered by hand. For outbound, choose how the agent sends: Automatic outbound connector, Agent-tool outbound connector, or Middleware outbound connector. For replies, choose Only selected inputs and select the inbound connector.

  5. Send a message to the sender and open the run. For outbound, open the connector's run and look up the returned message ID in Telnyx.

In code

Declare the connectors in connectors/*.yaml. Quote phone numbers and IDs; unquoted, YAML reads a number such as +14155550123 as an integer and the deploy fails. An inbound connector that receives SMS:

connectors/support-sms.yaml
type: telnyx_messaging
mode: inbound
connection: support-telnyx
config:
  channel: sms
  sender: "+14155550123"
agents:
  - messaging-assistant

An outbound connector that replies from the same number:

connectors/support-sms-replies.yaml
type: telnyx_messaging
mode: outbound
connection: support-telnyx
config:
  channel: sms
  sender: "+14155550123"
agents:
  - name: messaging-assistant
    outbound: { usage: automatic, source: [support-sms] }  # replies to the inbound file's runs

Configuration

The fields of a Telnyx Messaging connector, the same in connectors/*.yaml, the REST API, and connic MCP. The descriptions name the matching setting in the dashboard. Connectors in code describes the fields every connector shares, such as agents and environments.

FieldTypeStatusDescription
typestringRequiredtelnyx_messaging.
modestringRequiredinbound or outbound. Dashboard: Mode.
connectionstringRequiredName or ID of a Telnyx Connection, which holds the API key and public key. Dashboard: Connection.
configobjectRequiredTelnyx Messaging settings.
channelstringOptionalInbound and outbound. sms for SMS and MMS, whatsapp, or rcs. Dashboard: Channel.Default: sms
senderstringRequiredInbound and outbound. The Telnyx sender: a quoted E.164 number such as "+14155550123" for SMS and WhatsApp, or the RCS agent ID. In both modes, it must exist in the Connection's account and have a messaging profile. Dashboard: Telnyx sender.
whatsapp_profile_idstringOptionalInbound and outbound, WhatsApp only. For a WhatsApp number that isn't hosted on Telnyx: the ID of its Telnyx messaging profile, a UUID. It switches the connector to manual setup; see External WhatsApp numbers. Ignored when Telnyx hosts the number. Dashboard: WhatsApp messaging profile ID.
tostringOptionalOutbound. Default recipient, a quoted E.164 number. Leave it out to reply to incoming messages; see Recipients. Dashboard: Default recipient.
whatsapp_templateobjectOptionalOutbound, WhatsApp channel only; with another channel, the connector can't be created. Default approved template: template_id, or name and language.code, plus optional components. While it is set, it replaces the agent's text; see WhatsApp templates. Dashboard: Default WhatsApp template, as JSON.

Connection

A Telnyx Connection holds the account credentials and can serve any number of Telnyx Messaging and Telnyx Voice connectors. The channel and sender belong to each connector. connic uses the API key to list senders, set webhooks, and send messages, and the public key to verify the signature of every event Telnyx sends. Edit the Connection to rotate the credentials of all its connectors.

SettingDescription
API keyA Telnyx API key for the account. Create it in the Telnyx Mission Control Portal.
Public keyThe same account's base64-encoded Ed25519 public key, from the API Keys settings in the Telnyx Mission Control Portal. Telnyx has no API to look it up, so when you save the Connection, connic only checks that it is a valid key. A key from another account shows up when messages arrive: connic rejects their events with 403 and writes the signature failure to the connector logs.

Generated values

connic sets these when the connector is created or its sender changes. Copy the webhook URL from the details drawer. Leave them out of YAML files; connic lint rejects them.

ValueModesDescription
Incoming-message webhookInboundThe URL Telnyx sends message events to. For SMS and WhatsApp, the URL belongs to the Connection and the messaging profile, so SMS and WhatsApp connectors on the same number share it. An RCS connector has its own.
sender_idInbound, outboundThe Telnyx ID of the sender: the number's ID, the WhatsApp phone number ID, or the RCS agent ID.
messaging_profile_idInbound, outboundThe sender's messaging profile, or whatsapp_profile_id for an external WhatsApp number.
setup_modeInbound, outboundautomatic, or manual for an external WhatsApp number.

Agent input

Modes: Inbound

Telnyx sends signed JSON events to the connector's webhook. Only message.received events start runs; delivery notifications, read receipts, and message echoes start none. connic checks each message, queues a run for each linked agent, and answers 200. Replies go out through a separate outbound connector. The run receives:

input.json
{
  "event_id": "7a3a86b3-0e77-48f6-914a-63ad28b7d64e",
  "message_id": "4031938e-60e4-4235-a8dd-0b1c55a23e7a",
  "channel": "sms",
  "from": "+14155550124",
  "to": "+14155550123",
  "text": "Has order 12345 shipped?",
  "conversation_id": "telnyx_messaging:9e0f77d9-2fd8-5a8e-8d47-59fbf5b8a091",
  "raw": {
    "id": "4031938e-60e4-4235-a8dd-0b1c55a23e7a",
    "direction": "inbound",
    "type": "SMS",
    "messaging_profile_id": "<profile-id>",
    "from": {"phone_number": "+14155550124"},
    "to": [{"phone_number": "+14155550123"}],
    "text": "Has order 12345 shipped?",
    "media": []
  }
}
  • event_id is the Telnyx event ID. A repeated delivery of the same event starts no second run for an agent.
  • from is the customer and to the connector's sender, as E.164 numbers without a channel prefix. For RCS, to is the agent ID.
  • text is the message text: for WhatsApp media, the caption; for an RCS suggestion reply, the suggestion's text. It is empty for a message with only media.
  • raw holds the original Telnyx message payload.
  • files and file_issues appear when the message has attachments.

Attachments

connic downloads incoming media into files. Each file has name (such as attachment-1.jpg), mime_type, base64-encoded data, and size in bytes. A message takes up to 50 files, at most 32 MiB combined.

An invalid or unavailable file is skipped on its own. At the first file over the count or size limit, connic keeps the files before it and omits that file and every later one. file_issues lists each omitted file with a code, a message, and the limit it hit, and the connector's logs record a warning. The run starts even when no file was accepted, unless Files required is on for the agent's link. The agent should check both files and file_issues.

Conversations

conversation_id stays the same for each combination of inbound connector, channel, sender, and customer. To keep the history across messages, set session.key to input.conversation_id and redeploy the agent; sessions aren't on by default. With an automatic outbound connector linked, the agent's plain-text result becomes the reply.

agents/messaging-assistant.yaml
version: "1.0"
name: messaging-assistant
description: "Answers incoming Telnyx messages"
model: connic/gpt-5.6-terra
system_prompt: |
  Answer the incoming message briefly.
  Ask for missing information before making assumptions.
  Return the reply as plain text.
session:
  key: input.conversation_id
  ttl: 86400

This example keeps a conversation for 86,400 seconds. See Agent YAML for the session settings.

Provider setup

Modes: Inbound

When you create an inbound connector, connic sets the connector's webhook URL as the primary webhook of the sender's messaging profile, with webhook API version 2, or of the RCS agent. It doesn't change the number's voice settings. Outbound connectors change nothing in Telnyx.

Creating an inbound connector replaces the primary webhook of the messaging profile or RCS agent and removes its failover webhook and Telnyx AI assistant. connic writes the previous values to the connector's logs and to the project's audit log, which keeps them after the connector is deleted. connic doesn't restore them.
  • connic refuses a disabled messaging profile or RCS agent, an SMS or WhatsApp profile that also holds other numbers or short codes, and a profile or RCS agent whose webhook already points to another connic connector. SMS and WhatsApp connectors share a profile only through the same Connection; see Shared numbers.
  • When you switch senders or delete the last inbound connector of a profile, connic clears the old webhook only if it still matches the connic URL, including a WhatsApp webhook you entered by hand. A different URL you entered in Telnyx later stays.
  • If connic can't clear the webhook, the connector isn't deleted; check the sender in Telnyx and try again.

Shared numbers

SMS and WhatsApp can use the same number with separate inbound connectors and agents. Both connectors must use the same Connection, and they share one webhook URL; connic routes each message by channel and recipient. Deleting one connector keeps the other channel's route. Two inbound connectors can't use the same channel and sender.

External WhatsApp numbers

For a WhatsApp number that isn't hosted on Telnyx, connic can't find the messaging profile. Enter the profile ID in whatsapp_profile_id. connic checks that the profile belongs to the account, but it can't verify that the number's messages use it. Outbound connectors for the number need the same whatsapp_profile_id.

After creating the inbound connector, copy the Incoming-message webhook from the details drawer. In Telnyx, set it as the primary webhook of that messaging profile, select webhook API version 2, and make sure the number's incoming messages use the profile. The WhatsApp Business Account's lifecycle webhook is a separate setting and doesn't route messages.

Channels and senders

The Telnyx sender list shows the account's numbers with SMS or MMS, its enabled WhatsApp numbers, or its enabled RCS agents, depending on the channel. Register WhatsApp numbers and RCS agents in Telnyx before you select them; an RCS agent also needs an assigned messaging profile and the approvals required for production messaging. Changing the Connection or channel clears the selected sender. The address formats apply to both modes:

ChannelTelnyx senderCustomer address
SMS / MMSNumber with SMS or MMS, such as +14155550123+14155550124
WhatsAppEnabled, registered number, such as +14155550123+14155550124
RCSID of an enabled RCS agent of the account+14155550124

Phone numbers use E.164 format with the leading + and country code, without a channel prefix.

Outbound delivery

Modes: Outbound

An outbound connector sends through Telnyx from the configured sender and its messaging profile. It sends when a linked agent's run completes, when the model calls it as a tool, or when middleware calls it, depending on the link's usage. Outbound setup installs no webhook.

Automatic payload

An automatic link sends the run's final output. Plain text becomes the message text. A JSON object can carry the fields of the agent-tool payload below; its text can also be in body, message, response, or output.

Agent-tool and middleware payload

The model or middleware passes a JSON object with these fields. Unknown fields fail validation. A message needs text, media, or a template. This example sends a WhatsApp image with a caption:

connector-payload.json
{
  "to": "+14155550124",
  "text": "Your shipping label",
  "media_urls": ["https://example.com/shipping-label.png"],
  "media_type": "image"
}
  • text: the message text. Optional for a message with only media.
  • to: the recipient; see Recipients.
  • media_urls: 1 to 10 public media URLs; see Media.
  • media_type: for WhatsApp media, image, video, document, audio, or sticker.
  • whatsapp_template: an approved template; see WhatsApp templates.

Recipients

connic sends to the first recipient it finds:

  1. to in the payload or the automatic output.
  2. The connector's Default recipient.
  3. For a run started by an inbound Telnyx Messaging connector, the customer who sent the message. Both connectors must use the same Connection, channel, sender, and messaging profile.

A default recipient takes precedence over replies; leave it empty to answer each customer. Sending fails when no recipient is found.

Media

Pass public HTTP or HTTPS URLs without embedded credentials in media_urls; Telnyx fetches the files. Outbound media uses URLs, not the base64 files format of incoming messages.

  • SMS/MMS: up to 10 media URLs. A message with media goes out as MMS.
  • WhatsApp: one media URL with media_type. Images, videos, and documents take the text as a caption; audio and stickers can't carry text.
  • RCS: text or one media URL. Send text and media in separate messages.

WhatsApp templates

Outside WhatsApp's customer service window, send an approved template. Set whatsapp_template on the connector as a default, or in the payload for one message. Identify the template by template_id, or by name and language.code. Optional components of type header, body, or button carry the parameters in the Telnyx WhatsApp format.

template-payload.json
{
  "to": "+14155550124",
  "whatsapp_template": {
    "name": "order_confirmation",
    "language": {"code": "en_US"},
    "components": [{
      "type": "body",
      "parameters": [{"type": "text", "text": "12345"}]
    }]
  }
}

A template in the payload replaces the connector's default and can't be combined with text or media_urls. While the connector has a default template, every message uses it: the agent's text is ignored and media URLs are rejected. Templates need the WhatsApp channel. Register and approve them in Telnyx and WhatsApp.

Delivery and retries

A successful connector run means Telnyx accepted the request, not that the message was delivered. The run's output holds the Telnyx message ID; check the final delivery in Telnyx.

connic retries connection failures before submission and 429 responses, waiting as long as Telnyx's Retry-After asks, for 3 attempts in total. Other failures aren't retried. When the outcome is unknown, such as after a timeout or a 5xx response, check Telnyx before you resend; Telnyx may already have accepted the message.

Limits and errors

LimitValue
WhatsApp text4,096 UTF-8 bytes; 1,024 bytes as a media caption
RCS text3,072 characters
Outbound media10 URLs for MMS, at most 1 MB in total according to the Telnyx message API; one URL for WhatsApp and RCS
Incoming attachments50 files, at most 32 MiB combined
Incoming request256 KiB of JSON
Incoming messages1,000 per minute per connector, also when SMS and WhatsApp connectors share one webhook URL
Event signaturesconnic rejects events whose timestamp is more than 5 minutes off.
Delivery attempts3 in total for retryable failures
Active connectorsAt the plan's active connector limit, creating a connector of either mode fails with 403 instead of creating it paused. A deploy that would create the connector or bring it back at the limit fails.

On inbound, connic checks each event's Ed25519 signature and timestamp with the Connection's public key, then the messaging profile, channel, and recipient, and answers Telnyx with one of these statuses:

StatusMeaning
200Accepted. Events other than incoming messages, paused connectors, and connectors without linked agents also get 200 and start no run.
400The event is invalid, or the message isn't an incoming one.
403The signature is invalid or too old, or the messaging profile, channel, or recipient doesn't match the connector. Check that the Connection's public key comes from the same Telnyx account, and that the connector's channel and sender match the message. A signature failure also appears in the connector logs.
404No inbound Telnyx Messaging connector exists at this URL.
413The request is larger than 256 KiB.
415The request isn't JSON.
429The connector's rate limit for incoming messages is reached.
503connic couldn't queue the message at that moment, or several inbound connectors match it.
ProblemWhat to do
Creating the connector failsCheck the reported Telnyx error. Enable the sender and its messaging profile, and move other numbers and short codes to another profile.
No run startsCheck that the connector is active and linked to a deployed agent, and that Telnyx sends to the exact webhook URL. For an external WhatsApp number, check the number's profile assignment and webhook API version 2 in Telnyx.
Attachments are missingRead file_issues in the run input and the attachment warning in the connector's logs. Each issue names the omitted file and the reason.
Sending fails without a recipientSet to, configure a default recipient, or make the inbound and outbound connectors use the same Connection, channel, sender, and messaging profile.
Telnyx rejects the messageCheck the Telnyx error, the sender's registration, the messaging profile, the channel's limits, and the template's approval and parameters.
No automatic replyCheck the agent's outbound link and its selected inputs, then the agent's result and the outbound connector's run.