Skip to content

feat: add SMS (Twilio) platform adapter - #1688

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-923bc090
Mar 17, 2026
Merged

feat: add SMS (Twilio) platform adapter#1688
teknium1 merged 2 commits into
mainfrom
hermes/hermes-923bc090

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Adds SMS as a first-class messaging platform via Twilio. Shares credentials with the existing telephony skill — same TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_PHONE_NUMBER env vars. Set up Twilio once, both the skill and gateway work.

Inspired by PR #1575 by @sunsakis (Telnyx version), rewritten for Twilio with shared credentials and full docs.

Changes (16 files, 796 additions)

Adaptergateway/platforms/sms.py (261 lines): Twilio REST API with Basic auth, aiohttp webhook server, markdown stripping, 1600-char smart chunking, echo prevention, phone redaction

Integration (13 files): config, run, channel_directory, prompt_builder, cron, send_message, cronjob_tools, toolsets, gateway setup wizard, status, pyproject.toml, tests (21)

Docs: Full setup guide (messaging/sms.md), updated messaging index + env vars reference

Setup

hermes gateway setup  # Select SMS (Twilio)

Environment Variables

Variable Purpose
TWILIO_ACCOUNT_SID Twilio Account SID (shared with telephony skill)
TWILIO_AUTH_TOKEN Twilio Auth Token (shared with telephony skill)
TWILIO_PHONE_NUMBER From-number in E.164 format (shared with telephony skill)
SMS_WEBHOOK_PORT Webhook listener port (default 8080)
SMS_ALLOWED_USERS / SMS_ALLOW_ALL_USERS Authorization
SMS_HOME_CHANNEL Cron delivery target

Add SMS as a first-class messaging platform via the Twilio API.
Shares credentials with the existing telephony skill — same
TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_PHONE_NUMBER env vars.

Adapter (gateway/platforms/sms.py):
- aiohttp webhook server for inbound (Twilio form-encoded POSTs)
- Twilio REST API with Basic auth for outbound
- Markdown stripping, smart chunking at 1600 chars
- Echo loop prevention, phone number redaction in logs

Integration (13 files):
- gateway config, run, channel_directory
- agent prompt_builder (SMS platform hint)
- cron scheduler, cronjob tools
- send_message_tool (_send_sms via Twilio API)
- toolsets (hermes-sms + hermes-gateway)
- gateway setup wizard, status display
- pyproject.toml (sms optional extra)
- 21 tests

Docs:
- website/docs/user-guide/messaging/sms.md (full setup guide)
- Updated messaging index (architecture, toolsets, security, links)
- Updated environment-variables.md reference

Inspired by PR #1575 (@sunsakis), rewritten for Twilio.
@teknium1
teknium1 merged commit 07549c9 into main Mar 17, 2026
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