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

fix: misc improvements. #132

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/conversational-ai/twilio/javascript/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
ELEVENLABS_AGENT_ID=<your-agent-id>
ELEVENLABS_API_KEY=<your-api-key>

# Twilio outbound calling
TWILIO_ACCOUNT_SID=<your-account-sid>
TWILIO_AUTH_TOKEN=<your-auth-token>
TWILIO_PHONE_NUMBER=<your-twilio-phone-number>
38 changes: 28 additions & 10 deletions examples/conversational-ai/twilio/javascript/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# ElevenLabs Conversational AI - Twilio Integration (Javascript)

This demo shows how to integrate ElevenLabs Conversational AI with Twilio to create an interactive voice agent that can handle phone calls.
This demo shows how to integrate ElevenLabs Conversational AI with Twilio to create an interactive voice agent that can handle inbound and outbound phone calls.

## Prerequisites

- ElevenLabs API key
- Twilio account & phone number
- Node
- A static ngrok URL for local development
- ElevenLabs API key.
- Twilio account & phone number.
- Node 16+.
- A static ngrok URL for local development.

## Quick Setup

Expand All @@ -18,8 +18,9 @@ npm install
```

2. Configure environment:
- Copy `.env.example` to `.env`
- Add your ElevenLabs Agent ID

- Copy `.env.example` to `.env`: `cp .env.example .env`
- Add your ElevenLabs Agent ID and API key to the `.env` file

3. Start the server:

Expand All @@ -28,13 +29,14 @@ node index.js
```

4. In a new terminal, use ngrok to create a public URL:

```bash
ngrok http --url=<your-static-url> 8000
ngrok http --url=<your-static-url> 8000
```

5. Configure your Twilio webhook:
- Go to your Twilio Phone Number settings
- Set the webhook URL for incoming calls to: `{your-ngrok-url}/incoming-call-eleven`
- Set the webhook URL for incoming calls to: `{your-ngrok-url}/twilio/inbound_call`
- Make sure the HTTP method is set to POST

## Testing
Expand All @@ -43,6 +45,22 @@ ngrok http --url=<your-static-url> 8000
2. The agent should answer and begin the conversation
3. Monitor the console logs for any potential issues

### Outbound Call

1. Start the server: `node outbound.js`
1. `ngrok http --url=<your-static-url> 8000`
1. Make a request to the `/outbound-call` endpoint with the prompt you want to use:

```bash
curl -X POST https://<your-ngrok-url>/outbound-call \
-H "Content-Type: application/json" \
-d '{
"prompt": "You are Eric, an outbound car sales agent. You are calling to sell a new car to the customer. Be friendly and professional and answer all questions.",
"first_message": "Hello Thor, my name is Eric, I heard you were looking for a new car! What model and color are you looking for?",
"number": "number-to-call"
}'
```

## Troubleshooting

- Ensure the environment variable is properly set
Expand All @@ -56,4 +74,4 @@ For detailed setup instructions and troubleshooting, please refer to the [offici

## License

This project is licensed under the MIT License - see the LICENSE file for details.
This project is licensed under the MIT License - see the LICENSE file for details.
Loading