Tenant scoping for in-app messaging
Learn how to use tenants to scope in-app feeds so users only see notifications relevant to their active workspace.
When your users belong to multiple workspaces or organizations, you'll want their in-app feed to only show notifications relevant to their currently active workspace. You can do this by associating workflow runs with a tenant and passing that tenant when initializing the feed.
How it works
#Pass a tenant identifier in your workflow trigger call. The tenant does not need to be configured beforehand — any unique string you use to identify the workspace will work.
When retrieving the feed, pass the same tenant identifier so Knock scopes the feed to only show messages associated with that tenant:
Knock will ensure that badge counts are scoped to the active workspace, and that real-time notifications are not received for messages belonging to other tenants.
Example
#Imagine a SaaS application, Collaborato, where users belong to one or more workspaces. When a user is active in the "Acme Fish Co." workspace, they should only see notifications relevant to that workspace.
By passing tenant: "acme-fish-co" in both the workflow trigger and the feed initialization, Knock will filter all feed requests and real-time events to that tenant — even if the same user has notifications from other workspaces.