Skip to content

feat: add SMS (Telnyx) platform adapter#1676

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-923bc090
Mar 17, 2026
Merged

feat: add SMS (Telnyx) platform adapter#1676
teknium1 merged 1 commit into
mainfrom
hermes/hermes-923bc090

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Cherry-picked from PR #1575 by @sunsakis onto current main. Resolved one conflict in send_message_tool.py (the chunking refactor from PR #1646 changed the dispatch loop).

Adds SMS as a first-class messaging platform via the Telnyx API, following all integration points from ADDING_A_PLATFORM.md.

Integration points (13 files)

  • gateway/platforms/sms.py — Core adapter: aiohttp webhook server for inbound, Telnyx REST API for outbound, markdown stripping, 1600-char chunking, echo loop prevention, multi-number reply-from tracking
  • gateway/config.pyPlatform.SMS enum + env overrides
  • gateway/run.py — Adapter creation + auth maps (SMS_ALLOWED_USERS, SMS_ALLOW_ALL_USERS)
  • gateway/channel_directory.py — Session-based channel discovery
  • agent/prompt_builder.py — SMS platform hint (concise, plain text)
  • cron/scheduler.py — Cron delivery target
  • tools/send_message_tool.py — Direct SMS sending via _send_sms()
  • tools/cronjob_tools.py — Cron tool description
  • toolsets.pyhermes-sms toolset + added to hermes-gateway
  • hermes_cli/gateway.py — Gateway setup wizard with Telnyx config
  • hermes_cli/status.py — Status display
  • pyproject.tomlsms optional dependency (aiohttp)
  • tests/gateway/test_sms.py — 20 tests covering config, format, echo prevention, auth, toolsets

Environment variables

Variable Purpose
TELNYX_API_KEY Telnyx API key (required)
TELNYX_FROM_NUMBERS Comma-separated E.164 from-numbers
SMS_WEBHOOK_PORT Webhook listener port (default 8080)
SMS_ALLOWED_USERS / SMS_ALLOW_ALL_USERS Authorization
SMS_HOME_CHANNEL / SMS_HOME_CHANNEL_NAME Cron delivery target

Implement SMS as a first-class messaging platform following
ADDING_A_PLATFORM.md checklist. All 16 integration points covered:

- gateway/platforms/sms.py: Core adapter with aiohttp webhook server,
  Telnyx REST API send, markdown stripping, 1600-char chunking,
  echo loop prevention, multi-number reply-from tracking
- gateway/config.py: Platform.SMS enum + env override block
- gateway/run.py: Adapter factory + auth maps (SMS_ALLOWED_USERS,
  SMS_ALLOW_ALL_USERS)
- toolsets.py: hermes-sms toolset + included in hermes-gateway
- cron/scheduler.py: SMS in platform_map for cron delivery
- tools/send_message_tool.py: SMS routing + _send_sms() standalone sender
- tools/cronjob_tools.py: 'sms' in deliver description
- gateway/channel_directory.py: SMS in session-based discovery
- agent/prompt_builder.py: SMS platform hint (plain text, concise)
- hermes_cli/status.py: SMS in platforms status display
- hermes_cli/gateway.py: SMS in setup wizard with Telnyx instructions
- pyproject.toml: sms optional dependency group (aiohttp>=3.9.0)
- tests/gateway/test_sms.py: Unit tests for config, format, truncate,
  echo prevention, requirements, toolset integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teknium1 teknium1 merged commit ef67037 into main Mar 17, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant