novuhq / novu

Open-Source Notification Platform. Embeddable Notification Center, E-mail, Push and Slack Integrations.
https://novu.co
Other
34.46k stars 3.51k forks source link

πŸš€ Feature: Pushpad provider for web push notifications #4218

Closed collimarco closed 10 months ago

collimarco commented 11 months ago

πŸ”– Feature description

It would be nice to have Pushpad as a provider for web push notifications (it is one of the main providers for web push and we are also the maintainers of Ruby web-push).

🎀 Why is this feature needed ?

An integration is needed to send web push notifications from Novu to the browser using Pushpad.

Pushpad notifications are delivered even when the website is closed, because Pushpad uses the Push API standard.

✌️ How do you aim to achieve this?

Add a Pushpad provider for "push" messages.

πŸ”„οΈ Additional Information

Sending a notification to Pushpad is a simple POST request:

curl -X POST 'https://pushpad.xyz/api/v1/projects/PROJECT_ID/notifications' \
  -H 'Authorization: Token token="AUTH_TOKEN"' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
    "notification": {
      "title": "Web Notification Example",
      "body": "Hello world!",
      "target_url": "https://example.com"
    }
  }'

The above code will send a broadcast notification to all the subscribers of a website.

You can also target specific users by listing them:

curl -X POST 'https://pushpad.xyz/api/v1/projects/PROJECT_ID/notifications' \
  -H 'Authorization: Token token="AUTH_TOKEN"' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
    "notification": {
      "title": "Web Notification Example",
      "body": "Hello world!",
      "target_url": "https://example.com"
    },
    "uids": ["userID1", "userID2"]
  }'

I am new to Novu, but this should be enough to send a web push notification using Pushpad.

If someone with deeper understanding of the Novu architecture could draft a pull request, I can definitely provide help and answers for the Pushpad side.

πŸ‘€ Have you spent some time to check if this feature request has been raised before?

🏒 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes (see below)

collimarco commented 11 months ago

I found these useful resources:

So I have created a pull request:

https://github.com/novuhq/novu/pull/4235

Can someone from the core team review the pull request and merge it?

collimarco commented 10 months ago

Now that the Pushpad provider is available in Novu, I have published this tutorial (Novu + Pushpad integration for web push):

https://pushpad.xyz/blog/sending-web-push-notifications-from-novu-notification-center