https://github.com/devstar2004/linebase
Twilio base whatsapp bot OpenAI's Assistant
https://github.com/devstar2004/linebase
Last synced: about 1 year ago
JSON representation
Twilio base whatsapp bot OpenAI's Assistant
- Host: GitHub
- URL: https://github.com/devstar2004/linebase
- Owner: DevStar2004
- License: mit
- Created: 2024-04-22T14:46:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T15:51:21.000Z (about 2 years ago)
- Last Synced: 2025-03-18T13:19:59.864Z (over 1 year ago)
- Language: TypeScript
- Size: 84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is the migration of current whatsapp bot functinality to twilio based whats app bot.
## Messaging Service -
As for the sender on Twilio, we are utilizing the messaging service available at Twilio Messaging Service, with the number +447897037185 configured as the sender in the service.
## Incoming Messages handler -
To facilitate the reception of messages through Twilio, We've developed a REST APIs in
src/whatsapp/twClient.ts file and configured it as the incoming message webhook on Twilio.
You can update the webhook url on this page -
https://console.twilio.com/us1/service/sms/MG34baca07a010672ee5c8e6190ea70965/sms-serv[…]FMG34baca07a010672ee5c8e6190ea70965%3Fx-target-region%3Dus1
## Message Templates COnfiguration -
For the menu and greeting content, We've created templates on the Twilio side, and in the code, Its being sent using the template ID. You can review and edit the templates https://console.twilio.com/us1/develop/sms/services?frameUrl=%2Fconsole%2Fsms%2Fservices%3Fx-target-region%3Dus1.
For the theme menu template we've assigned a unique id to each menu. That id is comes in the
incoming message paylod when user select any menu item. We've defined the repective AI prompt
for each menu item selection in src/config/prompt.ts file.
## Important files -
1. Twilio Client - src/utils/twClient/index.ts
2. Initialization and Webhooks - src/whatsapp/twClient.ts
3. Message handling logic - src/whatsapp/twCommands.ts