Skip to main content

User content message format

User content messages represent messages that users exchange during chat, including text, image, GIF, voice, file, short video, location, quote, and combined forward messages.

Text message

ObjectName: RC:TxtMsg

Built into the client SDK. When sending via the server API, set the message type field to RC:TxtMsg and pass the content structure as a serialized JSON string in the content field.

Content structure

JSON
{
"content":"@Alice Hello world!",
"mentionedInfo":{
"type":2,
"userIdList":["zhangsan"],
"mentionedContent":"Someone mentioned you"
},
"user":
{
"id":"4242",
"name":"Robin",
"portrait":"http://example.com/p1.png",
"extra":"extra"
},
"extra":""
}
FieldTypeRequiredDescription
contentStringYesText content, including emoji.
mentionedInfoObjectNoMention (@) info for group messages. Not needed for direct channels. When sending via the server API, set isMentioned to 1 to mark the message as a mention; otherwise mentionedInfo is ignored.
mentionedInfo.typeIntYesMention type. 1: mention all. 2: mention specific users.
mentionedInfo.userIdListString[]NoList of mentioned user IDs. Required when type is 2.
mentionedInfo.mentionedContentStringNoCustom push content for mentions. Takes highest priority, overriding all default or custom pushContent.
userObjectNoSender user info embedded in the message. Recommended for live streaming scenarios only.
user.idStringNoSender's user ID.
user.nameStringNoSender's nickname.
user.portraitStringNoSender's avatar URL.
user.extraStringNoCustom extension data.
extraStringNoCustom extension data.

Client defaults

  • Stored on the client
  • Counts as unread
  • Push supported by default
    • Push title: sender's nickname (direct/system channels) or group name (group/community channels). Can be customized at send time.
    • Push content: defaults to the message content. For group/community channels, prefixed with the sender's nickname.

Image message

ObjectName: RC:ImgMsg

Built into the client SDK. When sending via the server API, set the message type to RC:ImgMsg.

Content structure

JSON
{
"content":"/9j/4AAQSkZJRgABAgAAZABkAAD",
"localPath":"",
"imageUri":"http://p1.cdn.com/fds78ruhi.jpg",
"user":
{
"id":"4242",
"name":"Robin",
"portrait":"http://example.com/p1.png",
"extra":"extra"
},
"extra":""
}

The image content consists of two parts:

  • Thumbnail: The content field contains the Base64-encoded thumbnail. When sending from the server, generate a thumbnail (recommended max 240 px on the longest edge), Base64-encode it, and place it in content. Strip any Data URI prefix (e.g., data:image/jpeg;base64,...) — use only the data portion.
  • Full image: The imageUri field contains the URL of the full-size image hosted on your file server.
FieldTypeRequiredDescription
contentStringYesBase64-encoded thumbnail. Recommended max 5 KB, absolute max 10 KB. Remove all \r\n, \r, and \n characters after encoding.
nameStringNoFile name. If omitted, the client SDK generates a default name on download.
localPathStringYesLocal file path. Client-side only; do not set when sending from the server.
imageUriStringYesURL of the full image on your file server.
userObjectNoSender user info. Recommended for live streaming only.
user.idStringNoSender's user ID.
user.nameStringNoSender's nickname.
user.portraitStringNoSender's avatar URL.
user.extraStringNoCustom extension data.
extraStringNoCustom extension data.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: [Image]

Streaming message

ObjectName: RC:StreamMsg

When sending via the server API, set the message type to RC:StreamMsg and pass the content structure in the content field. Total message size must not exceed 128 KB (initial + continuation chunks combined).

Content structure

JSON
{
"content": "# stream-content1",
"complete": false,
"messageUID": "xxxx",
"seq": 1,
"type": "markdown",
"mentionedInfo": {
"type": 2,
"userIdList": ["123", "456"]
},
"user": {
"id": "4242",
"name": "Robin",
"portrait": "http://example.com/p1.png",
"extra": {"k1":"v1"}
},
"extra": {"k1":"v1"}
}
FieldTypeRequiredDescription
contentStringYesStream data chunk. Total size (initial + continuation) must not exceed 128 KB.
seqLongYesSequence number. Must be greater than 0, starting from 1, strictly incrementing and consecutive. Non-consecutive or duplicate sequence numbers may cause ordering issues.
completeBooleanYesWhether this chunk marks the end of the stream.
completeReasonIntNoCustom completion reason code. Only effective when complete is true. Passed to the SDK with the initial packet.
typeStringNoStream content type. Set on the initial chunk only. Default: text. Supported values: text, markdown, html.
messageUIDStringNoStreaming message ID. Omit for the initial chunk. Include for continuation chunks. If absent, the chunk is treated as the initial packet.
userObjectNoSender user info. Set on the initial chunk only. Recommended for passing bot extension info.
user.idStringNoSender's user ID.
user.nameStringNoSender's nickname.
user.portraitStringNoSender's avatar URL.
user.extraJSON ObjectNoBot extension metadata. Keys and values must be strings.
mentionedInfoObjectNoMention info for group messages. Set on the initial chunk only. When sending via the server API, set isMentioned to 1.
mentionedInfo.typeIntNo1: mention all. 2: mention specific users.
mentionedInfo.userIdListString[]NoList of mentioned user IDs.
extraJSON ObjectNoCustom extension data. Set on the initial chunk only. Keys and values must be strings.

