Skip to content

Feature Request: Bearer Authentication Support for Private ntfy Topics #1

@ardasevinc

Description

@ardasevinc

Summary

I'd like to add support for bearer authentication to enable notifications to private ntfy topics. Currently, claude-code-ntfy only supports public topics, which limits its usefulness for users who want private/secure notifications.

Current Limitation

The current NtfyClient implementation only supports unauthenticated requests to public ntfy topics. Many users host private ntfy servers or use ntfy.sh's authentication features to secure their notification topics.

Proposed Solution

Add bearer authentication support by:

  1. Config support: Add ntfy_auth_token field to config (YAML + env var)
  2. Client updates: Update NtfyClient to accept and store auth tokens
  3. HTTP headers: Add Authorization: Bearer <token> header when token is provided
  4. Backward compatibility: Keep auth optional (empty token = no auth)

Implementation Details

# Example config.yaml
ntfy_topic: "private-topic"
ntfy_server: "https://ntfy.sh" 
ntfy_auth_token: "tk_your_token_here"  # New field
# Environment variable support
export CLAUDE_NOTIFY_AUTH_TOKEN="tk_your_token_here"

The implementation would follow ntfy's authentication documentation using bearer tokens.

Benefits

  • Enables use with private ntfy servers
  • Supports ntfy.sh's paid plans with authentication
  • Maintains security for sensitive notifications
  • Zero impact on existing public topic users

Request

I've implemented this feature locally and have it working with proper tests. The changes are minimal and maintain full backward compatibility. Would you be interested in a pull request for this feature?

The implementation includes:

  • ✅ Config loading (YAML + env vars)
  • ✅ Updated NtfyClient with auth support
  • ✅ Proper HTTP bearer authentication
  • ✅ Comprehensive tests
  • ✅ Updated documentation
  • ✅ Backward compatibility

Let me know if you'd like me to submit a PR!

Disclaimer: I made the changes with claude code and tested locally & with updated tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions