I'm trying to setup a demo where a user can get notification about what's going on in his workspace.
I've shaped this model with a notification feed of type notification
and a workspace feed of type flat
Both user and workspace are identified in the getstream world by their IDs
The user's notification feed follows his workspaces's workspace feed. Server side:
const client = stream.connect(apiKey, secret, appId)
const feed = client.feed('notification', userId).follow('workspace', workspaceId, (r, e) => console.log("result: ", r, "error: ", e))
Then in the app I want to subscribe to notification feed to get new notifications in realtime and also retrieve the last 5 notifications to show them in a dropdown (facebook style):
const streamClient = stream.connect(apiKey, token, appId)
notificationFeed = streamClient.feed('notification', userId)
subscription = notificationFeed.subscribe(handleNewEvents)
notificationFeed.get.get({mark_seen: true, limit: 5})
This last get Request is rising a 403 error:
{"detail":"You don't have permission to do this","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.10ms"}
what can be the reason?
did you see the tutorial on this? https://getstream.io/docs/#notification-system
Note Step 3 and creating the readonly token. Is that what's missing?