Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Programmable Chat Quickstart: Javascript


(error)

Programmable Chat deprecated

Programmable Chat has been deprecated and receives no support. Twilio has turned its focus to the next generation of chat: Twilio Conversations. Find out more about the EOL process(link takes you to an external page).

  • To start a project, see Conversations.
  • To switch from Programmable Chat, see the Migration Guide to learn about how to switch.

This quickstart gets you up and running with a sample chat application you can build on as you learn more about Programmable Chat.


Gather account information

gather-account-information page anchor

To set up your back-end for Chat, you need four values from your Twilio account:

Config ValuesDescription
Service Instance SIDA service instance where all the data for our application is stored and scoped. Generate one in the console here.
Account SIDYour primary Twilio account identifier - find this in the console here.
API KeyUsed to authenticate - generate one here.
API SecretUsed to authenticate - just like the above, you'll get one here.

Download, configure, and run the starter app

download-configure-and-run-the-starter-app page anchor

Choose a download package for your server-side language of choice. If you're primarily a front-end developer and don't have a strong preference, Node.js will probably get you up and running the fastest.

Follow the instructions in the README for each starter application to configure and run it on your machine, using the four values we created above:


When you visit the homepage of the starter application, verify that everything looks good with your settings, and then click the green chat button at the bottom.

You have been assigned a random user identity and have joined a channel called general. If you open this page in another browser window or tab, you should be able to have a rousing conversation with yourself!

The HTML and CSS in the starter application aren't terribly interesting, but the JavaScript code driving this application has a few very important jobs:

  1. Fetch an AccessToken from the server via Ajax
  2. Initialize the Chat JavaScript SDK
  3. Join a channel called "general"
  4. Handle UI events to send messages or display new incoming messages

We explore how to manage your users in our user identity guide, how to generate an access token, and cover everything you can do with a channel object in the channels and messages guide.


Now that you have completed the Chat quickstart, you can continue building your application. To learn how Programmable Chat works, see the user identity guide and the channels and messages guide.