Basic 1:1 video chat application. Check out this blog post for a walkthrough of the app.
This project requires some environment variables to be set. To keep your tokens and secrets secure, make sure to not commit the .env file in git. When setting up the project with twilio serverless:init ... the Twilio CLI will create a .gitignore file that excludes .env from the version history.
In your .env file, set the following values:
| Variable | Description | Required |
|---|---|---|
ACCOUNT_SID |
Find in the console | Yes |
API_KEY |
Twilio API Key. Create one here (https://www.twilio.com/console/runtime/api-keys) | Yes |
API_SECRET |
Twilio API Secret corresponding to your API Key | Yes |
ROOM_NAME |
A room name to identify your video call | Yes |
PASSCODE |
A passcode to gate your video call | Yes |
/video-token expects the following parameters:
| Parameter | Description | Required |
|---|---|---|
| passcode | The passcode the user entered on the website | Yes |
- Install the Twilio CLI
- Install the serverless toolkit
twilio plugins:install @twilio-labs/plugin-serverless- Initiate a new project
twilio serverless:init example --template=video && cd example
- Start the server with the Twilio CLI:
twilio serverless:start
- Open the web page at https://localhost:3000/index.html to test the app
ℹ️ Check the developer console and terminal for any errors, make sure you've set your environment variables.
Deploy your functions and assets with either of the following commands. Note: you must run these commands from inside your project folder. More details in the docs.
With the Twilio CLI:
twilio serverless:deploy