提交工单
咨询集成、功能及报价等问题
ZIM server supports developers to send different types of messages to the session through the server API, and the supported types are shown in the table below:
Message Type | MessageType Value | Applicable Session Type | Supports Broadcast to All Members |
---|---|---|---|
1 |
|
✔️ |
|
2 |
✖ |
||
11 |
✔️ |
||
12 |
✔️ |
||
13 |
✔️ |
||
14 |
✔️ |
||
200 |
✔️ |
||
20 |
Room。 |
✖ |
When developers call the ZIM server interface to send messages, they need to pass the message content through the parameter MessageBody. The format of MessageBody varies depending on the message type. This article will introduce the corresponding parameters for each message type.
The MessageBody structure is the same for text messages, custom messages and pop-up messages, as described below:
Parameters | Type | Required or not | Description |
---|---|---|---|
Message |
String |
Yes |
The message content, by default, is 2 KB. If necessary, please contact ZEGO technical support for configuration, with a maximum capacity of up to 32 KB. |
ExtendedData |
String |
No |
Extended field with a maximum length of 1 KB. |
OfflinePush |
Object |
No |
Offline Push. |
Enable |
Number |
No |
Whether to enable offline push:
|
Title |
String |
Yes (only if OfflinePush is filled in) |
The title of the offline push display, 20 bytes max. |
Content |
String |
Yes (only if OfflinePush is filled in) |
Offline Push Displayed Content, 50 bytes max. |
Payload |
String |
No |
Extended fields allow developers to customise the behaviour after receiving an offline push message. |
{
"MessageBody": {
"Message":"hello world",
"ExtendedData":"extendedData",
"OfflinePush" :{
"Enable":0,
"Title":"Title",
"Content":"Content",
"Payload":"data"
}
}
}
Parameters | Type | Required or not | Description |
---|---|---|---|
Message |
String |
Yes |
The content of signaling messages is by default limited to 2 KB. If necessary, please contact ZEGO technical support for configuration, and the maximum limit can be extended to 32 KB. If the message is base64 encoded, the length limit here refers to the original message length before base64 encoding. |
ExtendedData |
String |
No |
Extended field, up to 1 KB in length. |
IsBase64 |
Number |
No |
Whether the message is base64 encoded.
|
{
"MessageBody": {
"Message":"hello world",
"ExtendedData":"extendedData",
"IsBase64":0
}
}
Parameters | Type | Required or not | Description |
---|---|---|---|
Message |
String |
Yes |
Picture message content, a JSON byte string generated according to Message framework , defaults to 2 KB. Please contact ZEGO technical support for configurations up to 32 KB if needed. |
ExtendedData |
String |
No |
Extended field, up to 1 KB in length. |
OfflinePush |
Object |
No |
Offline Push. |
Enable |
Number |
No |
Whether to enable offline push:
|
Title |
String |
Yes(only if OfflinePush is filled in) |
The title of the offline push display, 20 bytes max. |
Content |
String |
Yes(only if OfflinePush is filled in) |
The content Offline Push displayed, 50 bytes max. |
Payload |
String |
No |
Extended fields allow developers to customise the behaviour after receiving the offline push message. |
Parameters | Type | Required or not | Description |
---|---|---|---|
Uid |
String |
Yes |
The unique ID of the image, whihc is generated by the developer. |
Origin |
Object |
Yes |
Original image. |
Url |
String |
Yes |
The URL address of the image, with a maximum length of 500 bytes. |
Width |
Number |
Yes |
Picture width in pixels(px). |
Height |
Number |
Yes |
Picture heightin pixels(px). |
FileName |
String |
Yes |
File name in the recommended format "xxx.file extension" with a maximum length of 150 bytes. |
Size |
Number |
No |
Image data size in bytes. |
{
"Uid":"343649807833778782",
"Origin": {
"Url":"https:xxx",
"Width":100,
"Height":200
},
"FileName":"FileName.jpg",
"Size":1024
}
{
"MessageBody": {
"Message":"", // The content of the image message is a JSON byte string generated according to the Message structure of the image message.
"ExtendedData":"extendedData",
"OfflinePush" :{
"Enable":0,
"Title":"Title",
"Content":"Content",
"Payload":"data"
}
}
}
Parameters | Type | Required or not | Description |
---|---|---|---|
Message |
String |
Yes |
The content of the file message, a JSON byte string generated according to the Message structure of the file message, defaults to 2 KB. Please contact ZEGO technical support for configurations up to 32 KB if needed.
|
ExtendedData |
String |
No |
Extended field with a maximum length of 1 KB. |
OfflinePush |
Object |
No |
Offline Push. |
Enable |
Number |
No |
Whether to enable offline push:
|
Title |
String |
Yes(only if OfflinePush is filled in) |
The title of the offline push display, 20 bytes max. |
Content |
String |
Yes(only if OfflinePush is filled in) |
The content Offline Push displayed, 50 bytes max. |
Payload |
String |
No |
Extended fields allow developers to customise the behaviour after receiving an offline push message. |
Parameters | Type | Required or not | Description |
---|---|---|---|
Uid |
String |
Yes |
The unique ID of the file. generated by the developer. |
Url |
String |
Yes |
The URL address of the file, and the maximum length is 500 bytes. |
FileName |
String |
Yes |
File name in the recommended format "xxx.file extension" with a maximum length of 150 bytes |
Size |
Number |
No |
Image data size in bytes. |
{
"Uid":"343649807833778782",
"Url":"https:xxx",
"FileName":"FileName.txt",
"Size":1024
}
{
"MessageBody": {
"Message":"", // The content of the file message, which is a JSON byte string generated according to the Message structure of the file message.
"ExtendedData":"extendedData",
"OfflinePush" :{
"Enable":0,
"Title":"Title",
"Content":"Content",
"Payload":"data"
}
}
}
Parameters | Type | Required or not | Description |
---|---|---|---|
Message |
String |
Yes |
The content of the video message, a JSON byte string generated according to the Message structure of the audio message, defaults to 2 KB. Please contact ZEGO technical support for configurations up to 32 KB if needed.
|
ExtendedData |
String |
No |
Extended field with a maximum length of 1 KB. |
OfflinePush |
Object |
No |
Offline Push. |
Enable |
Number |
No |
Whether to enable offline push:
|
Title |
String |
Yes(only if OfflinePush is filled in) |
The title of the offline push display, 20 bytes max. |
Content |
String |
Yes(only if OfflinePush is filled in) |
The content Offline Push displayed, 50 bytes max. |
Payload |
String |
No |
Extended fields allow developers to customise the behaviour after receiving an offline push message. |
Parameters | Type | Required or not | Description |
---|---|---|---|
Uid |
String |
Yes |
A unique ID for the audio. generated by the developer. |
Url |
String |
Yes |
URL address of the audi, and the maximum length is 500 bytes. |
FileName |
String |
Yes |
Audio name in the recommended format "xxx.file extension" with a maximum length of 150 bytes. |
Size |
Number |
No |
Audio data size in bytes. |
MediaDuration |
Number |
No |
Audio duration in seconds. |
{
"Uid":"343649807833778782",
"Url":"https:xxx",
"FileName":"FileName.mp3",
"Size":1024,
"MediaDuration":30
}
{
"MessageBody": {
"Message":"", // The content of the audio message, a JSON byte string generated according to the Message structure of the audio message.
"ExtendedData":"extendedData",
"OfflinePush" :{
"Enable":0,
"Title":"Title",
"Content":"Content",
"Payload":"data"
}
}
}
Parameters | Type | Required or not | Description |
---|---|---|---|
Message |
String |
Yes |
Video message content, a JSON byte string generated according to Message framework defaults to 2 KB. Please contact ZEGO technical support for configurations up to 32 KB if needed.
|
ExtendedData |
String |
No |
Extended field with a maximum length of 1 KB. |
OfflinePush |
Object |
No |
Offline Push. |
Enable |
Number |
No |
Whether to enable offline push:
|
Title |
String |
Yes(only if OfflinePush is filled in) |
The title of the offline push display, 20 bytes max. |
Content |
String |
Yes(only if OfflinePush is filled in) |
The content Offline Push displayed, 50 bytes max. |
Payload |
String |
No |
Extended fields for developers to customise their behaviour after receiving an offline push message. |
Parameters | Type | Required or not | Description |
---|---|---|---|
Uid |
String |
Yes |
The unique ID of the file. generated by the developer. |
Url |
String |
Yes |
The URL address of the video, the maximum length is 500 bytes. |
FileName |
String |
Yes |
Video name in the recommended format "xxx.file extension" with a maximum length of 150 bytes. |
Size |
Number |
No |
Audio data size, measured in bytes. |
MediaDuration |
Number |
No |
Video duration in seconds. |
Thumbnail |
Object |
No |
Video first frame. |
Url |
String |
Yes(Only if the first frame of the video is required) |
The URL address of the thumbnail, the maximum length is 500 bytes. |
Width |
Number |
Yes(Only if the first frame of the video is required) |
Picture width in pixels(px). |
Height |
Number |
Yes(Only if the first frame of the video is required) |
Picture height in pixels(px). |
{
"Uid":"343649807833778782",
"Url":"https:xxx",
"FileName":"FileName.mp4",
"Size":1024,
"MediaDuration":300,
"Thumbnail": {
"Url":"https:xxx",
"Width":100,
"Height":200
}
}
{
"MessageBody": {
"Message":"", // The content of the video message as a JSON byte string generated from the Message structure of the audio message.
"ExtendedData":"extendedData",
"OfflinePush" :{
"Enable":0,
"Title":"Title",
"Content":"Content",
"Payload":"data"
}
}
}