Chat requests overview
You can send a message using chat.send API to either an existing chat connection or to initiate a new chat to a wallet you haven't chatted with before (which is called sending a chat request).
Any chat from a push user who is not your connection already to your wallet lands in your chat requests and you will need to accept, reject or block them accordingly. This enables a seamless UX and eliminates spam problems with chat.
Accept chat requests API
To accept an incoming chat requests. Need to be done only once per chat request. Once chat request is accepted, the chat connection is marked as active and any chat you receive moving forward will also send push notifications driving re-engagement to your app.
- js
// userAlice.chat.accept(recipient)
// recipient - Can be wallet address, nft address or chatid | See Types of Recipient for more info
const bobAcceptAliceRequest = await userBob.chat.accept(aliceAddress);
Accept chat request parameters
Param | Type | Default | Remarks |
---|---|---|---|
recipient | string | - | Recipient supports a number of address format including wallet addresses, chain agnostic wallet addresses, NFT addresses or even chatid which is useful for groups |
Note: Parameters
in this style
are mandatory.
Expected response
Reject chat request API
To reject an incoming chat request. Once rejected, the user can still send you a message that will land in your chat request again.
- js
// userAlice.chat.reject(recipient)
// recipient - Can be wallet address, nft address or chatid | See Types of Recipient for more info
const bobAcceptAliceRequest = await userBob.chat.reject(aliceAddress);
Reject chat request parameters
Param | Type | Default | Remarks |
---|---|---|---|
recipient | string | - | Recipient supports a number of address format including wallet addresses, chain agnostic wallet addresses, NFT addresses or even chatid which is useful for groups |
Note: Parameters
in this style
are mandatory.
Expected response
Block chat request API
To block an incoming chat requests. Once blocked, the user will not be able to send you DMs or invite you to a group.
- js
// userAlice.chat.block(recipient)
// recipient - Can be wallet address, nft address or chatid | See Types of Recipient for more info
const bobAcceptAliceRequest = await userBob.chat.block(aliceAddress);
Block chat request parameters
Param | Type | Default | Remarks |
---|---|---|---|
recipient | string | - | Recipient supports a number of address format including wallet addresses, chain agnostic wallet addresses, NFT addresses or even chatid which is useful for groups |
Note: Parameters
in this style
are mandatory.