For AI agents: Find a documentation index at https://talkjs.com/llms.txt (full content at https://talkjs.com/llms-full.txt). Get a markdown version of any page by appending .md to its URL path.

Controlling content masking

Vary masking rules for each participant.

View as Markdown

Content masking normally follows a user's role. To apply different masking rules for a specific participant in a specific conversation, set takeSettingsFromRole.contentMasking to the name of another role using the JavaScript Data API or REST API.

Configure that role's masking rules in the dashboard. The override controls what the participant sees, including existing messages. Other settings still come from their usual role. Set contentMasking to null to restore that role's masking rules.

Example: reveal contact details after a transaction

In a marketplace app, you might want to mask contact details by default, but let the buyer and seller see them after a transaction.

In the dashboard, go to Chat UI → Edit roles → Create role and create a new role named no_masking. In that role's Chat UI settings, under Mask unwanted content, set Mode to No suppression. Publish the role to live when using your live app ID.

Then, update the buyer's participation:

1curl https://api.talkjs.com/v1/<APP_ID>/conversations/order_391_fc/participants/betty_buyer \
2 -H "Authorization: Bearer <YOUR_TOKEN>" \
3 -H "Content-Type: application/json" \
4 -X PATCH \
5 -d '{ "takeSettingsFromRole": { "contentMasking": "no_masking" } }'

Repeat for the seller and any other participants who should see unmasked content.