Support user consent preferences and spam-free inboxes
In any open and permissionless messaging ecosystem, spam is an inevitable reality, and XMTP is no exception.
However, with XMTP, you can give your users inboxes that are spam-free spaces for chosen contacts only by supporting user consent preferences.
To learn more, see Understand how user consent preferences enable spam-free inboxes.
Use the following methods to provide users with control over their messaging experience, ensuring their inboxes are tailored to their preferences and free from spam.
Get new consent records from the network - coming soon
Get the latest consent records from the network:
await alix.syncConsent()
Get the consent state of a conversation
Check the current consent state of a specific conversation:
await conversation.consentState()
Replaces V2 client.contact.isGroupAllowed(groupId)
Update the conversation consent state
Update the consent state of a conversation to allow or deny messages:
await conversation.updateConsent('allowed') // 'allowed' | 'denied'
Replaces V2 client.contact.allowGroups([groupIds])
Stream consent records in real-time - coming soon
Listen for real-time updates to consent records:
await alix.streamConsent()