Search code examples
javascriptgetstream-io

Send Notifications using target feeds with getstream.io


I've been working with getstream.io for a while and currently I'm facing an issue with the notifications.

To start using notifications I thought it was easier to implement in reactions due to having the targetFeeds property, but I'm facing an access error. I'm trying achieve it doing the next.

UserA commenting in UserB publication

// Client is initialized with UserA info

const comment = await client.reactions.add('comment', activity.id, { data }, { targetFeeds: [`notifications:UserB.ID`] });

My question is how to send a notification to UserB notification feed.

The result I expect is userB receiving a notification like "userA has commented in your publication" or alike.


Solution

  • The issue as first pointed by Sanchaz was that I was using notifications as slug for the notification feed instead of notification, I thought that wasn't the case because I created the notification feed with notifications slug.

    StreamIO support stated that if the notification feed doesn't match notification slug, the default permissions doesn't apply, therefore the solution was to rename the slug from notifications to notification.