Twilio Programmable Chat Migration Guide
If you need assistance or want to discuss your migration privately with a technical expert, please get in touch with us at email@example.com.
Twilio Programmable Chat EOL Notice
Twilio has scheduled its Programmable Chat API end of life for July 25, 2022, focusing instead on its omnichannel Conversations API. Twilio is choosing not to provide, maintain, and update a dedicated in-app chat API, though some basic in-app chat functionality does roll into the Conversations API.
Why Migrate from Twilio Chat to an Alternative Provider?
If Twilio is already providing a Programmable Chat migration guide to move to the Twilio Conversations API, why consider another provider instead? One reason is that this change appears to be part of a larger trend in which Twilio continues to underinvest in in-app chat and could someday discontinue it entirely.
Learn more about the Twilio Programmable Chat EOL and why many current Twilio Chat customers are considering migration to a new in-app chat provider instead of migrating to the Twilio Conversations API in this post. Here’s the short version:
Twilio is recommending migrating from its Programmable Chat product to its Conversations API. Twilio describes Conversations as a way to "build conversational, cross-channel messaging through a few API calls,” and is thus likely to be forced to prioritize across channels, likely leading to a less polished in-app chat experience than a product making chat itself a top priority.
Twilio Programmable Chat has mostly lagged behind in the competition in terms of ready-made UI kits and critical features like reactions, threads, commands, moderation, translation, and more.
Why Migrate from Twilio Chat to Stream Chat?
Many Twilio Chat customers are evaluating the Stream Chat API and SDKs as a more feature-complete alternative to the Twilio Conversations API. The Stream API currently supports communication for over one billion end users, with performance, reliability, and scalability guaranteed. Stream Chat also includes support for more back-end languages and comes complete with front-end SDKs and UI kits designed to match five common chat use cases.
View a complete side-by-side comparison of Twilio Chat vs. Stream Chat→
Twilio Chat Migration Process: Step-by-Step Instructions
Step 1 - Twilio Programmable Chat Export
Before you begin the migration, you’ll need to decide whether your app can tolerate some downtime or whether it must remain available during the entire process. Then, choose the appropriate tutorial below.
Initialization (Minimal Downtime Required)
Here’s how to initialize your application in Stream:
- Get data: Twilio has a bulk export API to efficiently get all of your existing data, but, unfortunately, it only works for SMS/Whatsapp and not for in-app chat messages. This API is in beta right now and this missing feature might be added in the future — if and when this bulk export tool for in-app chat is added, we will update this guide to recommend using it. In the meantime, luckily, API supports pagination natively for each resource and by using pagination, you can get a snapshot of every resource relevant to you.
- Prepare data: Your exported data will then need to be reformatted to match Stream’s default format for imports.
- We are working on an open-source seamless conversion tool that you will be able to run on your export to adapt the format and validate your data. We will add details here as soon as this tool is ready.
- Import data: When the data is ready, follow these instructions to import chat data. You can import the data yourself from your Stream Dashboard or contact support for assistance.
If your app can tolerate downtime, the above steps only need to be completed once, when you are ready to switch your app from Twilio to Stream. If downtime isn't possible, we recommend the following procedure.
Migration Without Downtime
- Export all existing data once from Twilio as explained above in the get data section.
- Set up a converter: You’ll need to build a “converter” that can accept the Programmable Chat events emitted from Twilio in real-time and turn them into requests against your new Stream chat application.
- We’re interested in learning more about how we can help make your migration process easier, and what kinds of tooling and support you would find useful. If you’d like to talk with our engineering team about your specific needs and interest in this type of open source webhook converter ahead of the Twilio Programmable Chat EOL date, please sign up here and we will follow up with more information.
- Your converter will listen to Twilio webhooks and make requests to your Stream app in real-time, hydrating your Stream data as events are emitted from your Twilio backed app. This is possible because every feature available in Twilio Chat is also available in Stream Chat. In other words, every Twilio webhook will have a one-to-one corresponding action in Stream.
- Deploy converter: Since the converter will be open source, you can easily review and customize according to your custom logic. When you're ready, deploy it by following its instructions, using your credentials.
- You'll need to deploy your converter script somewhere public, like an AWS Lambda or running on a publicly exposed server. That way the converter will be able to receive webhook events from Twilio, convert them into requests against your new Stream app, and make the necessary API calls to hydrate your Stream data.
- If you need help translating Twilio events into Stream API requests, don't hesitate to reach out to our support team.
- Set up webhooks: Finally, when the converter is deployed, update your settings in Twilio to send events to your converter.
- Switch your UI over to Stream (see Stream Chat Tutorial section below).
- Ensure that your data is appearing in Stream Chat as you’d expect. The Chat Explorer section of your Stream Dashboard allows you to quickly browse and search your Stream Chat data. When you are satisfied with your migration results, turn off the real-time converter.
Step 2 - Stream Chat Tutorial
Once your Twilio export has been successfully imported into the Stream platform, you're ready to start building your app. Follow one of our tutorials below to get started.
- React Chat Tutorial
- React Native Chat tutorial
- Flutter Chat Tutorial
- Kotlin Chat Tutorial
- Swift Chat Tutorial
Most of the integration with Chat is typically done on the frontend. Typically only token generation is done server side. SDKs are available for PHP, Python, Go, Ruby, Java, JS and Dart.
Step 3 - Integrate Stream Chat and Leverage New Features
We've seen customers integrate in as little as two days, though the complexity of this integration really depends on how many platforms you're supporting and how complicated your chat service is. Our support team is available to help along the way.
Similarities Stream and Twilio
Stream Chat includes a number of advanced features designed to provide an engaging and fast in-app chat experience, such as reactions, threads, pinning, quoting, custom commands, URL enrichment, and file sharing, etc. Many other parts of the Stream Chat API will feel familiar to developers who are used to working with Twilio Programmable Chat. Here are some areas of overlap:
- Auth: Both APIs require access tokens cryptographically signed by your backend, and SDKs expose helpers to do it. Additionally, on the frontend, Stream SDKs support automatically refreshing expired tokens.
- Channel Types: Both APIs support 1-to-1, group, and public channels. However, Twilio has limitations on the number of members in group channels and public channels won't be supported in the Conversations API. Stream fully exposes channel type customization to you and automatically supports main use cases such as social messaging, team chat, livestream, e-commerce sales and support chat, and gaming chat without any practical limits. Our recent benchmark was over 1M concurrent users in a single channel, for example.
- Web Hooks: The two APIs are very similar here. Stream supports SQS which may be easier to integrate with and more fault tolerant, especially if your infrastructure is already built on AWS. These webhooks are post action events; Stream supports other life cycle hooks: pre-send and custom action hooks, where you can inspect, act on or update each message sent, or register custom commands to enrich messages automatically for your users.
- Bot interface: Both APIs provide means to generate interactive experiences.