Usage guide
Comments on tasks, records, and portals
One widget instance is one resource. A resource can hold many threads. The host record stays in your database. Comments stores the discussion, not the record itself.
Pick a stable tuple
- Task in a workspace:
tenantKeyis the workspace id,resourceTypeistask,resourceIdis the task id. The example uses tenantacmeandtask_1842. - CRM opportunity:
resourceTypeopportunityand the opportunity's opaque id. - Purchase order or inventory row: use the order id or SKU record id you already authorize.
- Client portal:
tenantKeyis the client account. Do not reuse another client's key. The example's second tenant isotherwith the sametask_1842string, and those discussions stay separate.
Single-tenant products still send a constant tenantKey. A page URL is not a resource id. Changing the record resets the widget: in-flight requests cancel, the stream closes, and the composer draft for the previous record stays isolated.
<Comments
user={{ id: session.user.id, name: session.user.name }}
scope={{
tenantKey: account.id,
resourceType: "purchase_order",
resourceId: order.id,
}}
adapter={adapter}
/>Your server must confirm this session may open order.id inside account.id before it lists or writes. The ids in the widget props are coordinates, not a grant. See resource authorization.
Related: Identity and tokens · Persisted BYO · Threads and updates