{"id":6012,"library":"notifiers","title":"Notifiers","description":"Notifiers is a Python library that provides a unified and simple interface for sending notifications through various providers like Pushover, Slack, Email, and Telegram. It aims to simplify the process of integrating notifications into applications and scripts without needing to implement individual provider APIs. The current version is 1.3.6, with releases occurring periodically, focusing on new provider additions, bug fixes, and maintenance.","status":"active","version":"1.3.6","language":"en","source_language":"en","source_url":"https://github.com/liiight/notifiers","tags":["notifications","messaging","alerts","integrations"],"install":[{"cmd":"pip install notifiers","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for making HTTP requests to notification provider APIs.","package":"requests"},{"reason":"Used for validating notification data against provider-specific schemas.","package":"jsonschema"},{"reason":"Used for the command-line interface (CLI) functionality.","package":"click"},{"reason":"Added in v1.3.6, likely for improved metadata introspection. [cite: 0.6.4 release notes]","package":"importlib_metadata"}],"imports":[{"note":"This is the primary and recommended way to instantiate a notifier for a specific provider.","symbol":"get_notifier","correct":"from notifiers import get_notifier"},{"note":"Use this function for a quick one-off notification without needing to explicitly get a provider object first.","symbol":"notify","correct":"from notifiers import notify"},{"note":"While direct provider imports are possible, they must come from the `notifiers.providers` submodule. Using `get_notifier` is generally easier.","wrong":"from notifiers.pushover import Pushover","symbol":"Pushover","correct":"from notifiers.providers.pushover import Pushover"}],"quickstart":{"code":"import os\nfrom notifiers import get_notifier\n\npushover_token = os.environ.get('NOTIFIERS_PUSHOVER_TOKEN', 'YOUR_PUSHOVER_API_TOKEN')\npushover_user = os.environ.get('NOTIFIERS_PUSHOVER_USER', 'YOUR_PUSHOVER_USER_KEY')\n\nif pushover_token and pushover_user:\n    pushover = get_notifier('pushover')\n    try:\n        # Ensure required parameters are provided. Check pushover.required or pushover.schema\n        # for details. Using raise_on_errors=True for explicit error handling.\n        response = pushover.notify(\n            token=pushover_token,\n            user=pushover_user,\n            message='Hello from notifiers!',\n            title='Python Notification',\n            raise_on_errors=True\n        )\n        if response.status == 'success':\n            print(f\"Pushover notification sent successfully: {response.data}\")\n        else:\n            print(f\"Pushover notification failed: {response.errors}\")\n    except Exception as e:\n        print(f\"An error occurred while sending notification: {e}\")\nelse:\n    print(\"Pushover API token and user key not set. Please set NOTIFIERS_PUSHOVER_TOKEN and NOTIFIERS_PUSHOVER_USER environment variables or hardcode them.\")\n","lang":"python","description":"This quickstart demonstrates how to send a notification using the 'pushover' provider. It fetches credentials from environment variables (or placeholders) and uses the `get_notifier` function. It also explicitly sets `raise_on_errors=True` for robust error handling."},"warnings":[{"fix":"Migrate to a different notification provider supported by Notifiers (e.g., Slack, Telegram) and update your code accordingly. Consider using version <1.3.0 if HipChat support is critical and migration is not feasible.","message":"The HipChat notification provider was removed in version 1.3.0. Users relying on HipChat must migrate to another provider or downgrade to an earlier version. [cite: 0.6.4 release notes, 1.3.0 release notes]","severity":"breaking","affected_versions":">=1.3.0"},{"fix":"Review the documentation for your specific provider and CLI usage. Ensure all required arguments are passed to resource calls and adapt CLI commands to the new option-based syntax. For Python API, `get_notifier` remains the entry point, but subsequent calls to provider-specific resources might require additional arguments.","message":"Version 0.6.4 introduced a 'Major refactor' of provider resources and a significant overhaul of the CLI. This changed how provider-specific resources (like `telegram.updates()`) are accessed and often introduced new validation requirements (e.g., needing a `token` for resource calls). The CLI syntax also fundamentally changed from `keyword=value` to standard command options. [cite: 13, 0.6.4 release notes]","severity":"breaking","affected_versions":">=0.6.4"},{"fix":"Always check the `notifier.required` or `notifier.schema` properties for a given provider to understand the expected arguments and their types. Ensure all mandatory parameters are passed to the `notify` method.","message":"Notifiers uses JSON Schema for provider validation. If required parameters are missing or invalid, a `notifiers.exceptions.BadArguments` exception will be raised. Each provider has its own schema, which can be inspected via `notifier.schema` or `notifier.required`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For reliable error handling, always use `raise_on_errors=True` in your `notify()` calls or explicitly check `response.ok` and `response.errors` after sending a notification.","message":"By default, the `NotificationResponse` object returned by `notify()` methods does *not* raise an exception on API errors from the notification provider. To explicitly catch errors, you must either call `response.raise_on_errors()` or pass `raise_on_errors=True` to the `notify()` method.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}