To run this example you will need to first create a SignalWire account and then configure a SignalWire Space with an inbound phone number.
To run the example a SignalWire Project ID and API Token are required. Follow these intructions to create a new API Token.
Set the Relay context that your phone number forwards to as translator
To access the Google Speech to text and language translation API, you need to create an account and some credentials.
Follow these instructions https://cloud.google.com/speech-to-text/docs/libraries Be sure to include permissions for the translation API as well.
Upon completion you will have downloaded a JSON file with your google key.
Save this file to in the backend directory as google-key.json
Create a file .env
with the following contents
SIGNALWIRE_PROJECT_KEY=
SIGNALWIRE_TOKEN=
VERIFIED_NUMBER=<Your signalwire phone number including the region code>
GOOGLE_APPLICATION_CREDENTIALS=google-key.json
Ensure your google-key.json
and .env
file are in this directory and correctly configured with your credentials and SignalWire Phone number.
- Navigate to the backend directory in a terminal.
cd /backend
- Run NPM install.
npm i
- Start the backend server and consumer.
node consumer.js
If you're running your backend remotely, run with the environment variable API_URL set to the remote API address.
- Navigate to the frontend directory in a terminal.
cd /frontend
- Run NPM install.
npm i
- Start the frontend
npm start