novuhq / novu

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

🚀 Feature: Novu SDK For Flutter #3574

Open ShashankSMayya opened 1 year ago

ShashankSMayya commented 1 year ago

🔖 Feature description

Novu SDK for Flutter?

🎤 Why is this feature needed ?

Since Flutter is one of the trending framework for building apps, we would love to see the novu sdk for flutter framework.

✌️ How do you aim to achieve this?

I am really not sure what I can do from my end. We have a project where we are planning to create a notification center for user within the app. I have some ideas of opening a socket to our backend and listen for new notifications and update the ui in realtime but want to know are there any plans on getting novu sdk for flutter. If not any idea how can I implement the feature with sockets using novu?

🔄️ Additional Information

No response

👀 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?

None

michaldziuba03 commented 1 year ago

@ShashankSMayya I'm not into Flutter ecosystem but you may want to search some client library for socket.io (or eventually try to implement your own using regular WS client):

Widget flow:

  1. Client must initialize session with HTTP request

    POST 'https://api.novu.co/v1/widgets/session/initialize' 
    {
    "applicationIdentifier": "<APP ID>",
    "subscriberId": "<SUBSCRIBER ID>",
    "hmacHash": null
    }

    As response you will get JSON with data.token - you will need it to authorize ws connection

  2. After initialization you can init socket.io socket with query { "token": "token from previous step" }

  3. Now you can listen for events like:

    • unseen_count_changed
    • unread_count_changed
    • notification_received
  4. To get initial data (and historical as user for example scrolls) for notification center use HTTP calls:

    • GET https://api.novu.co/v1/widgets/notifications/feed?page=0 - for messages
    • GET https://api.novu.co/v1/widgets/notifications/unseen?limit=100 - for unseen number

      Use Bearer authorization with token obtained from first step

@scopsy Can you confirm how it works and eventually provide more details? (: I think we need better documentation for custom client-side flows.

scopsy commented 1 year ago

@michaldziuba03 this is exactly how it works, you nailed it! :)

flodaniel commented 4 months ago

Are there any more recent plans for a flutter client sdk? We are evaluating Novu vs Courier and it seems this is something that could be a big win for Courier at the moment.