Twilio Client JavaScript SDK 1.1 & 1.2 Migration Guide

If you are currently using Twilio Client JavaScript SDK 1.1 or 1.2, this guide will walk you through the steps to upgrade to version 1.4 which is our latest Twilio Client JavaScript SDK.

On February 14, 2018, Twilio Client 1.1 & 1.2 will reach their end of life and will no longer be supported. At the end of life date you can expect the following:

  • The JavaScript library will no longer be served from our CDN.
  • Connections made with the deprecated library will be refused.
  • Twilio Support will no longer address questions on deprecated libraries.

Our new Twilio Client JavaScript SDK 1.4 library’s core calling functionality is backward compatible but there are important aspects you need to take into consideration. Below is a detailed step-by-step guide that helps you migrate to our latest version.

Step 1: Determine if you are using Twilio Presence or Device Sounds

Twilio Presence and Device sounds are deprecated functionality included in old versions of Twilio Client JavaScript SDK. This functionality is fully deprecated and not supported anymore. 

To find if you are using Twilio Presence or Device Sounds, search your code for:

Twilio.Device.presence
Twilio.Device.sounds

If you do not use Twilio Presence or Device, then advance to Step 2.

If you do use Twilio Presence or Device Sounds, read on:

If you are using Twilio.Device.sounds, note that this functionality still exists but has been moved onto the AudioHelper object on Twilio.Device.audio. Any references to Twilio.Device.sounds.incoming, Twilio.Device.sounds.outgoing or Twilio.Device.sounds.disconnect should be updated to Twilio.Device.audio.incoming, Twilio.Device.audio.outgoing and Twilio.Device.audio.disconnect, respectively.

If you are using Twilio.Device.presence, it is important to note that this functionality is not currently supported and will stop working on February 14, 2018. It is also important to note that Twilio Presence is not required to make or receive calls to and from the Twilio Client JavaScript SDK.

There are two approaches you can take to manage presence:

1) Manage agent presence with Task Router.

If you are using Twilio Presence to manage contact center agent presence, we recommend TaskRouter to manage agent state and call distribution.

You can get started with TaskRouter here: https://www.twilio.com/docs/api/taskrouter

1) Manage user presence with Twilio Sync.

If you are using presence to manage 'Buddy lists' we recommend using Twilio Sync, our new state synchronization product that you can use to manage endpoint state (i.e. Presence) across devices.
You can get started with Twilio Sync here: https://www.twilio.com/docs/api/sync

Step 2: Determine if you are using old browser versions

Our new Twilio Client JavaScript SDKs are entirely based on WebRTC, which is the standard for browser-based communications. WebRTC is now supported on all major browsers - Chrome, Safari, Firefox, Microsoft Edge and Opera.

Older browsers (Safari < 11 and Internet Explorer) on the market do not support WebRTC and the new versions of Twilio Client JavaScript SDK do not support Adobe Flash which was the technology used to be able to make calls from old browsers.

Making calls through Flash results in a poor user experience. Therefore it is not something we recommend. So with better technologies available (WebRTC), we are not supporting Flash going forward.

What browser versions support WebRTC?

For the latest WebRTC browser compatibility see: http://caniuse.com/#search=webrtc

If your browser does support WebRTC, go to Step 3.

If you are currently using a non-WebRTC supported browser you need to make sure your browsers are updated to the latest version or a WebRTC supported version.
Specifically for the case of Internet Explorer please follow Microsoft's recommendation to upgrade to Microsoft Edge.

Step 3: Upgrade the JavaScript.

In this case, upgrading to the latest version of the Twilio Client JavaScript SDK 1.4 is extremely easy. You have to include the new version of the JavaScript library as described below:

Include the following script in the <head> tag of your web page.

Including the Twilio.js library

Simply include the twilio.js library within the <head> of your HTML:

<script type="text/javascript"
src="//media.twiliocdn.com/sdk/js/client/v1.4/twilio.min.js"></script>

You should use HTTPS to serve your page. Starting with Google Chrome 47, HTTP applications will no longer be allowed to call getUserMedia() and will not be given access to the user's camera and microphone.

Make sure to search your code to find any other instances where the old libraries are used, update them and you are good to go.

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.