Integrationsā¢3 min read
Telnyx Agent Onboarding Protocol
This SOP describes how a Valstorm AI Agent handles the command:
"Here is my Telnyx API key:
KEY..., please integrate my account."
šÆ Protocol Overview
When a user provides their Telnyx API key, the agent executes an automated 6-step pipeline to provision resources, sync numbers, configure Voice AI, and enable messaging without requiring manual portal configuration from the user.
User provides API Key
ā
ā¼
1. Validate & Store Key in auth_credential (AES-encrypted)
ā
ā¼
2. Create/Verify Valstorm Messaging Profile (v2 Webhooks)
ā
ā¼
3. Create/Verify Call Control & WebRTC Application
ā
ā¼
4. Discover & Bind Active Phone Numbers
ā
ā¼
5. Provision or Link Default Voice AI Assistant
ā
ā¼
6. Sync to twilio_phone Registry & Report Summary Tableš Step-by-Step Execution Plan
Step 1: Validate & Encrypt Credentials
- Test the key with
GET https://api.telnyx.com/v2/balanceto confirm authentication and retrieve current account balance. - Check or create an encrypted record in
auth_credential:(Ensure sensitive data is encrypted usingJSON{ "name": "Telnyx - API Key", "provider": "telnyx", "data": { "api_key": "<TELNYX_API_KEY>", "public_key": "<TELNYX_PUBLIC_KEY>" } }encrypt_data()before saving).
Step 2: Provision the Valstorm Messaging Profile
- Call
GET https://api.telnyx.com/v2/messaging_profilesto check if a profile namedValstorm Messaging Profilealready exists. - If not found, call
POST https://api.telnyx.com/v2/messaging_profiles:JSON{ "name": "Valstorm Messaging Profile", "enabled": true, "webhook_api_version": "2", "webhook_url": "https://api.valstorm.com/v1/telnyx/{org_id}/webhooks", "webhook_failover_url": "", "mms_fall_back_to_sms": true } - Record
messaging_profile_id.
Step 3: Provision Call Control Application
- Call
GET https://api.telnyx.com/v2/call_control_applicationsto check for an existing application namedValstorm Voice & Call Control. - If not found, call
POST https://api.telnyx.com/v2/call_control_applications:JSON{ "application_name": "Valstorm Voice & Call Control", "webhook_event_url": "https://api.valstorm.com/v1/telnyx/{org_id}/webhooks", "webhook_api_version": "2", "active": true } - Record
connection_id.
Step 4: Discover & Bind Phone Numbers
- Call
GET https://api.telnyx.com/v2/phone_numbersto fetch all active numbers. - For each number:
- Assign to Messaging Profile:
PATCH https://api.telnyx.com/v2/phone_numbers/{phone_number_id}/messagingwith{"messaging_profile_id": messaging_profile_id}. - Assign to Voice Connection:
PATCH https://api.telnyx.com/v2/phone_numbers/{phone_number_id}with{"connection_id": connection_id}. - Upsert into Valstorm
twilio_phonetable:JSON{ "id": "twph_telnyx_<number>", "name": "Telnyx Line - <formatted_number>", "phone_number": "+1XXXXXXXXXX", "provider": "telnyx", "active": true, "telnyx_number_id": "<phone_number_id>", "connection_id": "<connection_id>", "messaging_profile_id": "<messaging_profile_id>", "ai_assistant_enabled": true, "ring_timeout_seconds": 15 }
- Assign to Messaging Profile:
Step 5: Configure Edge Voice AI Assistant
- Check
GET https://api.telnyx.com/v2/ai/assistantsfor an existing assistant. - If none exists, call
POST https://api.telnyx.com/v2/ai/assistants:- Model:
Qwen/Qwen3-235B-A22Bormeta-llama/Meta-Llama-3.1-70B-Instruct - Transcription:
deepgram/flux - Voice:
Telnyx Ultra - Features:
["telephony"] - Noise Suppression:
krisp - Tool Integration: Connect calendar booking webhook or Valstorm MCP server.
- Model:
Step 6: Confirmation Response to User
The agent presents a structured summary table to the user:
MARKDOWN
ā
**Telnyx Account Integrated Successfully!**
* **Account Balance:** $5.47 USD
* **Messaging Profile:** Valstorm Messaging Profile (`4001a145-...`)
* **Voice Application:** Valstorm Voice & Call Control (`30720465-...`)
* **Voice AI Assistant:** Active (`assistant-acecc482-...`)
### Synced Phone Numbers (Ready for Calling & Texting):
| Phone Number | Type | Provider | Voice AI | Status |
| :--- | :--- | :--- | :--- | :--- |
| **+1 (959) 929-0740** | Local (CT) | Telnyx | Enabled (15s timeout) | Active |
| **+1 (959) 251-2553** | Local (CT) | Telnyx | Enabled (15s timeout) | Active |
| **+1 (929) 488-1938** | Local (NY) | Telnyx | Enabled (15s timeout) | Active |
| **+1 (833) 583-2008** | Toll-Free | Telnyx | Enabled (15s timeout) | Active |
You can now select these numbers in **Valstorm Desktop** or **ValPhone Mobile** to make calls, send Group MMS messages, and receive automated lead intake calls.