ContactLog In

Get started sending notifications with Courier in minutes, not days!

We have SDKs in Ruby, Go, Python, Javascript, Node.js, and React.

Sign up

Automated Notification System Using Python - article header

Create an Automated Notification System Using Python and Courier

Adam Searle

June 12, 2023

Product notifications keep users engaged and informed about important updates related to web and mobile applications. However, building an effective notification system for your app that sends timely and personalized messages can be challenging. Courier's development platform for notifications simplifies this process by consolidating various communication APIs, data, and development tools in one place.

With Courier, you can create a best-in-class notification system that works across product features and use cases to send notifications over email, push, Slack, MS Teams, a notification center in your web or mobile app — or any other channel

In this article, we'll guide you through using Python and Courier to create an automated notification system that sends real-time updates to users. Note that we’ll just be looking at a simple use case for this tutorial. However, this will establish the foundation for a notification system that can be used for virtually any scenario. Some of the features available include:

  1. Powerful API primitives to handle the complex delivery logic that’s behind every great user notification,
  2. Advanced send rules to throttle, batch, and digest messages
  3. Access to 50+ channels and providers so you can reach users where they are
  4. Consolidated notification logs and delivery status analytics to quickly identify and remediate issues
  5. A drop-in notification inbox & preferences center for your app
  6. Out of box integrations with observability, authentication, and customer data platforms
  7. Web-based notification designer to build and manage templates across channels
  8. Channel and provider failover so your messages always get through


  • Create a Courier account.
  • Install the latest version of Python.
  • Install the trycourier package using pip install trycourier. You can find additional documentation for the package by following the link above.

Step 1 — Integrate a communication provider

  1. Go to the Courier channel tab and click Add Channel.
  2. Choose your preferred communication channel. For this example, we'll use email.
  3. Select your preferred communication service provider. We'll use Gmail in this case.
  4. Continue and authorize your Gmail account to integrate with your Courier account. This authorized Gmail account will serve as the automated email sender.

Step 2 — API keys

To connect your Python application to your Courier account, you need API keys.

  1. Go to the Courier API Keys page in the Settings tab.
  2. Retrieve both production and test keys. You will use these keys when setting up the Python application.

Step 3 — Design the notification content using Courier Designer (optional)

Courier provides a convenient feature that enables you to create and customize notification content for email, SMS, push notifications, and chat apps such as Slack and Microsoft Teams.

The process of designing a custom notification using Courier is simple, making it easier for you to tailor your messages according to your audience and communication needs.


  1. Go to the Courier Designer tab and click Create Template.
  2. After integrating with your email provider, click on the provider to continue.
  3. Use Courier's notification builder to customize the email content. Click Publish Changes to publish the new notification.


Step 4 — Send a simple notification with Python

First let’s look at an example of how to send a simple notification using Python and Courier.

Create a file named and add the following code. You can find the default code snippet for your notification in the Send tab of the Courier notification designer.

This code imports the Courier library, initializes the client with your API key, and sends a message using a specified template to a recipient's email address. Replace the API key, notification ID, and email address with your own values.

Step 5 — Customize the notification workflow by adding client profiles

You can send notifications to multiple recipients simultaneously using Courier client profiles. First, you should go through the process from step 3 again, in order to create a second notification, as this demo sends two notifications with a delay in between.

This code creates a new client profile in Courier using the profiles.add method. You need to provide a unique profile ID, email address, and name to create the profile. For this tutorial, you will need to do this two times, for two separate users. You can, if you prefer, easily add a user directly from the Courier dashboard.

Now let’s use the client profile's ID as a recipient when sending notifications.

This code demonstrates how to invoke an automation with multiple steps using Courier's automations.invoke method. The steps include sending a notification to two different recipients with unique profile IDs, and a delay of 1 minute between the notifications.

Step 6 — Automate the Notification Workflow with Courier's Scheduling Capability

Next, we're going to demonstrate how to schedule a notification to be sent periodically using Courier's in-built scheduling functionality. If you want to know more about Courier Automations, check out this post.

To setup a scheduled notification using Courier, you will have to use the Courier Automations platform. Here is how to do it. \ Open Courier Automations in your Courier account from the dashboard.

  1. Click on the New Automation button to start a new automation workflow.
  2. Drag the Schedule trigger from the triggers section onto the canvas.
  3. Set your desired scheduling method. Courier offers three scheduling methods:
    a) Recurrence: Schedule the automation to be invoked on a repeated schedule, similar to how one would schedule a repeat event in a calendar application.
    b) Date: Schedule the automation to be invoked one time on a specific future date.
    c) Cron: Similar to Recurrence but with more specificity using crontab expressions.
  4. After setting up your schedule trigger, add the Send action to the canvas.
  5. Choose your recipient(s) and set the Template field with your notification.
  6. If you want to send another notification after a delay, add the Delay action followed by another Send action.
  7. Save your automation.
  8. You can then head to the invoke tab to invoke the most recent published version of the automation template. For example:

This setup will automate your notification. The notification(s) will be sent according to the schedule you have configured within Courier Automations.

Sent notification details

When the application runs, it sends a request to Courier containing all the necessary information about the notification, including the content, recipient email details, additional data, routing options, and message delay duration. Courier processes the request and routes the notification to the appropriate channel — in this case, email. And while we’re showing this over email, it’s just as easy using Courier Automations to build a workflow that sequences the notification to a web and mobile notification center, Slack or MS Teams DM, push notification, etc, based on delivery status and timing rules so that users are more likely to get the notification.

To check the status of a notification, visit the Courier Logs page. You'll see a list of all notifications sent from your account and can click on any one to view more details.


The Courier Logs page automatically updates with the notification status, allowing you to check whether the notification was sent or not. You can also see the time when the recipient opened the notification. Or look into error details of notifications that aren’t delivered so you can quickly debug.

Wrapping up

In this article, we've walked you through the process of creating an automated notification system using Python and Courier, a powerful combination that can streamline communication within your organization and elevate the user experience for your customers.

By following the steps we've outlined, you'll be well-equipped to create a customized notification system that meets your unique requirements. To learn more about the notification features available, check out Courier for free today or contact us if you want to talk through your unique requirements.

Get started sending notifications with Courier in minutes, not days!

We have SDKs in Ruby, Go, Python, Javascript, Node.js, and React.

Sign up

More from Tutorial

How to set up automatic push notifications based on Segment events thumbnail

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

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

Martina Caccamo

November 01, 2023

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification











API Status


© 2024 Courier. All rights reserved.