Metadata-Version: 2.1
Name: snotify
Version: 0.1.1
Summary: Lightweight notification manager for Telegram, Webhook, Email and Custom channels
Home-page: https://github.com/swtormy/snotify
Author: Konstantin Vasilev
Author-email: swtormy@yahoo.com
License: MIT
Project-URL: Documentation, https://github.com/swtormy/snotify#readme
Project-URL: Source, https://github.com/swtormy/snotify
Project-URL: Tracker, https://github.com/swtormy/snotify/issues
Keywords: notifications telegram,webhook,email
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohappyeyeballs==2.4.3
Requires-Dist: aiohttp==3.11.6
Requires-Dist: aiosignal==1.3.1
Requires-Dist: aiosmtplib==3.0.2
Requires-Dist: attrs==24.2.0
Requires-Dist: colorama==0.4.6
Requires-Dist: frozenlist==1.5.0
Requires-Dist: idna==3.10
Requires-Dist: iniconfig==2.0.0
Requires-Dist: multidict==6.1.0
Requires-Dist: packaging==24.2
Requires-Dist: pluggy==1.5.0
Requires-Dist: propcache==0.2.0
Requires-Dist: yarl==1.17.2

# snotify

Lightweight notification manager with support for Telegram, email, and custom channels.

## Description

`snotify` is a library for managing notifications that allows sending messages through various channels such as Telegram, email, and custom channels. It supports a fallback mechanism that allows sending messages through alternative channels in case the primary one fails.

## Installation

Install the library using pip:

```bash
pip install snotify
```

## Usage Example

```python
from snotify import Notifier, TelegramChannel, EmailChannel

# Create an instance of Notifier
notifier = Notifier()

# Add a Telegram channel
telegram_channel = TelegramChannel(bot_token="your_bot_token", recipients=[...])
notifier.add_channel(telegram_channel, "telegram")

# Add an Email channel
email_channel = EmailChannel(
    smtp_server="smtp.example.com",
    smtp_port=587,
    smtp_user="your_user",
    smtp_password="your_password",
    recipients=[...]
)
notifier.add_channel(email_channel, "email")

# Send a notification
await notifier.send("Your message")
```

## Creating a Custom Channel

To create a custom channel, you need to extend the `BaseChannel` class and implement the `send` and `validate_config` methods. Here's a basic example:

```python
from snotify.channels.base import BaseChannel, BaseRecipient
import logging

class CustomChannel(BaseChannel):
    def __init__(self, custom_param, recipients):
        super().__init__(recipients)
        self.custom_param = custom_param

    async def send(self, message, recipients=None):
        logger = logging.getLogger(__name__)
        recipients_to_use = recipients if recipients is not None else self.recipients
        for recipient in recipients_to_use:
            # Implement your custom sending logic here
            logger.info(f"Sending message to {recipient.get_recipient_name()} via custom channel")

    def validate_config(self):
        if not self.custom_param:
            raise ValueError("Custom parameter is required")
```

## Features

- **Support for multiple channels**: Telegram, Email, and Custom channels.
- **Fallback mechanism**: ability to specify the order of channels for sending messages in case of failure.
- **Easy setup and use**.

## Requirements

- Python 3.7+
- aiohttp
- aiosmtplib

## License

MIT License. See the LICENSE file for details.
