feat: add twilio plugin implementation Closes #1631
feat: add twilio plugin implementation
Relates to & Closes #1631
Risks
Low - This plugin:
- Uses standard Twilio services (SMS, Voice with Amazon Polly TTS)
- Implements proper webhook handling and security
- Includes comprehensive error handling and logging
- Follows A2P 10DLC compliance requirements
Background
What does this PR do?
- Adds Twilio plugin for SMS and voice interactions
- Implements two core actions:
SEND_SMSandCALL_VOICE - Supports custom Amazon Polly voices
- Provides webhook server for handling incoming messages/calls
- Includes TypeScript types and interfaces
- Follows Eliza plugin architecture
What kind of change is this?
Feature (non-breaking change which adds functionality)
Documentation
Added comprehensive documentation including:
- A2P 10DLC compliance requirements
- Plugin configuration guide
- Available actions and usage examples
- Voice configuration options
- Webhook setup instructions (ngrok & production)
- Environment variables reference
- Troubleshooting guide
Testing
Where should a reviewer start?
src/actions/- SMS and voice call actionssrc/services/webhook.ts- Webhook handlingsrc/services/twilio.ts- Twilio service implementation
Testing steps
-
Configure environment:
ANTHROPIC_API_KEY=your_key TWILIO_ACCOUNT_SID=your_sid TWILIO_AUTH_TOKEN=your_token TWILIO_PHONE_NUMBER=your_number TWILIO_CHARACTER=your_character.json WEBHOOK_PORT=3004 WEBHOOK_BASE_URL=your_webhook_url -
Setup webhook:
- Development: Use ngrok (
ngrok http 3004) - Production: Configure domain
- Development: Use ngrok (
-
Test SMS action:
"Send SMS to +1234567890: Hello!" -
Test Voice action:
"Call +1234567890 and say Welcome!"
Voice Configuration Testing
Test different voice configurations:
{
"settings": {
"voice": {
"language": "en",
"gender": "female"
}
}
}
Or with custom Polly voice:
{
"settings": {
"voice": {
"custom": "Polly.Aria-Neural"
}
}
}
Video demo
https://www.boolkeys.com/eliza/plugin-twilio/DEMO-plugin-twilio.mov
Deploy Notes
- Register for A2P 10DLC if sending to US numbers
- Configure webhooks in Twilio Console
- Set all required environment variables
- Ensure webhook endpoint is publicly accessible
Discord: @boolkeys
@Freytes core workflow ok: User calls or texts Twilio number -> agent responses via text or voice.
current code doesn't need ElevenLabs or Deepgram services. using Twilio's built-in services: voice generation and speech recognition.
@Freytes core workflow ok: User calls or texts Twilio number -> agent responses via text or voice.
current code doesn't need ElevenLabs or Deepgram services. using Twilio's built-in services: voice generation and speech recognition.
If I can get a demo of this working I would recommend that you completed the bounty
@Freytes core workflow ok: User calls or texts Twilio number -> agent responses via text or voice. current code doesn't need ElevenLabs or Deepgram services. using Twilio's built-in services: voice generation and speech recognition.
If I can get a demo of this working I would recommend that you completed the bounty
Hi, demo is here: https://www.boolkeys.com/eliza/plugin-twilio/DEMO-plugin-twilio.mov how can I complete the bounty? thanks for your help
@Freytes core workflow ok: User calls or texts Twilio number -> agent responses via text or voice. current code doesn't need ElevenLabs or Deepgram services. using Twilio's built-in services: voice generation and speech recognition.
If I can get a demo of this working I would recommend that you completed the bounty
Hi, demo is here: https://www.boolkeys.com/eliza/plugin-twilio/DEMO-plugin-twilio.mov how can I complete the bounty? thanks for your help
@boolkeys great demo! Jin will be in touch for bounty payment
would like to mention that this plugin does not seem functional... i cant find the code for the actions?
would like to mention that this plugin does not seem functional... i cant find the code for the actions?
no action needed, all code is triggered via webhook need to setup a server webhook (like ngrok) and configure that webhook url in twilio console before using
You can add a service and avoid the ngrok. Also the actions should be implemented since is a framework and people will use your tool as building block.
You can add a service and avoid the ngrok. Also the actions should be implemented since is a framework and people will use your tool as building block.
Sure I’ll look into that
@boolkeys is it probable to use a custom voice if support by Twilio?
@boolkeys is it probable to use a custom voice if support by Twilio?
Yes, Twilio supports custom voices through Amazon Polly. https://docs.aws.amazon.com/polly/latest/dg/available-voices.html
I updated the code to support custom Polly voices. Read more in README
You can add a service and avoid the ngrok. Also the actions should be implemented since is a framework and people will use your tool as building block.
2 options for the webhook: ngrok for local (https needed by twilio) or custom domain name). I added 2 actions: SEND_SMS and CALL_VOICE
@boolkeys I thought Twilio has an automatic ElevenLabs integration, I am just thinking of other options aside from Amazon
@boolkeys I thought Twilio has an automatic ElevenLabs integration, I am just thinking of other options aside from Amazon
I will integrate elevenlabs as an option (Amazon does not require api key)
@boolkeys I thought Twilio has an automatic ElevenLabs integration, I am just thinking of other options aside from Amazon
I will integrate elevenlabs as an option (Amazon does not require api key)
Can we discuss? Please reach out to me on discord, I have reached out to you
plugin-twilio updated with:
- elevenlabs integration
- sms and call actions
feel free to test it out and get back to me with any question/inquiry @Freytes @mot1se
I have tested everything and reviewed your code. Everything seems to be in order, and it's ready to proceed to the main branch.
I have tested everything and reviewed your code. Everything seems to be in order, and it's ready to proceed to the main branch.
great! did you enjoy the experience? kind of fun talking to our made-up characters by phone, right?
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
Walkthrough
The pull request introduces a comprehensive Twilio plugin for ElizaOS, enabling SMS and voice call capabilities. The implementation includes services for sending SMS, handling voice calls, text-to-speech conversion using ElevenLabs, and webhook management. The plugin supports initializing calls, generating responses, and managing conversation memory across different interaction types.
Changes
| File | Change Summary |
|---|---|
.gitignore |
Added .env_BACKUP, pnpm-lock.yaml, and /characters to ignored files |
package.json |
Added @elizaos/plugin-twilio dependency |
packages/core/types/index.d.ts |
Added ServiceType enum |
packages/plugin-twilio/ |
Added complete plugin structure with services, actions, routes, and utilities |
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Twilio text support | ✅ | |
| Twilio voice support | ✅ | |
| ElevenLabs TTS integration | ✅ | |
| Speech-to-Text | ❓ | No explicit Deepgram/Whisper integration visible |
| Demonstration of functionality | ❓ | Video recording not included in PR |
The pull request substantially meets the core requirements for Twilio text and voice integration, with a robust implementation of SMS and voice call capabilities. The ElevenLabs integration for text-to-speech is well-implemented. However, the speech-to-text component and video demonstration are not explicitly addressed in the current PR.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR. (Beta)@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Speech-to-Text ❓ No explicit Deepgram/Whisper integration visible Demonstration of functionality ❓ Video recording not included in PR
The pull request substantially meets the core requirements for Twilio text and voice integration, with a robust implementation of SMS and voice call capabilities. The ElevenLabs integration for text-to-speech is well-implemented. However, the speech-to-text component and video demonstration are not explicitly addressed in the current PR.
This plugin uses Twilio's built-in speech recognition capabilities for voice interactions.
Demo here: https://www.boolkeys.com/eliza/plugin-twilio/DEMO-plugin-twilio.mov
@boolkeys how can we use your plugin? Is there anything else to do for the integration? I am happy to contribute as well.
https://github.com/elizaOS/eliza/issues/1631#issuecomment-2664964453
You can download pr and use the plugin as is but i don't know about integration in Eliza plugins, i guess i have to make a new pr since the plugin repo exists now
plugin reference in registry "@elizaos-plugins/plugin-twilio": "github:boolkeys/plugin-twilio"
https://github.com/boolkeys/plugin-twilio