or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

assets.mdattachments.mdconfiguration.mdcore-notifications.mdindex.mdlocalization.mdplugin-system.mdstorage.md
tile.json

core-notifications.mddocs/

Core Notification Management

Primary notification functionality including service management, message sending, and notification orchestration. The Apprise class serves as the main entry point for all notification operations, managing multiple notification services and providing both synchronous and asynchronous notification delivery.

Capabilities

Apprise Class

The main orchestrator class that manages notification services and handles message delivery to multiple platforms simultaneously.

class Apprise:
    def __init__(self, servers=None, asset=None, location=None, debug=False):
        """
        Initialize Apprise notification manager.
        
        Parameters:
        - servers (str|list, optional): Notification service URLs or objects to add
        - asset (AppriseAsset, optional): Custom asset configuration
        - location (str, optional): Default location for relative paths
        - debug (bool): Enable debug logging
        """

    def add(self, urls, asset=None, tag=None):
        """
        Add notification service(s) to the manager.
        
        Parameters:
        - urls (str|list): Service URL(s) or notification service objects
        - asset (AppriseAsset, optional): Asset configuration for services
        - tag (str|list, optional): Tags to assign to services
        
        Returns:
        bool: True if at least one service was successfully added
        """

    def notify(self, body, title='', notify_type=NotifyType.INFO, body_format=None, tag=None, match_always=True, attach=None, interpret_escapes=None):
        """
        Send notification to all configured services.
        
        Parameters:
        - body (str): Notification message content
        - title (str, optional): Notification title
        - notify_type (NotifyType): Type of notification (INFO, SUCCESS, WARNING, FAILURE)
        - body_format (NotifyFormat, optional): Message format (TEXT, HTML, MARKDOWN)
        - tag (str|list, optional): Send only to services with matching tags
        - attach (AppriseAttachment|str|list, optional): File attachments
        
        Returns:
        bool: True if notification was sent to at least one service
        """

    def async_notify(self, *args, **kwargs):
        """
        Asynchronous version of notify() method.
        
        Parameters: Same as notify()
        
        Returns:
        bool: True if notification was sent to at least one service
        """

    def clear(self):
        """
        Remove all notification services from the manager.
        """

    def find(self, tag=None, match_always=True):
        """
        Find notification services by tag.
        
        Parameters:
        - tag (str, optional): Tag to search for
        - match_always (bool): Include services without tags
        
        Returns:
        list: List of matching notification service objects
        """

    def pop(self, index):
        """
        Remove and return notification service by index.
        
        Parameters:
        - index (int): Index of service to remove
        
        Returns:
        NotifyBase: Removed notification service object
        """

    def details(self, show_requirements=True, show_disabled=False, lang=None):
        """
        Get detailed information about available notification services.
        
        Parameters:
        - show_requirements (bool): Include dependency requirements
        - show_disabled (bool): Include disabled services
        - lang (str, optional): Language for localized service names
        
        Returns:
        dict: Service details and capabilities
        """

    def urls(self, privacy=False):
        """
        Get URLs for all configured notification services.
        
        Parameters:
        - privacy (bool): Mask sensitive information in URLs
        
        Returns:
        list: List of service URLs
        """

    @staticmethod
    def instantiate(url, asset=None, tag=None, suppress_exceptions=True):
        """
        Create notification service instance from URL.
        
        Parameters:
        - url (str): Service URL to instantiate
        - asset (AppriseAsset, optional): Asset configuration
        - tag (str|list, optional): Tags to assign
        - cache (bool, optional): Enable caching
        
        Returns:
        NotifyBase: Notification service instance or None if failed
        """

Usage Examples

Basic Notification Setup

import apprise

# Create Apprise instance
apobj = apprise.Apprise()

# Add multiple services
apobj.add([
    'mailto://user:pass@gmail.com',
    'slack://TokenA/TokenB/TokenC/Channel',
    'discord://webhook_id/webhook_token'
])

# Send notification to all services
success = apobj.notify(
    body='System backup completed successfully',
    title='Backup Status',
    notify_type=apprise.NotifyType.SUCCESS
)

if success:
    print("Notification sent successfully")
else:
    print("Failed to send notification")

Initialization with Services

import apprise

# Create Apprise instance with services in constructor
apobj = apprise.Apprise([
    'mailto://user:pass@gmail.com',
    'slack://TokenA/TokenB/TokenC/Channel',
    'discord://webhook_id/webhook_token'
])

# Services are already loaded, ready to send
success = apobj.notify(
    body='Services loaded during initialization',
    title='Initialization Complete'
)

Tagged Service Management

import apprise

apobj = apprise.Apprise()

# Add services with tags
apobj.add('mailto://admin@company.com', tag='admin')
apobj.add('slack://token/channel', tag=['team', 'alerts'])
apobj.add('discord://webhook', tag='alerts')

# Send to specific tagged services
apobj.notify(
    body='Critical system alert',
    title='System Alert',
    notify_type=apprise.NotifyType.FAILURE,
    tag='alerts'  # Only sends to slack and discord
)

# Send to admin only
apobj.notify(
    body='Daily report ready',
    title='Report Available', 
    tag='admin'  # Only sends to email
)

Asynchronous Notifications

import apprise
import asyncio

async def send_notifications():
    apobj = apprise.Apprise()
    apobj.add([
        'mailto://user@gmail.com',
        'slack://token/channel'
    ])
    
    # Async notification sending
    success = await apobj.async_notify(
        body='Async notification test',
        title='Async Test'
    )
    
    return success

# Run async notification
result = asyncio.run(send_notifications())

Service Management

import apprise

apobj = apprise.Apprise()
apobj.add([
    'mailto://user@gmail.com',
    'slack://token/channel',
    'discord://webhook'
])

# Check configured services
print(f"Total services: {len(apobj.servers)}")
print(f"Available tags: {apobj.tags}")

# Get service URLs (with privacy masking)
urls = apobj.urls(privacy=True)
for url in urls:
    print(f"Service URL: {url}")

# Find services by tag
admin_services = apobj.find('admin')
print(f"Admin services: {len(admin_services)}")

# Remove a service
if apobj.servers:
    removed = apobj.pop(0)
    print(f"Removed service: {removed.service_name}")

# Clear all services
apobj.clear()
print(f"Services after clear: {len(apobj.servers)}")

Service Details and Capabilities

import apprise

# Get detailed service information
details = apprise.Apprise().details(
    show_requirements=True,
    show_disabled=False
)

# Print available services and their capabilities
for service_name, info in details.items():
    print(f"Service: {service_name}")
    print(f"  Description: {info.get('service_name', 'N/A')}")
    print(f"  Protocols: {info.get('protocols', [])}")
    print(f"  Requirements: {info.get('requirements', [])}")
    print()