Product News

Apr 9, 2023

Sending multi-channel notifications from a Python app with a single API.

Anand S

Python is a powerful programming language that has become a go-to choice for developing REST APIs and backend applications. Its clean and readable syntax, extensive libraries, and ease of use, makes Python a good choice to build and deploy web applications. In this blog, we'll learn how to use Engagespot python library to send multi-channel notifications like emails, push notifications, SMS, Whatsapp using a single function call. With this, You don't have to learn multiple provider APIs and integrate them into your code.


Before getting started, make sure you have the API-KEY and API-SECRET for your Engagespot app. If you don't have, you can create one for free here. Also, you should enable the required channels from Engagespot dashboard -> Channels menu.

Using Engagespot Python library

Add the add engagespot library to your python project from pypi.

pip install engagespot

After that, you can simply import the Engagespot class in the module where you want to trigger notifications.

from engagespot import Engagespot

Initialize the Engagespot class with your API Key and API Secret that you'll find on your Engagespot dashboard.

client = Engagespot(api_key="ENGAGESPOT_API_KEY", api_secret="ENGAGESPOT_API_SECRET")

Creating a user

Now, we should create a user in your Engagespot app. This function should be called whenever a new user is registered in your application.

user_profile = {
    "name" : "Anand",
    "email" : ""
response = client.create_or_update_user("anand-001", profile=user_profile);

This function creates the user Anand identified by a unique identifier anand-001. We'll also attach his email id to his user profile.

Sending a notification

Now you've created your user's profile in Engagespot. Now you can send a notification using the send function.

send_request = {
   "notification": {
       "title":"Hey Anand, This is a test message from Python library🔥"
response = client.send(send_request)

Advanced Features

You can make use of advanced features like templated notifications, custom data attributes, file attachments etc by reading Engagespot documentation.

Anand S

Share this post