Skip to main content

Chat

All http post request and response content type are application/json

Chat API list

  • Get my chat list
  • Update my chat

Get my chat list

GET /api/chats/

Request Headers

fieldRequiredheaders Descriptionexample
web3mq-request-pubkeyYesyour login keyapir's public key59daabd77706ba02a97c523513a2ceaed10e4275bd6
didkeyYesyour did_type + ":" + did_valueeth:0xa1b1233fdfde

Request Payload

Parameters in URLTypeRequiredParameters Description
pageintYespage number
sizeintYespage size
useridstringYesuserid
timestampintYestimestamp milliseconds
web3mq_signaturestringYesuse ed25519 base64 encode signature see signing detail

web3mq_signature signing rule

base64 encode signature

web3mq_signature = ed25519 private key signing(userid + timestamp)

url query params

{
"userid": "your userid",
"web3mq_signature": "web3mq_signature",
"timestamp": 1656991509327,
"page": 1,
"size": 20
}

response

ParametersTypeAlways ReturnParameters Description
codeintYesresult code, 0 means success, other code see msg's contents
msgstringYesresult description
datadictYesreturn includes response info
-topicstringYesRemove in future version use chatid instead; userid or group id
-topic_typestringYesRemove in future version use chat_type instead; user or group
-chatidstringYesuserid or group id
-chat_typestringYesuser or group
-chat_namestringYesuser nickname or group_name
-avatar_urlstringYesuser avatar or group avatar
-avatar_base64stringYesuser avatar or group avatar
-timestampintYeslast update timestamp
{
"code": 0,
"msg": "ok",
"data": {
"total": 35,
"result": [
{
"topic": "topic id",
"topic_type": "user",
"chatid": "topic id",
"chat_type": "user",
"chat_name": "user nickname",
"avatar_url": "",
"avatar_base64": ""
},
{
"topic": "topic id",
"topic_type": "group",
"chatid": "topic id",
"chat_type": "group",
"chat_name": "group name",
"avatar_url": "",
"avatar_base64": ""
}
]
}
}

Update my chat

Request Headers

fieldRequiredheaders Descriptionexample
web3mq-request-pubkeyYesyour login keyapir's public key59daabd77706ba02a97c523513a2ceaed10e4275bd6
didkeyYesyour did_type + ":" + did_valueeth:0xa1b1233fdfde

Request Payload

POST /api/chats/

Parameters in BodyTypeRequiredParameters Description
useridstringYesuserid
timestampintYestimestamp milliseconds
web3mq_signaturestringYesuse ed25519 base64 encode signature see signing detail
topicstringYesuserid or groupid
topic_typestringYesuser or group

web3mq_signature signing rule base64 encode signature

web3mq_signature = ed25519 private key signing(userid + topic + topic_type + timestamp)

{
"userid": "your userid",
"web3mq_signature": "web3mq_signature",
"timestamp": 1656991509327,
"topic": "userid",
"topic_type": "user"
}

response

ParametersTypeAlways ReturnParameters Description
codeintYesresult code, 0 means success, other code see msg's contents
msgstringYesresult description
{
"code": 0,
"msg": "ok"
}