SMS
A customer texts your support number "What is your return policy?", and the agent answers by SMS. The telnyx connector does this on your own Telnyx number.
Answer by SMS
You need three things from Telnyx: an API key, a number with messaging in E.164, and your account's public key. The public key is under Keys & Credentials > Public Key in the Telnyx portal. Setup takes four steps:
Point Telnyx at Stream
At Telnyx, set the webhook URL of your number's messaging profile to $STREAM_ACCELERATION_URL/v1/connectors/events/telnyx/<profile ID>. $STREAM_ACCELERATION_URL is your router's URL. A profile ID looks like 0f3c5e2a-1b2c-4d5e-8f90-123456789abc, and Telnyx returns it as messaging_profile_id for your number. Write the number's + as %2B:
curl -g -H "Authorization: Bearer $TELNYX_API_KEY" \
"https://api.telnyx.com/v2/phone_numbers?filter[phone_number]=%2B12025550100"The URL applies to every number on that profile.
Save your Telnyx account
Give Stream the profile ID and the public key:
curl -fsSL https://getstream.io/cli.sh | bash # get the CLI
echo "$TELNYX_PUBLIC_KEY" | getstream agents connectors client set telnyx --provider-app-id "$TELNYX_PROFILE_ID" --signing-secret -The CLI prints Saved the provider app for telnyx.
Connect the number
Create the connection with your number and the API key:
echo "$TELNYX_API_KEY" | getstream agents connections create telnyx --label acme-sms --input phone_number=+12025550100 -H Authorization=-The CLI prints Connected: telnyx / acme-sms, with the connection's id.
Add it to the agent
If you don't have an agent named support yet, create one in Creating an agent. Add the connection by its label:
getstream agents connectors bind support telnyx --connection acme-smsThe command adds this to agents/support/agent.yaml and syncs the agent. See a full agent.yaml for the rest of the file.
# ...
connectors:
- name: telnyx
connection: acme-smsFrom a phone, text "What is your return policy?" to your Telnyx number. The reply comes back by SMS, from the same number.
US phones need 10DLC
A reply to a US phone needs your number in an approved 10DLC campaign at Telnyx, in the account that holds the number. Without one, the agent answers, but Telnyx doesn't deliver the text.
Telnyx explains the registration in Getting Started with 10DLC, and 10DLC explains what it is.
Replies to a phone in Canada are delivered without a 10DLC campaign.
Conversations
- Each phone is one conversation. The agent reads the earlier texts from that phone.
- Telnyx answers STOP, START and HELP, not the agent.
- After STOP, the person gets no reply until they text START.
Remind by SMS
The agent can remind a customer later, by SMS. Text "Remind me in 2 minutes to check my order status". The agent confirms, and about 2 minutes later the reminder arrives by SMS, once.
Reminders need scheduling in agents/support/agent.yaml:
# ...
scheduling:
enabled: trueThen sync the agent:
getstream agents sync supportA text has no time zone, so on a customer's first reminder the agent asks for their city and works out their time zone from it. We recommend llm-smart for reminders.
When a text gets no answer
| What you see | Why | What to do |
|---|---|---|
| The agent gets nothing | The profile's webhook URL points somewhere else | Set it again, as in step 1 |
The router answers Telnyx 401 |
The signing secret is not your account's public key | Save the public key again, as in step 2 |
| The agent answers, but a US phone gets nothing | Telnyx error 40010: the number is in no 10DLC campaign |
Get an approved 10DLC campaign at Telnyx. See US phones need 10DLC |
| A person gets no reply after STOP | The person opted out | The person texts START |