This example application demonstrates the power of Media Streams by forking audio from a call, transcribing it, and performing real-time sentiment analysis.
Create a Google Application that has Google's Speech to Text API and the Cloud Natural Language API enabled.
Create credentials for a Service Account and save them as google_creds.json
in the folder next to this README.md
file.
Install and configure the server
npm install
npx configure
To run locally you'll need to open a port on your machine, so that Twilio can communicate. You can do this using ngrok.
ngrok http 3000
Run cp .env.example .env
to create a .env
file with the needed environment variables.
Update your .env
file to contain your ngrok URL and the other needed variables.
Note: NODE_ENV
is set to production
by default.
Set your incoming number to point to your ngrok url (or use the Twilio Console to update your incoming number)
twilio phone-numbers:update +15558765 --voice-url=https://your-ngrok-url.ngrok.io/twiml