直达内容

Message Category

Mixin Messenger supports texts, images, stickers, files and other message types. Note that bots currently only support message types with the prefix PLAIN_ and ENCRYPTED_.

To send images, files, and videos, you need to upload attachments and obtain attachment_id before sending.

Texts

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_TEXT",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}

Stickers

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_STICKER",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"sticker_id": "UUID"
}

Images

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_IMAGE",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"attachment_id": "read From POST /attachments",
"mime_type": "image/jpeg",
"width": 1024,
"height": 1024,
"size": 1024,
"thumbnail": "base64 encoded"
}

Audios

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_AUDIO",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"attachment_id": "Read From POST /attachments",
"mime_type": "audio/ogg",
"size": 1024,
"duration": 60,
"waveform": "QIQQSA...AAIAA"
}

Videos

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_VIDEO",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"attachment_id": "Read From POST /attachments",
"mime_type": "video/mp4",
"width": 1024,
"height": 1024,
"size": 1024,
"duration": 60,
"thumbnail": "base64 encoded"
}

Contacts

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_CONTACT",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"user_id": "UUID"
}

Cards

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "APP_CARD",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"app_id": "7404c815-0393-4ea3-b9f2-b08efe4c72da",
"icon_url": "https://mixin.one/assets/98b586edb270556d1972112bd7985e9e.png",
"title": "Mixin",
"description": "Hello World.",
"action": "https://mixin.one", // should put the action in Resource Patterns in https://developers.mixin.one/apps/700000xxxx
"shareable": true
}
提示

Card forwarding can be prohibited by setting the shareable field to false. This feature is supported by Mixin Messenger 0.31.0 or above, and the default value is true.

Files

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_DATA",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"attachment_id": "Read From POST /attachments",
"mime_type": "application/pdf",
"size": 1024,
"name": "2020-12-12.pdf"
}

Live Shows

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_LIVE",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"width": 650,
"height": 366,
"thumb_url": "https://mixin.one/logo.png",
"url": "https://mixin.one/live.m3u8"
}

Locations

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_LOCATION",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"longitude": 126.5893955829421,
"latitude": 53.47845177824066,
"name": "China",
"address": "China Beijing"
}

Posts

{
"id": "UUID // generated by client",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_POST",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}

Buttons

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "APP_BUTTON_GROUP",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
[
{
"label": "Mixin Website",
"color": "#ABABAB",
"action": "https://mixin.one"
}
...
]

Transfers

{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "SYSTEM_ACCOUNT_SNAPSHOT",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"type": "transfer",
"snapshot_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"opponent_id": "a465ffdb-4441-4cb9-8b45-00cf79dfbc46",
"asset_id": "43d61dcd-e413-450d-80b8-101d5e903357",
"amount": "-10",
"trace_id": "7c67e8e8-b142-488b-80a3-61d4d29c90bf",
"memo": "hello",
"created_at": "2018-05-03T10:08:34.859542588Z"
}
{
"id": "UUID",
"action": "CREATE_MESSAGE",
"params": {
"conversation_id": "UUID",
"category": "PLAIN_VIDEO",
"status": "SENT",
"message_id": "UUID",
"data": "Base64 encoded data"
}
}
data
{
"attachment_id": "Read From POST /attachments",
"mime_type": "video/mp4",
"width": 1024,
"height": 1024,
"size": 1024,
"duration": 60,
"thumbnail": "base64 encoded"
}