DOCUMENTATION

SMS Setup Guide

Configure Telnyx to enable SMS notifications and responses for your AI agents.

Prerequisites

  • A RelayRail account with at least one agent created
  • Your RelayRail app deployed to a public URL (for webhooks)
  • A credit card for Telnyx account setup
Step 1

Create Telnyx Account

Sign up for a Telnyx account at telnyx.com. Telnyx provides reliable SMS infrastructure with competitive pricing.

  • Go to telnyx.com and click "Sign Up"
  • Complete account verification
  • Add payment method for SMS credits
Step 2

Purchase Phone Number

Buy a phone number that will be used to send and receive SMS messages from your agents.

  • Navigate to Numbers → Search & Buy
  • Select a number with SMS capability
  • Choose a local or toll-free number
  • Complete the purchase
Step 3

Set Up A2P 10DLC (US Only)

For sending SMS to US numbers, you must register for A2P 10DLC compliance to ensure deliverability.

  • Go to Messaging → Campaign Registry
  • Register your brand (business information)
  • Create a campaign describing your use case
  • Wait for approval (usually 1-3 business days)
  • Assign your phone number to the approved campaign
Step 4

Configure Webhooks

Set up webhooks so RelayRail can receive inbound SMS messages from your users.

  • Go to Messaging → Messaging Profiles
  • Create or edit a messaging profile
  • Set Webhook URL to: https://your-domain.com/api/webhooks/telnyx
  • Set Failover URL to the same URL (or backup domain)
  • Copy the Webhook Secret (Ed25519 public key)
  • Assign your phone number to this messaging profile
Step 5

Configure Environment Variables

Add your Telnyx credentials to your environment configuration.

# Add to your .env.local file
TELNYX_API_KEY=KEY_xxxxxxxxxxxxxxxx
TELNYX_PHONE_NUMBER=+1XXXXXXXXXX
TELNYX_WEBHOOK_SECRET=xxxxxxxxxxxxxxxx
  • Find your API key in the Telnyx portal under API Keys
  • Use the phone number you purchased (E.164 format)
  • Use the webhook secret from your messaging profile
Step 6

Test SMS Flow

Verify everything is working by sending a test approval request.

  • Update your notification preferences to SMS in the dashboard
  • Add your phone number to your account settings
  • Have your agent call request_approval
  • You should receive an SMS with the approval request
  • Reply to approve or reject

Troubleshooting

SMS not being received?

Check that your A2P 10DLC campaign is approved and your phone number is assigned to the campaign.

Webhook errors?

Verify your webhook URL is publicly accessible and the webhook secret matches your environment variable.

Replies not being processed?

Make sure your messaging profile has webhooks enabled for inbound messages.

Ready to test your SMS integration?

Go to Settings