How to send push notifications with Flask
Updated on March 29, 2026
Signalgrid makes it straightforward to send notifications from Flask. The platform uses a simple model built around your client_key, a target channel, and a few core fields such as title, body, type, and optional critical.
Flask is useful for small services, internal tools, and scripts that need a straightforward way to trigger notifications from Python.
The following example sends a simple notification with Flask.
import os
import requests
from flask import Flask, jsonify
app = Flask(__name__)
@app.post("/notify")
def notify():
response = requests.post(
"https://api.signalgrid.co/v1/push",
data={
"client_key": os.getenv("SIGNALGRID_CLIENT_KEY"),
"channel": os.getenv("SIGNALGRID_CHANNEL"),
"title": "Flask Event",
"body": "A Flask route triggered a notification.",
"type": "INFO",
},
)
return jsonify(response.json())client_keychanneltitlebodytypeINFO, WARN, SUCCESS, or CRITcriticalKeeping credentials outside your code is usually the better move.
export SIGNALGRID_CLIENT_KEY=your_client_key
export SIGNALGRID_CHANNEL=your_channel_tokenFlask is useful for small services, internal tools, and scripts that need a straightforward way to trigger notifications from Python.