GIF message

ObjectName: RC:GIFMsg

Built into the client SDK. When sending via the server API, set the message type to RC:GIFMsg.

Content structure

JSON
{
"gifDataSize":34563,
"height":246,
"localPath":"/var/mobile/.../GIF_53",
"remoteUrl":"https://rongcloud-image.cn.ronghub.com/image_jpe64562665566.gif",
"width":263,
"user":
{
"id":"4242",
"name":"Robin",
"portrait":"http://example.com/p1.png",
"extra":"extra"
},
"extra":""
}
FieldTypeRequiredDescription
gifDataSizeIntYesGIF file size in bytes.
nameStringNoFile name. If omitted, the client generates a default name.
localPathStringYesLocal file path. Client-side only.
remoteUrlStringYesURL of the GIF on your file server.
widthIntYesGIF width in pixels.
heightIntYesGIF height in pixels.
userObjectNoSender user info.
extraStringNoCustom extension data.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: [Image]

HD voice message

ObjectName: RC:HQVCMsg

Built into the client SDK. When sending via the server API, set the message type to RC:HQVCMsg.

Content structure

JSON
{
"localPath":"/9j/4AAQSkZ/2wBaSiimB//9k=",
"remoteUrl":"http://p1.cdn.com/fds78ruhi.aac",
"duration":7,
"user":
{
"id":"4242",
"name":"Robin",
"portrait":"http://example.com/p1.png",
"extra":"extra"
},
"extra":""
}
FieldTypeRequiredDescription
nameStringNoFile name. If omitted, the client generates a default name.
localPathStringYesLocal path of the AAC-encoded audio file. Client-side only.
remoteUrlStringYesURL of the AAC audio file on your server. When sending via the server API, generate an AAC file and upload it to your file server.
durationIntYesVoice duration in seconds (max 60 seconds).
userObjectNoSender user info. Recommended for live streaming only.
extraStringNoCustom extension data.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: [Voice]
tip

HD voice messages (RC:HQVCMsg) are recommended over standard voice messages. Audio data is stored on the server while the message body contains only a URL, removing the 128 KB message size limitation and providing higher audio quality. Max duration: 60 seconds.

File message

ObjectName: RC:FileMsg

Built into the client SDK. When sending via the server API, set the message type to RC:FileMsg.

Content structure

JSON
{
"name":"file.txt",
"size":190184,
"type":"txt",
"localPath":"",
"fileUrl":"http://www.demo.com/am.ind",
"user":
{
"id":"4242",
"name":"Robin",
"portrait":"http://example.com/p1.png",
"extra":"extra"
},
"extra":""
}
FieldTypeRequiredDescription
nameStringNoFile name.
sizeStringYesFile size in bytes.
typeStringYesFile type/extension.
localPathStringYesLocal file path. Client-side only.
fileUrlStringYesURL of the file on your server.
userObjectNoSender user info.
extraStringNoCustom extension data.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: [File] filename

Short video message

ObjectName: RC:SightMsg

Built into the client SDK. When sending via the server API, set the message type to RC:SightMsg.

Content structure

JSON
{
"sightUrl":"http://rongcloud...com/video...",
"content":"/9j/4AAQSkZ/2wB...hDSaSiimB//9k=",
"duration":2,
"size":734320,
"name":"video_xx.mp4",
"user":
{
"id":"4242",
"name":"Robin",
"portrait":"http://example.com/p1.png",
"extra":"extra"
},
"extra":"extra"
}

The content field contains the Base64-encoded first-frame thumbnail. When sending from the server, generate a thumbnail (max 240 px longest edge) and Base64-encode it. Strip any Data URI prefix.

FieldTypeRequiredDescription
sightUrlStringYesURL of the video file on your server.
contentStringYesBase64-encoded first-frame thumbnail. Max 10 KB. Remove all \r\n, \r, \n after encoding.
durationIntYesVideo duration in seconds. Default max recording: 10 seconds. Max supported: 2 minutes (contact sales to adjust).
sizeStringYesVideo file size in bytes.
nameStringYesVideo file name. Format: MP4 (H.264+AAC).
userObjectNoSender user info.
extraStringNoCustom extension data.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: [Video]

Location message

ObjectName: RC:LBSMsg

Built into the client SDK. When sending via the server API, set the message type to RC:LBSMsg.

Content structure

