Skip to main content

Unified messaging library for Telegram, Discord, and Slack.

Project description

nbnotify

A unified Python library for sending messages and images to Telegram, Discord, and Slack — with a single, consistent API.

Perfect for Jupyter notebooks, ML training scripts, or any long-running process where you want real-time notifications.


Installation

pip install nbnotify

Or via conda:

conda install -c conda-forge nbnotify

Quickstart

from nbnotify import configure, send_message, send_image

# Pick your platform
configure("telegram", bot_token="YOUR_TOKEN", chat_id="YOUR_CHAT_ID")

send_message("Training complete!")
send_image("results.png", caption="Final accuracy: 98.2%")

Platform Setup

Telegram

  1. Create a bot via @BotFather and get your token.
  2. Send a message to your bot, then visit https://api.telegram.org/bot<TOKEN>/getUpdates to find your chat_id.
configure("telegram", bot_token="123:ABC...", chat_id="987654321")

Discord

  1. Go to your channel → Edit Channel → Integrations → Webhooks → New Webhook.
configure("discord", webhook_url="https://discord.com/api/webhooks/...")

Slack

  1. Visit api.slack.com/appsIncoming Webhooks.
# Text only
configure("slack", webhook_url="https://hooks.slack.com/services/...")

# Text + images (requires bot token)
configure("slack", webhook_url="...", bot_token="xoxb-...", chat_id="#general")

API Reference

configure(platform, *, bot_token, webhook_url, chat_id)

Sets up the active platform. Must be called before any other function.

send_message(text)

Sends a plain-text message. Returns the API response dict.

send_image(image_path, caption=None)

Sends an image file. Optionally attach a caption.

get_config()

Returns the current configuration (tokens are masked).

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbnotify-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nbnotify-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file nbnotify-0.1.0.tar.gz.

File metadata

  • Download URL: nbnotify-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for nbnotify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d5113f22e4841c319464cc753b36ef023f0cb1fd01a2af7d73b9fc772d24ce1
MD5 8539487f451d57bfa9ea6cf4eb8b38f8
BLAKE2b-256 e8fd9e438aba2fff987057d48ce68cf9f302504adebd6fc2da053a102506c3a1

See more details on using hashes here.

File details

Details for the file nbnotify-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nbnotify-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for nbnotify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3cef095bcde994c9660b86b5866b2f7fba862e5766c30aba6b65b5afa506554
MD5 a6ee1002db91e9c9ab7469d1bc3e90b3
BLAKE2b-256 474b4a29b7dfa7aa74a8a145bc580a80072d19158a9906ab476c4024dcc89a97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page