Skip to content

Feature request: Publish ntfy notification when someone posts a comment #344

Description

@xdpirate

Great app. I've been using Chyrp Lite for many years at this point, but I'm missing one feature, notifications for new comments. Every so often I will get a comment on my website, but miss it for weeks or months due to not being notified. Email notifications are enabled but I've never received an email from the site.

Would it be possible to add a feature to push a message to ntfy once a comment is posted? ntfy is a free pub-sub notification service that can be pushed to via http/s. You only need to define a ntfy topic (https://ntfy.sh/$ntfy_topic) then send a PUT/POST request to that URI, then clients that subscribe to that topic via web/desktop app/mobile app will receive the notification.

Once the comments module has posted a comment, it could do something like...

$userTopic = "my_awesome_topic"; // get from saved settings

if($ntfyEnabled) {
    file_get_contents("https://ntfy.sh/$userTopic", false, stream_context_create([
        'http' => [
            'method' => 'POST',
            'header' => "Content-Type: text/plain\r\n" .
            "Actions: view, View post, https://url/to/post",
            'content' => 'Somebody just commented on your post!'
        ]
    ]));
}

Documentation for publishing messages to ntfy: https://docs.ntfy.sh/publish/

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions