Migrate From Twilio Video Using Dyte's Twilio Shim
Published: 2023-10-12 15:34:24


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eqna30vcyksmynjggeeo.png)
Our business has been fortunate enough to have garnered the interest of several customers. These customers have expressed their satisfaction with our products and services, which we take great pride in providing.

Dyte has been gaining popularity among customers who require reliable cloud communication services. Many of these customers, who were initially using Twilio Video, have been making the switch to Dyte, possibly owing to our call quality, reliability, expeditious customer support, and pricing.

This guide presents an approach to help users smoothly migrate from Twilio Video to Dyte with the help of Shims.

## Thinking of migrating from Twilio Video?

Since you are reading this page, I understand that you are probably considering a switch from Twilio Video to another video provider. In recent times, a lot of our customers migrated from Twilio Video to Dyte. They made this choice due to Dyte's compelling advantages, which include:

- Easy to use APIs with high-level abstractions and inbuilt access control - fewer bugs and less maintenance required
- UI components library - responsive components for React, Angular, WebComponents, React Native, Flutter, Native Android, and iOS. Build real-time applications faster.
- Better media performance - with Dyte's global mesh network of media servers, calls spanning multiple geographies see a significantly better experience.
- Better support -  dedicated Slack support, code reviews, and technical assistance 24/7.

You can view a comprehensive feature [comparison between Dyte and Twilio Video](https://dyte.io/twilio-video-competitor).

Once you've reviewed the reasons behind migrating from Twilio Video, it becomes evident that Dyte will likely meet all your requirements!

However, transitioning from one SDK to another can be a demanding process, considering the time and effort involved. Will migrating from Twilio Video to Dyte entail a similar level of effort? The answer is - No.

Enter Dyte's Twilio Shim, which simplifies the migration.

## Introducing our Shim library

Even though Dyte can be easily integrated (don't believe me? Check out our [docs](https://docs.dyte.io/)) into your codebase, some developers may find the process cumbersome and time-consuming as they have to get rid of their old code and refactor it to fit a new SDK.

To make the lives of these developers easier, **we created a shim library** - [@dytesdk/twilio-shim](https://www.npmjs.com/package/@dytesdk/twilio-shim).

You may be wondering, what is a shim? According to [Wikipedia](https://en.wikipedia.org/wiki/Shim_(computing)):

> In computer programming, a shim is a library that transparently intercepts API calls and changes the arguments passed, handles the operation itself or redirects the operation elsewhere. Shims can be used to support an old API in a newer environment, or a new API in an older environment.

Basically, we created a wrapper around Dyte's SDK with a Twilio Video-compatible external API as a drop-in [replacement for the Twilio Video SDK](https://dyte.io/twilio-video-competitor). You can use the same classes, methods, and other APIs that you used with Twilio Video, but behind the scenes, the shim will perform some magic and translate it to Dyte API calls.

For instance, if you were to connect to a room using Twilio Video and login to the console whenever a new participant joined the room, this is what your code would look like:

```jsx
const { connect } = require('twilio-video');

const authToken = '<AUTH_TOKEN_FROM_TWILIO_API>';

const room = await connect(authToken, {audio: false, video: true});
console.log(`Successfully joined a Room: ${room.name}`);
console.log(room);
room.on('participantConnected', participant => {
    console.log(`A remote Participant connected: ${participant}`);
});
```

The following code snippet demonstrates how you would do it with the shim:

```jsx
const { connect } = require('@dytesdk/twilio-shim');

const authToken = '<AUTH_TOKEN_FROM_DYTE_API>';

const room = await connect(authToken, {audio: false, video: true});
console.log(`Successfully joined a Room: ${room.name}`);
console.log(room);
room.on('participantConnected', participant => {
    console.log(`A remote Participant connected: ${participant}`);
});
```

Can you spot the difference?

[![Switch from Twilio video to Dyte](https://dyte.io/blog/content/images/2023/08/switch-from-twilio-video-to-dyte.png)](https://dyte.io/blog/content/images/2023/08/switch-from-twilio-video-to-dyte.png)

As mentioned previously, the external API is almost identical to Twilio Video. However, intended actions, such as joining a room, are performed internally using Dyte's [web-core](https://docs.dyte.io/web-core) SDK.

You can check out more examples of using our Twilio shim [here](https://www.npmjs.com/package/@dytesdk/twilio-shim).

Here is the complete API compatibility list of methods and classes we currently translate

[https://docs.dyte.io/guides/migration/twilio/compatibility-shim-twilio](https://docs.dyte.io/guides/migration/twilio/compatibility-shim-twilio)

Also, another important note is that this library should just be used to test out the integration, and clients should plan to eventually move to our SDK natively to utilize Dyte's capabilities fully

# _That's all, folks!_

That was a quick and easy way to switch from Twilio Video - just like integrating Dyte into your project. We are working on creating migration guides for other commonly used real-time communication APIs, such as live streaming and AI-powered chat, among others. If you would like us to create a migration guide from your current video provider, you can contact us on our [community Discord](https://community.dyte.io/).

_If you haven't heard about Dyte yet, head over to [dyte.io](https://dyte.io/) to learn how we are revolutionizing communication through our [SDKs](https://dyte.io/video-sdk) and libraries and how you can [get started](https://accounts.dyte.in/auth/register) quickly on your 10,000 free minutes, which renew every month. You can reach us at [support@dyte.io](mailto:support@dyte.io) or ask our [developer community](https://community.dyte.io/) if you have any questions._