How to Send Push Notifications from a Python Script
pythonsdktutorial
Your Python script finishes a 2-hour data processing job at 3 AM. A monitoring script detects a spike in error rates. A cron job fails silently. In all these cases, you need to know -- immediately, on your phone, not in a log file.
BotBell's Python SDK lets you add push notifications to any script in 3 lines of code.
Step 1: Install the SDK
pip install botbell
Zero dependencies. Works with Python 3.9+.
Step 2: Create a Bot
Sign up at botbell.app, create a bot, and copy the Bot Token.
Step 3: Send Notifications
Basic Notification
from botbell import BotBell
bot = BotBell("bt_your_token_here")
bot.send("Data processing complete. 1.2M rows imported.")
Monitoring Script
import psutil
from botbell import BotBell
bot = BotBell("bt_your_token_here")
cpu = psutil.cpu_percent(interval=5)
mem = psutil.virtual_memory().percent
if cpu > 90 or mem > 85:
bot.send(
f"Server alert: CPU {cpu}%, Memory {mem}%",
title="High Resource Usage"
)
Ask for a Decision
reply = bot.send_and_wait(
"ETL job found 847 duplicate records. What should I do?",
actions=[
{"label": "Skip duplicates", "action": "skip"},
{"label": "Merge records", "action": "merge"},
{"label": "Abort job", "action": "abort"}
]
)
if reply.action == "skip":
skip_duplicates()
elif reply.action == "merge":
merge_records()
else:
abort_job()
Your phone buzzes with three buttons. Tap one, and the script continues.
What's Next?
- Python SDK on PyPI -- full API reference
- API Reference -- REST API for any language
- MCP Server -- connect AI agents directly