Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added plugin-twilio this can send message using sms or whatsapp #1822

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from

Conversation

juanc07
Copy link

@juanc07 juanc07 commented Jan 4, 2025

Relates to

Risks

Background

What does this PR do?

this will add a twilio api implemenation for send SMS or WhatsApp Message

What kind of change is this? this is a new plugin so this will be addition to current repo

this is none breaking, all possible errors are catch

i saw Shaw post this in X with reward so i did this for that reward, i really need money :)

Documentation changes needed?

it need some small changes you need to update Agent package.json to include plugin-twilio, then wire it in agent for plugin initialization and then pnpm install and pnpm build just to make sure

Testing

for testing you just need to tell the AI Agent the exact command format, please check the Usage Sample

Usage Sample

The message that you want to send must be inside a Single Quote or double quotes

Example 1:
Please send sms to [phone number], and my message is '[your message here]'
Please send whats app message to [phone number], and my message is '[your message here]'

Example 2:
Please send sms to [phone number], and my message is "[your message here]"
Please send whats app message to [phone number], and my message is "[your message here]"

Where should a reviewer start?

inside the plugin-twilio to make sure i follow the standards

Detailed testing steps

add this to .env file and fill in the details

Twilio Part

TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_PHONE_NUMBER=
TWILIO_WHATSAPP_PHONE_NUMBER=

then follow this steps

How to use

  1. create your .env file , if you don't have it yet and then populate it with the information above, make sure to fill in all information
  2. Add this project into your eliza os project under packages
  3. using terminal go inside plugin-twilio then type pnpm install twilio
  4. go inside your agent folder update the package.json add this "@elizaos/plugin-twilio": "workspace:*"
  5. add this inside your Agent index.ts import { twilioPlugin } from "@elizaos/plugin-twilio";
  6. Add twilioPlugin in Agent Runtime still inside Agent index.ts
  7. pnpm install
  8. pnpm build
  9. pmpn start --character="characters/nameofyouragentcharacterfile.character.json"

#Note: Make sure you have the following:

  1. Verified Twilio developer account
  2. Verified Twilio phone number
  3. Verified Twilio Whatspapp enabled phone number
  4. have enough credits but they provide free small credits when your account is new

visit twilio: https://www.twilio.com
twilio quick start guides: https://www.twilio.com/docs/messaging/quickstart
twilio documentation: https://www.twilio.com/docs/messaging
Free Trial Account: https://www.twilio.com/docs/messaging/guides/how-to-use-your-free-trial-account

For WhatsApp guides follow the link below you need to have a separate twilio whatsapp enabled phone number

https://www.twilio.com/docs/whatsapp
https://www.twilio.com/docs/whatsapp/quickstart/node
https://www.twilio.com/docs/whatsapp/getting-started#registering-a-whatsapp-sender
https://www.twilio.com/docs/verify/whatsapp

#Some Other Whats App Info that you might need
https://www.twilio.com/docs/whatsapp

#Twilio Phone Number guidelines
https://www.twilio.com/en-us/guidelines

Clarification this project is intended to be use/place inside elizaos project packages, this can't work alone

Sample implementation can be found here

https://github.com/juanc07/AgentSoulSpark

logs-twilio-send-sms
Screenshot_20250103_141851_Messages

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @juanc07! Welcome to the ai16z community. Thanks for submitting your first pull request; your efforts are helping us accelerate towards AGI. We'll review it shortly. You are now a ai16z contributor!

@odilitime odilitime changed the base branch from main to develop January 4, 2025 19:30
@odilitime odilitime changed the title added plugin-twilio this can send message using sms or whatsapp feat: added plugin-twilio this can send message using sms or whatsapp Jan 4, 2025
@@ -525,6 +526,7 @@ export async function createAgent(
// character.plugins are handled when clients are added
plugins: [
bootstrapPlugin,
twilioPlugin,
Copy link
Collaborator

@odilitime odilitime Jan 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shoud be gated by minimum required secrets for Twilio

@odilitime odilitime added Needs Testing Plugin_new Mark PRs that are a new plugin labels Jan 4, 2025
@hellopleasures
Copy link

ph represent, this is nice, salamat juan for this!!!

@juanc07
Copy link
Author

juanc07 commented Jan 5, 2025 via email

@juanc07
Copy link
Author

juanc07 commented Jan 5, 2025

ph represent, this is nice, salamat juan for this!!!

thanks but not approved yet, hahaha!

@juanc07
Copy link
Author

juanc07 commented Jan 5, 2025

suddenly i got integration test issue, but the error is not related to plugin-twilio here is the log "packages/plugin-node postinstall: throw new ERR_MODULE_NOT_FOUND(
packages/plugin-node postinstall: ^
packages/plugin-node postinstall: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/runner/work/eliza/eliza/packages/plugin-node/node_modules/@elizaos/core/dist/index.js' imported from /home/runner/work/eliza/eliza/packages/plugin-node/scripts/postinstall.js"

@juanc07
Copy link
Author

juanc07 commented Jan 5, 2025

BTW my PR is behind the develop branch , should i do the rebase or the moderator or admin only?

@juanc07
Copy link
Author

juanc07 commented Jan 5, 2025

i tried all that i can do but it seems some where in the repo the plugin-node is link or pointing to this directory "/home/runner/work/eliza/eliza/packages" so for me it seems like a local machine directory but the weird thing is i can't find it in the project. the whole error is "packages/plugin-node postinstall: throw new ERR_MODULE_NOT_FOUND(
packages/plugin-node postinstall: ^
packages/plugin-node postinstall: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/runner/work/eliza/eliza/packages/plugin-node/node_modules/@elizaos/core/dist/index.js' imported from /home/runner/work/eliza/eliza/packages/plugin-node/scripts/postinstall.js"

@juanc07
Copy link
Author

juanc07 commented Jan 5, 2025

the issue about the integration test is now fix, thank you @odilitime

@juanc07
Copy link
Author

juanc07 commented Jan 6, 2025

after merging with new changes from develop branch i got issues and error in integration test again "Error: ...1816_a2665c1acc2b05267414f68f617d222f npm-install: src/utils/root-ca.ts(4330,14): error TS2742: The inferred type of 'ROOT_CAS' cannot be named without a reference to '.bin/store/v3/tmp/_tmp_1816_a2665c1acc2b05267414f68f617d222f/node_modules/@peculiar/x509'. This is likely not portable. A type annotation is necessary.
...1816_a2665c1acc2b05267414f68f617d222f npm-install: npm error code 1
...1816_a2665c1acc2b05267414f68f617d222f npm-install: npm error path /home/runner/setup-pnpm/node_modules/.bin/store/v3/tmp/_tmp_1816_a2665c1acc2b05267414f68f617d222f
...1816_a2665c1acc2b05267414f68f617d222f npm-install: npm error command failed
...1816_a2665c1acc2b05267414f68f617d222f npm-install: npm error command sh -c npm run build
...1816_a2665c1acc2b05267414f68f617d222f npm-install: npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-01-06T01_18_30_870Z-debug-0.log
...1816_a2665c1acc2b05267414f68f617d222f npm-install: Failed"

@hellopleasures
Copy link

We have all the same error, maybe the error is on the develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Testing Plugin_new Mark PRs that are a new plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants