Skip to main content

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. Only called 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.

// 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

ParamTypeDefaultRemarks
recipientstring-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
200 OK

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.

// 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

ParamTypeDefaultRemarks
recipientstring-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
200 OK

Chat Info API

Chat Info API can be used to get the status of a chat between users, basically to check if a chat request is pending or if it has been accepted by the other user.

// To check the status of a chat between userAlice and userBob
// userAlice.chat.info(chatId, bobAddress)
const statusOfChatWithBob = await userAlice.chat.info(chatId, bobAddress);

Chat Info parameters

ParamTypeDefaultRemarks
chatIdstring-The unique identifier of the chat between Alice and Bob
addressstring-The address of the user to check the status with.

Note: Parameters in this style are mandatory.

Expected response (When Alice's chat request has already been accepted by Bob)
{
"meta": {
"group": false
},
"list": "CHATS"
}

ParamTypeRemarks
meta.groupbooleanreturns true when the passed chatId is of a group chat and vice versa.
liststringreturns CHATS when the chat request has been accepted by the other user.
Expected response (When Alice's Chat request is pending or not yet accepted by Bob)
{
"meta": {
"group": false
},
"list": "REQUESTS"
}

ParamTypeRemarks
meta.groupbooleanreturns true when the passed chatId is of a group chat and vice versa.
liststringreturns REQUESTS when the chat request has been accepted by the other user.

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.

// userAlice.chat.block([recipient])
// recipient - Can be wallet address, nft address or chatid | See Types of Recipient for more info
const bobBlockAliceRequest = await userBob.chat.block([aliceAddress]);

Block chat request parameters

ParamTypeDefaultRemarks
recipientstring[]-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
{
"did": "eip155:0xE95d1c080E72021d94Ef247d86897766C5807A98",
"wallets": "eip155:0xE95d1c080E72021d94Ef247d86897766C5807A98",
"publicKey": "-----BEGIN PGP PUBLIC KEY BLOCK-----...-----END PGP PUBLIC KEY BLOCK-----\n",
"encryptedPrivateKey": "{...}",
"verificationProof": "eip191v2:0x6f5fa197aaf6760ec7479b0512756224b57c7ff431c2f2c086e0730d30c4dec429615b619f4509cbcf36874ed507bc40161266eabe7d8516962199565309bc811b",
"msgSent": 0,
"maxMsgPersisted": 1000,
"profile": {
"name": null,
"desc": null,
"picture": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1klEQVR4AcXBsWkDMRiG4TcfApVe4UDFDaAN3NwuHuh2SXNNag3gQuAVXAUVIWl/uxAYB77n+fj6/vklKG0Q7fcb77icFqJeM5EwE2bCTJgJM2EmzBJPes1EGyvR53FlZjuvRJ05YSbMhFniSWmDaL/fiC6nhZn9uBJdTgtRr5lImAkzYZZKG0S9Zh4cPOg1M3XwoNdMVNogEmbCTJilXjMz23klKm0ws51XZnrNRMJMmAmzVNrgP5U2eIUwE2bCLPWaiUobRL1m3lHaIOo1EwkzYSbM/gDz9DEdwejLXwAAAABJRU5ErkJggg==",
"blockedUsersList": [ "eip155:0x4Fc0F35B0ab1201ae9F8F8f589bea01f556022dF" ],
"profileVerificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----...-----END PGP SIGNATURE-----\n"
},
"origin": null,
"name": null,
"about": null,
"profilePicture": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1klEQVR4AcXBsWkDMRiG4TcfApVe4UDFDaAN3NwuHuh2SXNNag3gQuAVXAUVIWl/uxAYB77n+fj6/vklKG0Q7fcb77icFqJeM5EwE2bCTJgJM2EmzBJPes1EGyvR53FlZjuvRJ05YSbMhFniSWmDaL/fiC6nhZn9uBJdTgtRr5lImAkzYZZKG0S9Zh4cPOg1M3XwoNdMVNogEmbCTJilXjMz23klKm0ws51XZnrNRMJMmAmzVNrgP5U2eIUwE2bCLPWaiUobRL1m3lHaIOo1EwkzYSbM/gDz9DEdwejLXwAAAABJRU5ErkJggg==",
"numMsg": 0,
"allowedNumMsg": 1000,
"encryptionType": "eip191-aes256-gcm-hkdf-sha256",
"signature": "0x6f5fa197aaf6760ec7479b0512756224b57c7ff431c2f2c086e0730d30c4dec429615b619f4509cbcf36874ed507bc40161266eabe7d8516962199565309bc811b",
"sigType": "eip191v2",
"encryptedPassword": null,
"nftOwner": null,
"linkedListHash": null,
"nfts": null
}

Unblock a user API

To unblock an user.

// userAlice.chat.unblock([recipient])
// recipient - Can be wallet address, nft address or chatid | See Types of Recipient for more info
const bobUnblockAlice = await userBob.chat.unblock([aliceAddress]);

Unblock a user parameters

ParamTypeDefaultRemarks
recipientstring[]-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
{
"did": "eip155:0xE95d1c080E72021d94Ef247d86897766C5807A98",
"wallets": "eip155:0xE95d1c080E72021d94Ef247d86897766C5807A98",
"publicKey": "-----BEGIN PGP PUBLIC KEY BLOCK-----...-----END PGP PUBLIC KEY BLOCK-----\n",
"encryptedPrivateKey": "{...}",
"verificationProof": "eip191v2:0x6f5fa197aaf6760ec7479b0512756224b57c7ff431c2f2c086e0730d30c4dec429615b619f4509cbcf36874ed507bc40161266eabe7d8516962199565309bc811b",
"msgSent": 0,
"maxMsgPersisted": 1000,
"profile": {
"name": null,
"desc": null,
"picture": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1klEQVR4AcXBsWkDMRiG4TcfApVe4UDFDaAN3NwuHuh2SXNNag3gQuAVXAUVIWl/uxAYB77n+fj6/vklKG0Q7fcb77icFqJeM5EwE2bCTJgJM2EmzBJPes1EGyvR53FlZjuvRJ05YSbMhFniSWmDaL/fiC6nhZn9uBJdTgtRr5lImAkzYZZKG0S9Zh4cPOg1M3XwoNdMVNogEmbCTJilXjMz23klKm0ws51XZnrNRMJMmAmzVNrgP5U2eIUwE2bCLPWaiUobRL1m3lHaIOo1EwkzYSbM/gDz9DEdwejLXwAAAABJRU5ErkJggg==",
"blockedUsersList": [],
"profileVerificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----...-----END PGP SIGNATURE-----\n"
},
"origin": null,
"name": null,
"about": null,
"profilePicture": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1klEQVR4AcXBsWkDMRiG4TcfApVe4UDFDaAN3NwuHuh2SXNNag3gQuAVXAUVIWl/uxAYB77n+fj6/vklKG0Q7fcb77icFqJeM5EwE2bCTJgJM2EmzBJPes1EGyvR53FlZjuvRJ05YSbMhFniSWmDaL/fiC6nhZn9uBJdTgtRr5lImAkzYZZKG0S9Zh4cPOg1M3XwoNdMVNogEmbCTJilXjMz23klKm0ws51XZnrNRMJMmAmzVNrgP5U2eIUwE2bCLPWaiUobRL1m3lHaIOo1EwkzYSbM/gDz9DEdwejLXwAAAABJRU5ErkJggg==",
"numMsg": 0,
"allowedNumMsg": 1000,
"encryptionType": "eip191-aes256-gcm-hkdf-sha256",
"signature": "0x6f5fa197aaf6760ec7479b0512756224b57c7ff431c2f2c086e0730d30c4dec429615b619f4509cbcf36874ed507bc40161266eabe7d8516962199565309bc811b",
"sigType": "eip191v2",
"encryptedPassword": null,
"nftOwner": null,
"linkedListHash": null,
"nfts": null
}