Most Popular
We have SDKs in Ruby, Go, Python, Javascript, Node.js, and React.
Sign up
You’ve got to stop sending password reset emails. Everyone does it and it’s not cool anymore. Many of your users don’t want to log into their email or open the mail app just to get access to a code that they have to manually copy and paste into your app — it’s a waste of time. Most phones support autofilling codes sent via SMS, which might make SMS the preferred channel for these users. However, you also can’t assume that this is how everyone will behave. You need to let your user decide how they receive their notifications, which means giving them the option between SMS, email, or whatever other channel they prefer.
Generalizing user behavior can lead to unnecessary reduction in user engagement on your app, which will eventually lead to decreased user retention. Preferences matter, and they’re easy to set up. Let’s walk through two ways in which you can implement an amazing password reset notification experience for your users, by communicating with them via their preferred channels.
Here’s how you might be sending password reset emails today using the Courier SDK:
1pip install trycourier
1from trycourier import Courier23client = Courier(auth_token="<API_KEY>")45resp = client.send_message(6message={7"to": {8"email": "example@email.com",9},10"content": {11"title": "Hi!",12"body": "You have requested to log in. Your access code is {{code}}. Use this link to reset your password: {{link}}.",13},14"data": {15"link": "<insert_link_here>",16"code": "283hf2"17}18}19)2021print(resp['requestId'])
For best practices, make sure to use environment variables to store your API keys!
By adding your user’s phone_number
and setting the routing.method
to all
, you can send via email and SMS. When this API call is made, your user will receive both an email and an SMS, and they can access the message from the most convenient option.
1from trycourier import Courier23client = Courier(auth_token="<API_KEY>")45resp = client.send_message(6message={7"to": {8"email": "example@email.com",9"phone_number": "123-456-7890"10},11"content": {12"title": "Hi!",13"body": "You have requested to log in. Your access code is {{code}}. Use this link to reset your password: {{link}}.",14},15"data": {16"link": "<insert_link_here>",17"code": "283hf2"18},19"routing": {20"method": "single",21"channels": ["email", "sms"],22},23}24)2526print(resp['requestId'])
To send password reset notifications via all channels, just replace the "single"
with "all"
in the routing object.
With a Preferences Center, you can enable your users to share specifically how they want to receive their notifications. Courier is a notifications infrastructure that provides a customizable out-of-the-box Preferences Center.
Notifications designed in Courier can be tagged with Subscription Topics that allow you to categorize them. Learn more >.
{$.urls.preferences}
The following code will make an API call to Courier to send the Notification Template we just created.
template
property.to
object (learn more about what profile info you will need for each channel).1from trycourier import Courier23client = Courier(auth_token="<API_KEY>")45resp = client.send_message(6message={7"to": {8"email": "example@email.com",9"phone_number": "123-456-7890"10},11"template": "0ZP3AH34H945QHPNZ2S0NF7X1RNB",12"data": {13"link": "<insert_link_here>",14"code": "283hf2"15},16"routing": {17"method": "single",18"channels": ["email", "sms"],19},20}21)2223print(resp['requestId'])
This API call is very similar to the code in the first method we used to send. However, since the Notification Template is attached to a Subscription Topic, your app will now automatically respect your user’s preferences instead of sending messages on all channels.
Let’s rethink our approach to password reset notifications. The traditional method of sending password reset notifications via emails is no longer convenient or efficient for many users. By assuming that everyone will follow the same behavior pattern, you risk alienating a significant portion of your user base.
To provide an exceptional user experience, you must empower your users to choose how they receive their notifications. Whether it's through SMS, email, or any other preferred channel, offering this flexibility demonstrates that you value their time and preferences.
We have SDKs in Ruby, Go, Python, Javascript, Node.js, and React.
Sign up
How to Set Up Automatic Push Notifications Based on Segment Events
Push notifications have carved their own niche as a powerful tool for continuous user engagement. Regardless of whether an app is actively in use, they deliver your messages straight to your user's device. Two key players that can combine to enhance your push notification strategy are Segment and Courier. In this tutorial, we show you how to set up Courier to listen to your Segment events and then send push notifications to an Android device based on data from these events.
Sarah Barber
November 17, 2023
How to Send Firebase Notifications to iOS Devices Using Courier
This tutorial explains how to send push notifications to iOS devices from your iOS application code using Firebase FCM and Courier’s iOS SDK.
Martina Caccamo
November 01, 2023
Free Tools
Comparison Guides
Send up to 10,000 notifications every month, for free.
Get started for free
Send up to 10,000 notifications every month, for free.
Get started for free
© 2024 Courier. All rights reserved.