Building Twilio Apps with React: A Guide for Frontend Developers

February 18, 2021
Written by
Reviewed by


Of all the JavaScript application frameworks, React.js continues to be the most popular among JavaScript developers.

For developers building Twilio apps, however, learning how to make use of the different Twilio JavaScript SDKs inside React can be a complex process, and there aren’t always easy answers.

In this post, you’ll get a birds eye view of the different Twilio JavaScript SDKs and see examples of how you can utilize them in a React app to make your next project easier.


To make the most of the resources in this post, you should have:

  • A free Twilio account (if you sign up with this link, we’ll both get $10 in Twilio credit when you upgrade your account)
  • A working knowledge of React
  • Node.js installed on your machine
  • npm, yarn, or another package manager

The Twilio JavaScript SDKs

Twilio offers several JavaScript SDKs that are used to develop Twilio apps on the frontend. These are different from the twilio-node server-side helper library that you could use inside a Twilio Function or another backend Node.js app. These SDKs allow you to build browser apps for video calling, voice calling, chat, and more. They include:

Generating Access Tokens

To make use of these SDKs, you need a way to authenticate your users with Twilio in a way that doesn’t expose your Twilio credentials. That means that even though the app is built on the client side, you’ll still need a backend server to generate access tokens. These tokens verify the client's identity and grant it access to Twilio API features.

Generate Access Tokens in Node.js

Generate Access Tokens in Python

Programmable Voice and Twilio Client JS SDK

The Twilio Client JS SDK is for building Programmable Voice apps in the browser. With this SDK, you can “open inbound and outbound audio connections to Twilio for building softphones, walkie-talkies, conference calls, click-to-talk systems, and more, all from the browser.

To install it from your command line:

npm install twilio-client

Once you’ve installed the SDK and generated your access token, you’re free to start building your Programmable Voice React app.

See how to build a browser-based walkie talkie with the Twilio Client JS SDK and React.

Conversations API and Programmable Chat

Twilio Programmable Chat, used to develop text-based chatting applications, is being replaced by the Conversations API. Programmable Chat will be sunsetted in July of 2022. Luckily, the Conversations API is built on the same foundations as Programmable Chat, with a few key differences. And for React developers, the overall implementation strategy should be the same.

Install the Conversations API JS SDK:

npm install --save @twilio/conversations

Explore building a multi-room web chat app with Flask, React, and the Conversations API.

Learn how this author built a basic React chat app with Programmable Chat.

Programmable Video

The Programmable Video JS SDK can be used to build robust and high quality video and voice calling apps in the browser. Check out the detailed API documentation available.

Install the Programmable Video JS SDK:

npm install --save twilio-video

Learn how to build a basic video chat app with React class components.

See how to build a video chat app with React functional components and hooks.

Twilio Sync

Twilio Sync is a “state synchronization service, offering two-way real-time communication between browsers, mobiles, and the cloud.” Many of Twilio’s APIs use Sync under the hood.

To get started with the Sync JS Library, install it with this command:

npm install --save twilio-sync

Develop a server push solution with React, Flask, and Twilio Sync.

Checkout the Twilio Sync and React Quickstart by the Twilio Developer Education team.


I hope this article helped you start building React apps with the Twilio JavaScript SDKs. Bookmark this page so you have all the resources you need in one place. Also, if you’d love to see more React articles that use these SDKs, send me a shout on Twitter with your ideas!

Ashley is a JavaScript Editor for the Twilio blog. To work with her and bring your technical stories to Twilio, find her at @ahl389 on Twitter. If you can’t find her there, she’s probably on a patio somewhere having a cup of coffee (or glass of wine, depending on the time).

Create Reusable Dynamic Blocks in Twilio SendGrid with this React Application

This React App makes it straightforward to create, edit, and manage reusable content blocks for SendGrid Dynamic Templates.

Build a contact form with AWS Amplify that emails using AWS Lambda and SendGrid

Learn how to build a contact form using AWS Amplify that stores submissions into DynamoDB and uses a Lambda to send the submission as an email using SendGrid.

A Privacy-First Web Analytics Solution with Twilio Segment

Learn how to build a completely private and anonymous web analytics solution using Twilio Segment.