Version: 1.0.0

Users - Notifications

Potion's APIs will automatically generate notifications for each one of your users according to the activities around them.


Summary

Potion will generate for you, notifications, according to what a user do on your community. Comment, like or create a status will trigger notifications to all the concerned users. It is 100% automatic, you have nothing to worry about.

Retrieve notifications

To get a user's notifications, simply perform a HTTP GET, you will receive an array as a response. The array will be empty if the user has no notifications.

Make sure to give your ApiTokenAPI and ApiSecretAPI as header in the HTTP request

curl -X GET \
https://YOUR_PROJECT_DOMAIN.potion.social/public-api/v1/users/USER_ID/notifications \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \

Notifications response

If a user has notifications, the answer will looks like this :

[
...
{
id: "e39a5464c84a4f2493eb14adc2caf3cb"
user_id: 298
seen: true
created_at: "2019-12-27T09:50:58.000+01:00"
updated_at: "2020-01-02T16:18:42.000+01:00"
action_name: "add a picture to your profil"
target_name: null
picture_url: null
link_type: "edit-profile"
link_id: null
notification_type: "simple"
subject_id: null
subject_type: null
subject_slug: null
link_slug: null
target_type: null
target_id: null
target_slug: null
final_target_type: null
final_target_id: null
comment_info: {}
subject_name: "JohnDoe"
final_target_name: ""
permissions: []
}
...
]

You can have more details about each key meaning in the User's notification referenceAPI.

Retrieve only unread notifications

You may just want to retrieve unread notifications, simply perform a HTTP GET, you will receive an array as a response. The array will be empty if the user has no notifications.

Make sure to give your ApiTokenAPI and ApiSecretAPI as header in the HTTP request

curl -X GET \
https://YOUR_PROJECT_DOMAIN.potion.social/public-api/v1/users/USER_ID/notifications?status=unseen \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \

Mark a user's notification as read

You have to manually trigger the read action for your users's notifications, we cannot yet mark a specific notification as read but we provide a way to mark them all.

To perform this action, simply make a HTTP PUT request, you can give an array of notification_ids if you want to mark only some notifications as read and not all unseen.

curl -X PUT \
https://YOUR_PROJECT_DOMAIN.potion.social/public-api/v1/users/USER_ID/set_notifications_seen \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \