Channels

SMS & phone

Give your agent a real two-way SMS line. This channel is free to Caspian. You bring your own Twilio or Telnyx number and credentials, so your CPaaS account handles billing and registration. Caspian just relays inbound and outbound texts to the same on_message handler.

Bring-your-own-number. You use your own Twilio or Telnyx account plus a phone number you own there. Caspian never charges for SMS; your carrier does, at whatever rate your account is on.

Pick a provider

SMS runs through your own CPaaS account, so the first decision is which one you already use:

ProviderYou needGet it from
TwilioAccount SID, Auth Token, a number you own (E.164)console.twilio.com
TelnyxAPI Key, a number you own (E.164)portal.telnyx.com

Numbers are always in E.164 format: full country code, no spaces or dashes, e.g. +14155550123.

Twilio

Pass your Account SID, Auth Token, and Twilio number to connect_phone with provider="twilio":

agent.py
from caspian_sdk import CommClient

client = CommClient()

sms = client.connect_phone(
    provider="twilio",
    account_sid="AC...",
    auth_token="...",
    from_number="+14155550123",     # your Twilio number, E.164
)
print("Texting from:", sms["address"])

@client.on_message
def handle(message):
    message.reply(f"Got it: {message.text}")

client.listen()
agent.ts
import { CommClient } from "caspian-sdk";

const client = new CommClient();

const sms = await client.connectPhone({
  provider: "twilio",
  accountSid: "AC...",
  authToken: "...",
  fromNumber: "+14155550123",       // your Twilio number, E.164
});
console.log("Texting from:", sms.address);

client.onMessage(async (message) => {
  await message.reply(`Got it: ${message.text}`);
});

await client.listen();

Then point that number's inbound webhook at Caspian. In the Twilio Console, open your number's Messaging config and set A message comes in (HTTP POST) to:

https://api.trycaspianai.com/internal/providers/twilio/webhooks/<your +E.164 number>

Telnyx

Pass your API Key and Telnyx number with provider="telnyx":

agent.py
sms = client.connect_phone(
    provider="telnyx",
    api_key="KEY...",
    from_number="+14155550123",     # your Telnyx number, E.164
)
agent.ts
const sms = await client.connectPhone({
  provider: "telnyx",
  apiKey: "KEY...",
  fromNumber: "+14155550123",       // your Telnyx number, E.164
});

Then set that number's inbound webhook in the Telnyx portal to:

https://api.trycaspianai.com/internal/providers/telnyx/webhooks/<your +E.164 number>

The webhook is what carries inbound texts to Caspian, which then fires your handler. Until it's set, outbound replies work but nothing inbound reaches your agent. A 409 from connect_phone means that number is already connected.

Handling messages

SMS uses the same handler as every other channel. An inbound text fires on_message; message.reply() texts back on the same number, in the same conversation.

@client.on_message
def handle(message):
    # message.text, message.sender (their number), message.conversation_id
    message.reply("On it, I'll text you when it's done.")
client.onMessage(async (message) => {
  // message.text, message.sender (their number), message.conversationId
  await message.reply("On it, I'll text you when it's done.");
});

US A2P 10DLC registration

Application-to-person (A2P) SMS sent from a US long code must be registered under the 10DLC program before carriers will deliver it reliably; unregistered traffic gets throttled or blocked. This registration happens on your Twilio or Telnyx account, not on Caspian.

!

Register your brand and campaign in your provider's console before going live in the US, or use a verified toll-free number. This is a carrier requirement on your CPaaS account. Caspian only relays; it can't register on your behalf.

Keep messages short

SMS is plain text: no markdown, links, or attachments. Messages also bill per segment: about 160 GSM-7 characters, or 70 if the text contains any non-GSM character (emoji, some Unicode). Longer messages split into multiple segments and cost more.

Tell your agent to answer in one or two short, plain-text sentences on SMS. The behavior guide for this channel carries that etiquette. Inject it into your agent's system prompt so replies stay within a segment or two.

Next steps

X (Twitter) →
Reactive DM bot on Caspian's network.
WhatsApp →
Your own Twilio number or Meta Cloud.
Behavior guides →
Per-channel etiquette for your prompt.