Skip to main content

A custom wrapper for the Slack SDK to simplify sending messages and files.

Project description

🍒 easy_cherry: The Smart Slack Notifier easy_cherry is an intelligent, developer-friendly Python library that makes sending Slack notifications incredibly simple. Built as a smart wrapper around the official Slack SDK, easy_cherry handles the boring stuff for you—like resolving user IDs, formatting messages, and managing API responses—so you can focus on what's important.

Whether you're sending a quick debug message, a complex report with attachments, or a high-priority alert to multiple teams, easy_cherry makes it feel effortless.

Key Features Effortless Targeting: Send messages to users by their email, real name, or ID (U.../D...), and to channels by name (#channel) or ID (C...). easy_cherry figures it out.

Smart Text Formatting: Automatically detects and converts HTML strings into Slack's mrkdwn format. No more is_html=True flags!

Multi-Recipient Support: Send the same message or files to a list of recipients in a single, clean command.

Rich Block Kit Helpers: Includes easy-to-use static methods (create_header_block, create_fields_section) to build beautiful, structured messages.

Bulk File Uploads: Attach multiple files to a single message with ease.

Silent Mode: Easily disable all console logging for production environments to keep your logs clean and secure.

Robust & Resilient: Built-in caching for user/channel lookups, configurable timeouts, and detailed API responses for robust error handling.

Installation easy_cherry is available on PyPI. You can install it using pip:

pip install easy_cherry-slack-notifier

Quick Start: Your First Notification Here's how easy it is to send your first message.

import os from easy_cherry import SlackNotifier

1. Get your token from an environment variable for security

slack_token = os.getenv("SLACK_BOT_TOKEN")

2. Initialize the notifier

In production, you might set log=False

notifier = SlackNotifier(token=slack_token, log=True)

3. Send a message!

notifier.send("#general", "Hello from easy_cherry! 🍒")

Advanced Usage Sending to Multiple Recipients Simply provide a list of targets. easy_cherry handles the rest and gives you a detailed report of the results.

recipients = ["#bi_test_channel", "jane.doe@example.com", "U0123456789"]

html_report = """

Weekly Report

Just a quick update: everything is looking great!

"""

results = notifier.send(recipients, html_report)

print("--- Send Report ---") for target, response in results.items(): if response and response.get("ok"): print(f"✅ Successfully sent to {target}") else: print(f"❌ Failed to send to {target}")

Sending Rich Messages with Blocks Use the helper methods to build professional-looking reports and alerts.

1. Build your blocks

report_blocks = [ notifier.create_header_block("🚀 System Performance Report"), {"type": "divider"}, notifier.create_fields_section({ "CPU Load": "12%", "Memory Usage": "58%", "Status": "✅ All Systems Operational" }) ]

2. Send the blocks

notifier.send_blocks( "#devops-alerts", report_blocks, fallback_text="System Performance Report is ready." )

Attaching Multiple Files Provide a list of local file paths to the file_paths argument.

log_files = ["./logs/app.log", "./logs/db_backup.log"]

notifier.send( "#data-team", "Here are the logs from last night's data pipeline run.", file_paths=log_files )

This library was built to take the friction out of Slack notifications. Enjoy!

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

easy_cherry-1.6.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

easy_cherry-1.6.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file easy_cherry-1.6.2.tar.gz.

File metadata

  • Download URL: easy_cherry-1.6.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for easy_cherry-1.6.2.tar.gz
Algorithm Hash digest
SHA256 ce9f69e26f6c011ee52d9bc7f0f8632bfa8e2a2c6d372a28a90f128a2e0438e5
MD5 a89a9a334052ab2ff6726ffb4ee28bdc
BLAKE2b-256 abf6e1049a2d87767da372b7db1a75134429053a284780223df1cef0157dbf7f

See more details on using hashes here.

File details

Details for the file easy_cherry-1.6.2-py3-none-any.whl.

File metadata

  • Download URL: easy_cherry-1.6.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for easy_cherry-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 28810f354605ff35e2440b5c1a9a3766f56a6e4e8c7b2cec5f8b39d417692e31
MD5 363ea3e1e9684d145dec27fcedc511e5
BLAKE2b-256 e9f7383cafc62e414573f6203e9163e484bdf2eb47c78d89985fd8a580c5998e

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