https://github.com/craigsdennis/cloudflare-ai-twilio-conversations
A Cloudflare Worker AI script making use of Twilio Conversations for an SMS based chatbot
https://github.com/craigsdennis/cloudflare-ai-twilio-conversations
ai cloudflare conversations llama2 meta twilio workers
Last synced: 6 months ago
JSON representation
A Cloudflare Worker AI script making use of Twilio Conversations for an SMS based chatbot
- Host: GitHub
- URL: https://github.com/craigsdennis/cloudflare-ai-twilio-conversations
- Owner: craigsdennis
- Created: 2023-10-01T20:22:55.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-01T21:00:45.000Z (about 2 years ago)
- Last Synced: 2024-10-29T07:34:27.307Z (12 months ago)
- Topics: ai, cloudflare, conversations, llama2, meta, twilio, workers
- Language: TypeScript
- Homepage:
- Size: 37.1 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Twilio Conversations + Cloudflare Worker AI exploration
This is a WIP to use the new [Cloudflare Worker AI LLM](https://developers.cloudflare.com/workers-ai/models/llm/) and connecting it with [Twilio Conversations](https://twilio.com/conversations) which is an API that allows for omni-channel communications.
## Installation
### Twilio
Install the [Twilio CLI](https://www.twilio.com/docs/twilio-cli/quickstart)
Buy a [phone number](https://console.twilio.com/us1/develop/phone-numbers/manage/search) if you need one.
Create a Conversation Service:
```bash
twilio api:conversations:v1:services:create --friendly-name="cloudflareconvo"
```Use the `SID` (String Identifier) to add a new address configuration
If you need to unset your SMS webhook url:
```bash
twilio phone-numbers:update --sms-url=""
```### Cloudflare
Setup a Cloudflare account
[Install wrangler](https://developers.cloudflare.com/workers/wrangler/install-and-update/) and login if you haven't already.
If you need to authenticate
```bash
wrangler login
```Modify [wrangler.toml](./wrangler.toml) with your information.
```bash
wrangler deploy
```### Altogether now
Configure your Twilio Phone Number to connect to a Conversation Service. Point it to your Cloudflare worker using the `auto-creation.webhook-url` parameter.
```bash
twilio api:conversations:v1:configuration:addresses:create \
--friendly-name="Cloudflare Convo" \
--auto-creation.enabled \
--auto-creation.type="webhook" \
--auto-creation.conversation-service-sid="YOUR-SID-HERE" \
--auto-creation.webhook-url="https://YOUR-CLOUDFLARE-WORKER-NAME.workers.dev" \
--auto-creation.webhook-method="POST" \
--auto-creation.webhook-filters="onMessageAdded" \
--type="sms" \
--address="YOUR-TWILIO-NUMBER"```