As of October 24, 2022, Twilio Notify is no longer for sale to new customers and it will reach end of life on April 25, 2024 for existing customers. Since this product will not persist past this date, we have created this guide to help you identify other Twilio products that may fit your use case, as well as solutions outside of Twilio. Please continue reading for full details.
Twilio Notify alternative solutions
Here are some Twilio solutions that may fit your use case:
- Twilio’s SMS API is a great replacement for any Notify based SMS use cases. You can also use the message scheduling feature to schedule up to 500,000 messages!
- Verify is a Twilio product that enables a user verification method known as “push authentication”, which involves sending a push notification that asks a user to approve a login or other sensitive action. This is an option worth considering if your business requires a digital verification use case in your communication strategy.
- Conversations is a Twilio product accessible via a single API for seamless conversational messaging. This is an option worth considering if your business utilizes push for 2-way messaging in your communication strategy.
- Twilio Segment is a product that offers omnichannel customer engagement built on a customer data platform with downstream push notification partners and guides for push notification creation. You can also utilize a full walkthrough for push notification creation using Braze as a downstream partner.
Recommendations outside of Twilio
If none of the Twilio products listed above meet your push notification use case, we recommend Google’s Firebase Cloud Messaging solution.
Firebase Cloud Messaging (FCM) is a cross-platform solution to facilitate push delivery at no cost. FCM enables developers to send push notifications to iOS, Android, or Web devices all from the same platform.
Notify required bindings to link end user device addresses to a Twilio identity, while FCM requires the Firebase SDK to be directly integrated with the client side application. in addition, FCM provides benefits that were not available through Notify including detailed reporting, impressions, and other metrics.
An FCM implementation requires three main components for sending and receiving notifications:
- A trusted environment or an application server on which to store device registration tokens, build notifications, and send them to your destination.
- An Apple, Android, or web (JavaScript) client app that receives messages via the corresponding platform-specific transport service through the FCM SDK.
- An FCM project registered with the client applications and an FCM Server Key.
Firebase offers several sample apps to help you get started with push delivery to client apps:
Once you have the Firebase SDK integrated with your client applications and stored device tokens, you can use the Notification composer, Firebase admin SDK, or the Firebase API to send these notifications. In place of hosting this service on your own server, Twilio Functions could serve as the bridge between your server and the Firebase API. You could make a request to your function including the device token of the recipient as well as the notification payload and the function can forward that request to FCM. Note that Twilio Functions has a default limit of 20 requests per second. Here is an overview of how you can migrate to Twilio Functions to send these notifications:
- Create a new functions service in the Twilio Console and give it a name.
- In the functions editor, add axios as a module to import.
- Add your FCM server key as an environment variable called FCMkey.
- Next we will use Axios to build out an HTTP request to the Firebase API. Notification details such as the title, body, click action and destination token can be passed in through query parameters.
- To protect your function security, follow this guide: Protect your Function with Basic Auth | Twilio.
To help get you started, here is a short code sample for sending to the FCM API from Functions:
const axios = require('axios');
exports.handler = async (context, event, callback) => {
try {
// capture any info provided in the query string (e.g. body)
var messageBody = event.body;
var messageTitle = event.title;
var messageAction = event.action;
var deviveToken = event.token;
// build notification
var notification = {
"title": messageTitle,
"body": messageBody,
"click_action": messageAction
};
var registrationToken = deviceToken;
const response = await axios.post('https://fcm.googleapis.com/fcm/send', {
notification: notification,
to: registrationToken
},
{
headers: {
"Content-Type": "application/json",
"Authorization": context.FCMkey
}
});
return callback(null, response.data);
} catch (error) {
// In the event of an error, return a 500 error and the error message
console.error(error);
return callback(error);
}
};