This repo provided by AssemblyAI displays how to use our JavaScript SDK with Twilio to transcribe calls in real-time.
- Before running this app, you need to upgrade your AssemblyAI account. The real-time API is only available to upgraded accounts at this time.
- Running the app before upgrading will cause an error with a 402 status code.
⚠️ - To upgrade your account you need to add a card. You can do that in your dashboard!
- You will need to set up a Twilio account and then install the Twilio CLI.
- You will also need to create an ngrok account and install it on your computer. Once you create an account there will be instructions to follow on your dashboard for installation.
- Clone the repo to your local machine.
- Open a terminal in the main directory housing the project. In this case
transcribe.js
. - Run
npm install
to ensure all dependencies are installed. - Add a
.env
file. Add your AssemblyAI key to the.env
file. You can find your API key on the "Account" page in your dashboard. Copy and paste it into the.env
file replacing "YOUR-PERSONAL-API-KEY" with your key:ASSEMBLYAI_API_KEY=YOUR-PERSONAL-API-KEY
- In your terminal, run
ngrok http 8080
. You will then see a Forwarding url that points to your local host. You will need this in the next step. - Leave
ngrok
running and open up a new terminal. To tell Twilio what the routing address for your Twilio number is, use the following code:twilio phone-numbers:update $TWILIO_NUMBER --voice-url $NGROK_HTTP_URL
. Where$TWILIO_NUMBER
has been replaced with your Twilio number that you can find in the Twilio console and$NGROK_HTTP_URL
has been replaced with the ngrok forwarding URL that you got in the previous step. - Start the app with the command
node transcribe.js
. - Call the Twilio number and follow the verbal instructions. Once the stream begins, any spoken words will be transcribed in the terminal.
- Transcribe Twilio Phone Calls in Real-Time with AssemblyAI blog post
- Transcribe Twilio Phone Calls in Real-Time with AssemblyAI | JavaScript WebSockets Video Tutorial
- Realtime Phone Call Assistant - Python
If you have any questions, please feel free to reach out to our Support team - support@assemblyai.com!