JSON
{
"content":"bhZPzJXimRwrtvc=",
"latitude":39.9139,
"longitude":116.3917,
"poi":"Nexconn Inc.",
"user":
{
"id":"4242",
"name":"Robin",
"portrait":"http://example.com/p1.png",
"extra":"extra"
},
"extra":""
}
FieldTypeRequiredDescription
contentStringYesBase64-encoded JPG thumbnail of the location. Remove all \r\n, \r, \n after encoding.
latitudeNumberYesLatitude.
longitudeNumberYesLongitude.
poiStringYesPoint of interest (location name).
userObjectNoSender user info.
extraStringNoCustom extension data.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: [Location]

Quote message

ObjectName: RC:ReferenceMsg

tip

Typically used in direct and group channels. Send a quote message to reply to a specific message. Supported quoted types: text (RC:TxtMsg), image (RC:ImgMsg), file (RC:FileMsg). Quoted messages can themselves be quoted.

Built into the client SDK. When sending via the server API, set the message type to RC:ReferenceMsg.

Content structure

JSON
{
"content":"This is a reply to the quoted message!",
"referMsgUserId":"432432",
"objName":"RC:TxtMsg",
"referMsg":{
"content":"Hello world!",
"extra":""
},
"mentionedInfo":{
"type":2,
"userIdList":["123","456"],
"mentionedContent":"Someone mentioned you"
},
"user":
{
"id":"4242",
"name":"Robin",
"portrait":"http://example.com/p1.png",
"extra":"extra"
},
"extra":""
}
FieldTypeRequiredDescription
contentStringYesText content of the reply, including emoji.
referMsgUserIdStringYesUser ID of the sender of the quoted message.
referMsgObjectYesContent structure of the quoted message (JSON).
objNameStringYesMessage type of the quoted message. Supported: RC:TxtMsg, RC:ImgMsg, RC:FileMsg.
mentionedInfoObjectNoMention info. See the text message section for details.
userObjectNoSender user info.
extraStringNoCustom extension data.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: the message content.

Combined forward message

ObjectName: RC:CombineMsg

Built into the client SDK. When sending via the server API, set the message type to RC:CombineMsg.

Content structure

JSON
{
"localPath":"file:///storage/emulated/0/.../157829828.html",
"remoteUrl":"https://rongcloud-html-cn.ronghub.com/text_plain__RC-2019-12-17_754_157130.html?e=1592Q=",
"conversationType":1,
"nameList":["Alice","Bob"],
"summaryList":["Alice: Hello","Bob: Hi there","Bob: How are you","Alice: Good"]
}
FieldTypeRequiredDescription
localPathStringNoLocal HTML file path. Client-side only.
remoteUrlStringYesRemote URL of the HTML file.
conversationTypeIntYesChannel type. 1: direct. 3: group.
nameListString[]YesNames of the first 4 message senders.
summaryListString[]YesSummaries of the first 4 messages.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: [Chat History]

Rich content message

ObjectName: RC:ImgTextMsg

Built into the client SDK. When sending via the server API, set the message type to RC:ImgTextMsg.

Content structure

JSON
{
"title":"Title",
"content":"Description",
"imageUri":"http://p1.cdn.com/fds78ruhi.jpg",
"url":"http://www.example.com",
"user":
{
"id":"4242",
"name":"Robin",
"icon":"http://example.com/p1.png",
"extra":"extra"
},
"extra":""
}
FieldTypeRequiredDescription
titleStringYesMessage title.
contentStringYesMessage text content.
imageUriStringYesImage URL (120 x 120 px). Upload the image to your file server.
urlStringYesURL to open when the image is tapped.
userObjectNoSender user info.
extraStringNoCustom extension data.

Client defaults

  • Stored, counts as unread, push supported by default
  • Default push content: [Rich Content]

How to send a mention (@) message

A mention message is not a separate message type. It uses the standard text or quote message type with an additional mentionedInfo object in the content.

Mention messages are supported in group and community channels for the following message types:

  • Text message (RC:TxtMsg)
  • Quote message (RC:ReferenceMsg)

mentionedInfo structure

FieldTypeRequiredDescription
mentionedInfoObjectNoMention info. When sending via the server API, set isMentioned to 1 to enable mention behavior.
mentionedInfo.typeIntYes1: mention all members. 2: mention specific users.
mentionedInfo.userIdListString[]NoUser IDs to mention. Required when type is 2.
mentionedInfo.mentionedContentStringNoCustom push content for mentions. Takes highest priority, overriding all default or custom pushContent.
tip

When sending mention messages via the server API, set isMentioned to 1 to mark the message as a mention.

Text message with mention

JSON
{
"content":"@Alice @Bob Hello World!",
"mentionedInfo":{
"type":2,
"userIdList":["123","456"],
"mentionedContent":"Someone mentioned you"
},
"extra":""
}

When sending from the server, manually include the mentioned users' display names in the content field text.

Quote message with mention

JSON
{
"content":"@Tom This is a reply!",
"referMsgUserId":"432432",
"objName":"RC:TxtMsg",
"referMsg":{
"content":"Hello world!",
"extra":""
},
"mentionedInfo":{
"type":2,
"userIdList":["tom1999"],
"mentionedContent":"Someone mentioned you"
},
"extra":""
}