Skip to main content

Command-line interface for Notifer notification service

Project description

Notifer CLI

Command-line interface for Notifer - simple HTTP-based pub-sub notification service.

Installation

pip install notifer-cli

Or install from source:

git clone https://github.com/notifer/notifer.git
cd notifer/cli
pip install -e .

Quick Start

1. Configure API endpoint

# Create config file
notifer config init

# For production (Notifer cloud)
notifer config set server https://api.notifer.io

# For local development
notifer config set server http://localhost:8080

2. Publish a message

# Simple message
notifer publish my-topic "Hello World!"

# With title and priority
notifer publish alerts "Server is down!" \
  --title "Alert" \
  --priority 5 \
  --tags urgent,server

# With markdown
notifer publish deployments "# Deploy Success\n\n**Status**: ✅" \
  --priority 4

3. Subscribe to messages

# Subscribe and print to console
notifer subscribe my-topic

# Subscribe to multiple topics
notifer subscribe alerts,deployments

# Save to file
notifer subscribe my-topic --output messages.jsonl

Authentication

Using API Keys (Recommended)

# Create API key via web UI or:
notifer keys create "CI/CD Pipeline" \
  --scopes publish,topics:read \
  --email user@example.com \
  --password yourpassword

# Use API key for publishing
notifer publish my-topic "Message" --api-key noti_abc123...

# Or save in config
notifer config set api-key noti_abc123...

Using Email/Password

# Login (stores token in ~/.notifer.yaml)
notifer login user@example.com

# Publish with stored credentials
notifer publish my-topic "Message"

Commands

Publishing

notifer publish <topic> <message> [OPTIONS]

Options:
  --title TEXT          Message title
  --priority INTEGER    Priority (1-5, default: 3)
  --tags TEXT           Comma-separated tags
  --api-key TEXT        API key for authentication
  --server TEXT         Override server URL

Subscribing

notifer subscribe <topics> [OPTIONS]

Options:
  --output PATH         Save messages to file (JSONL format)
  --since TEXT          Only show messages since timestamp
  --api-key TEXT        API key for authentication
  --json                Output raw JSON (no formatting)

API Keys Management

# List API keys
notifer keys list

# Create new key
notifer keys create <name> [OPTIONS]

Options:
  --scopes TEXT         Comma-separated scopes (default: *)
  --description TEXT    Key description
  --expires TEXT        Expiration date (ISO format)

# Revoke key
notifer keys revoke <key-id>

# Delete key
notifer keys delete <key-id>

Topics Management

# List topics
notifer topics list

# List your topics
notifer topics list --mine

# Create topic
notifer topics create <name> [OPTIONS]

Options:
  --description TEXT    Topic description
  --private            Make topic private
  --discoverable       Make discoverable in browse

# Get topic info
notifer topics get <name>

# Delete topic
notifer topics delete <name>

Configuration

# Initialize config file
notifer config init

# Show current config
notifer config show

# Set config value
notifer config set <key> <value>

# Examples:
notifer config set server https://api.notifer.io  # Production
notifer config set server http://localhost:8080    # Local dev
notifer config set api-key noti_abc123...

Configuration File

The CLI uses ~/.notifer.yaml for configuration:

# Server settings
server: https://api.notifer.io  # Production (or http://localhost:8080 for local dev)

# Authentication (choose one)
api_key: noti_abc123...

# OR email/password (stores JWT token)
email: user@example.com
access_token: eyJhbG...
refresh_token: eyJhbG...

# Default options
defaults:
  priority: 3
  tags: []

Examples

CI/CD Integration

#!/bin/bash
# deploy.sh

# Create API key with publish scope
API_KEY="noti_abc123..."

# Notify on deploy start
notifer publish deployments "Deploy started for v1.2.3" \
  --title "Deploy" \
  --priority 3 \
  --tags deployment,production \
  --api-key "$API_KEY"

# Run deployment
./deploy-script.sh

# Notify on success/failure
if [ $? -eq 0 ]; then
  notifer publish deployments "# Deploy Success\n\nVersion **v1.2.3** deployed!" \
    --priority 4 \
    --tags deployment,success \
    --api-key "$API_KEY"
else
  notifer publish deployments "Deploy failed!" \
    --priority 5 \
    --tags deployment,failure \
    --api-key "$API_KEY"
fi

Monitoring Script

#!/bin/bash
# monitor.sh

# Subscribe to alerts and log to file
notifer subscribe alerts,errors \
  --output /var/log/notifer-alerts.jsonl \
  --api-key noti_abc123...

GitHub Actions

name: Deploy
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Install Notifer CLI
        run: pip install notifer-cli

      - name: Notify deploy start
        run: |
          notifer publish deployments "Deploy started: ${{ github.sha }}" \
            --api-key ${{ secrets.NOTIFER_API_KEY }}

      - name: Deploy
        run: ./deploy.sh

      - name: Notify success
        if: success()
        run: |
          notifer publish deployments "Deploy successful!" \
            --priority 4 \
            --api-key ${{ secrets.NOTIFER_API_KEY }}

      - name: Notify failure
        if: failure()
        run: |
          notifer publish deployments "Deploy failed!" \
            --priority 5 \
            --api-key ${{ secrets.NOTIFER_API_KEY }}

License

MIT

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

notifer_cli-1.0.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

notifer_cli-1.0.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file notifer_cli-1.0.0.tar.gz.

File metadata

  • Download URL: notifer_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for notifer_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 382f198e9e6305fec3b3fba2d7c84fb9a21d0c09ba25295c7a44e2c41a19cd07
MD5 97d082feaa3ac866abc7dbec73297a6d
BLAKE2b-256 bced2f930f25ae572e3a64b40008825bdcb3cbad308875e31aa6d1b7d67d4925

See more details on using hashes here.

File details

Details for the file notifer_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: notifer_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for notifer_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 540475b0887f6a99986138dddffe989f57224658a5af896f0313fa23e3082ac8
MD5 efee16952efd7700d1cf3f8e9772a0aa
BLAKE2b-256 d502bc5da9d125cb7ba025a1aa07d263e15fd6410dea8807d2fe527a67454e6c

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