{"slug": "build-an-sms-triage-bot-on-telnyx-edge-compute", "title": "Build an SMS Triage Bot on Telnyx Edge Compute", "summary": "Telnyx has released an open-source TypeScript example for building an SMS triage bot on its Edge Compute platform with the Agent SDK. The bot classifies inbound messages into billing, support, sales, or general topics using AI inference, routes them to appropriate queues, and stores triage history in durable actor state. The example avoids hardcoded API keys by routing both messaging and inference through the Telnyx environment binding.", "body_md": "Support SMS inboxes are usually a routing problem before they are an AI problem.\n\nSomeone asks about billing. Someone else needs technical support. A third person wants to talk to sales. The app has to understand the message, pick the right destination, reply to the customer, and remember what happened.\n\nThis TypeScript example does that on Telnyx Edge Compute with the Agent SDK.\n\nCode: [https://github.com/team-telnyx/telnyx-code-examples/tree/main/agent-sms-triage-bot](https://github.com/team-telnyx/telnyx-code-examples/tree/main/agent-sms-triage-bot)\n\n`agent-sms-triage-bot`\n\nreceives inbound SMS webhooks, classifies each message into one of four topics, looks up the route for that topic, replies by SMS, and stores triage history in durable actor state.\n\nThe topics are:\n\n`billing`\n\n`support`\n\n`sales`\n\n`general`\n\nThe default route table maps those topics to queue names:\n\n``` php\nbilling -> billing-queue\nsupport -> support-queue\nsales   -> sales-queue\ngeneral -> general-queue\nphp\nInbound SMS\n  -> POST /webhooks/sms\n  -> TriageAgent.triage(from, text)\n  -> Telnyx AI Inference classifies topic\n  -> durable route table lookup\n  -> SMS reply\n  -> triage history update\n```\n\nThe app uses one `TriageAgent`\n\nactor per inbound number. That actor stores route rules, recent history, total messages, and topic counts.\n\n`POST /webhooks/sms`\n\nreceives Telnyx `message.received`\n\nevents`POST /debug/triage`\n\nsimulates inbound SMS`POST /routes`\n\nupdates the route table`GET /routes`\n\nlists route rules`GET /history`\n\nreturns recent triage history`GET /debug/state`\n\ninspects actor state`GET /health/liveness`\n\nand `GET /health/readiness`\n\nprovide health checksThe core class is `TriageAgent`\n\n.\n\nIt extends the Agent SDK `Agent`\n\nclass and uses durable state for:\n\nThe AI classification call uses the Telnyx binding:\n\n``` js\nconst completion = await this.env.TELNYX.ai.openai.chat.createCompletion({\n  model: this.env.AI_MODEL || \"moonshotai/Kimi-K2.6\",\n  messages: [\n    { role: \"system\", content: CLASSIFY_SYSTEM_PROMPT },\n    { role: \"user\", content: `Customer message: \"${text}\"` },\n  ],\n  max_tokens: 2000,\n  temperature: 0.2,\n});\n```\n\nThe SMS reply uses the same binding pattern:\n\n```\nawait this.env.TELNYX.messages.send({\n  from: state.fromNumber || state.phoneNumber,\n  to: from,\n  text: replyText,\n});\n```\n\nThat means the example does not hardcode an API key in application code. Messaging and inference both go through `this.env.TELNYX`\n\n.\n\nAfter deploying with `telnyx-edge ship`\n\n, you can test without sending a real SMS:\n\n```\ncurl -X POST https://agent-sms-triage-bot-<id>.telnyxcompute.com/debug/triage \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"from\":\"<customer-number>\",\"to\":\"<triage-number>\",\"text\":\"Why was I charged twice this month?\"}'\n```\n\nExample response:\n\n```\n{\n  \"action\": \"triaged\",\n  \"from\": \"<customer-number>\",\n  \"to\": \"<triage-number>\",\n  \"text\": \"Why was I charged twice this month?\",\n  \"topic\": \"billing\",\n  \"route\": \"billing-queue\",\n  \"confidence\": 0.95\n}\n```\n\nThen inspect the actor history:\n\n```\ncurl \"https://agent-sms-triage-bot-<id>.telnyxcompute.com/history?number=<triage-number>\"\n```\n\nFor a small support workflow, this keeps the first version compact:\n\nYou can later replace queue names with real integrations: Slack, Zendesk, Salesforce, email, or an internal queue.\n\nBefore using this with real customer traffic, I would add:\n\nResources:", "url": "https://wpnews.pro/news/build-an-sms-triage-bot-on-telnyx-edge-compute", "canonical_source": "https://dev.to/sonam_50a41a4ced7e6b4f3fa/build-an-sms-triage-bot-on-telnyx-edge-compute-4gin", "published_at": "2026-08-13 18:58:07+00:00", "updated_at": "2026-08-13 19:20:20.525207+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "natural-language-processing"], "entities": ["Telnyx", "Agent SDK", "Kimi-K2.6", "TypeScript", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/build-an-sms-triage-bot-on-telnyx-edge-compute", "markdown": "https://wpnews.pro/news/build-an-sms-triage-bot-on-telnyx-edge-compute.md", "text": "https://wpnews.pro/news/build-an-sms-triage-bot-on-telnyx-edge-compute.txt", "jsonld": "https://wpnews.pro/news/build-an-sms-triage-bot-on-telnyx-edge-compute.jsonld"}}