close search

Hello World

Set up a simple browser-based audio-video chat in a few minutes.


Setting up basic OpenTok client-side code on the web is relatively simple, but you'll need a few things to make sure it works properly:

Set up a simple audio-video chat with OpenTok

Below is an editable HTML document loaded with the OpenTok.js library. Follow the steps under the HTML document to quickly set up a basic OpenTok chat.

See the Pen Hello World by TokBox (@tokbox) on CodePen.

Step 1 of 5: Authentication

Copy the code snippet below and add it to the HTML document under // credentials (use the copy button.)


var apiKey = 'Generating...';
var sessionId = 'Generating...';
var token = 'Generating...';

You must pass a valid API key, session ID, and token when connecting to an OpenTok session. These credentials are usually generated by your server but we generated them for you this time.

OK, I added it