Skip to main content

catch ntfy message

Project description

ntfy_catch

A cron-driven ntfy topic watcher that polls messages and dispatches them to a customizable handler script with AI classification support.

Installation

pip install ntfy_catch

Quick Start

  1. Initialize configuration (creates ~/.config/ntfy_catch/ with example files):

    ntfy_catch --init-config
    
  2. Configure your setup:

    • Edit ~/.config/ntfy_catch/ntfy_catch.ini:
      • Set your ntfy server URL
      • Configure topics to monitor
    • Customize ~/.config/ntfy_catch/handler.py with your own message handling logic
  3. Set up AI classification (optional):

    • Get an API key from OpenRouter
    • Save it to ~/.openrouter.key or set OPENROUTER_API_KEY environment variable
  4. Run:

    ntfy_catch                  # Poll for new messages
    ntfy_catch --dry-run        # Test without executing handler
    ntfy_catch --topic alerts   # Poll specific topic only
    
  5. Automate with cron:

    */5 * * * * /usr/local/bin/ntfy_catch
    

Features

  • Poll multiple ntfy topics for new messages
  • Filter by priority and tags
  • Dispatch messages to custom handler script (receives JSON on stdin)
  • AI-powered message classification (CALENDAR, TASK, MEMO, OTHER)
  • State tracking to avoid reprocessing messages
  • Configurable timeouts and error handling

Configuration

Config file location: ~/.config/ntfy_catch/ntfy_catch.ini

Key settings:

  • [server] base_url: Your ntfy server URL
  • [polling] topics: Comma-separated list of topics
  • [actions] handler_script: Path to your handler script
  • [filters] min_priority: Minimum priority level (1-5)

See ~/.config/ntfy_catch/ntfy_catch.ini (created by --init-config) for full documentation.

Handler Script

The handler receives message JSON on stdin and should exit with:

  • 0: Success (message marked as processed)
  • non-zero: Failure (message will be reprocessed on next run)

Customize ~/.config/ntfy_catch/handler.py to implement your own actions based on message content, tags, priority, etc.

Development

git clone <repo>
cd ntfy_catch
uv venv
source .venv/bin/activate
uv pip install -e .

License

See LICENSE file.

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

ntfy_catch-0.2.2.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

ntfy_catch-0.2.2-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file ntfy_catch-0.2.2.tar.gz.

File metadata

  • Download URL: ntfy_catch-0.2.2.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for ntfy_catch-0.2.2.tar.gz
Algorithm Hash digest
SHA256 7b70fb69ebb14e3d9e698f73ad7d7f97297c45dd130be1fd1497f6e2ffbae21e
MD5 14eb708cfeed467720792f4bb760a2d9
BLAKE2b-256 4ad9f325bf99c463fd195e3f4e1b84385ea4b811ca3d8cfbb61075b35d65ecc1

See more details on using hashes here.

File details

Details for the file ntfy_catch-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ntfy_catch-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c6c821ed6b786379ce1cb128567ba8f6899b3403b08badfac550b432f37a89cd
MD5 5f9e3c14f6d2eaa32bd13e933849cd1d
BLAKE2b-256 049fb13a39a9ee16cac0c816aa1edc9a15d03afab891b3d982c505e2c0aae106

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