Create Message¶
Create messages on Application Portal. The message will appear in the message center pop-up window in the upper right corner of the terminal interface.
Prerequisites¶
The OU has obtained the application, or the application is a self-built application in the OU.
If this message is an alert about an asset, the asset or the parent node of the asset need to have the tag
auth_unit:true
. If necessary, you can add tags to assets via the Update Asset API.
Request Format¶
POST https://{apigw-address}/app-portal-service/v2.2/message/produce
Request Parameters (Body)¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
messages |
Required |
MessageProduceDTO Struct |
The message details. MessageProduceDTO Struct >> |
MessageProduceDTO Struct¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
messageId |
Required |
String |
The message ID. |
type |
Required |
Integer |
The message type. Supports the following values:
|
orgId |
Required |
String |
The OU ID. How to get orgId >> |
accessKey |
Required |
String |
The access key of the application. The application authenticates with |
body |
Optional |
I18nString |
The message content in its respective locale’s language. To display message content, you need to specify at least one of |
color |
Optional |
Integer |
The color ID to indicate the message severity. You can use the Get Colors of the Message Icon API to get a list of available message icon colors in an OU. |
ring |
Optional |
Integer |
The ringtone ID for the message. You can use the Get Message Ringtones API to get the list of available message ringtones in an OU. |
tags |
Optional |
Map |
The message tags to be displayed. Only the first 3 are displayed in the page pop-up window. Supports multiple languages. To display tags, you need to specify at least one of |
produceTime |
Required |
String |
The time the message is produced. The format is “yyyy-MM-dd HH:mm:ss”. |
zoneOffset |
Required |
String |
The time zone in UTC format, such as “+08:00”. |
linkedAppId |
Optional |
String |
The application ID associated with the message. |
linkedMenuCode |
Optional |
String |
The menu ID within the application that is associated with the message. |
linkedStates |
Optional |
String |
Other custom parameters in the URL. |
feature |
Optional |
I18nString |
The custom description, which will be displayed in the message pop-up window, supports multi-languages. If you need to display the description, specify at least one of |
assetId |
Optional |
String |
The asset ID associated with the message. |
authUnitId |
Required |
String |
Verify whether the application has the permission to access an asset and its sub-assets. You need to specify an asset ID. supports an asset ID of the specific device, or the parent node ID of the device, such as the ID of the power station or factory to which the device belongs. The asset of the ID must be tagged with “auth_unit:true” in the asset tree. For example, if an application has the permission to access a photovoltaic power station, the asset ID of the photovoltaic power station can be specified as |
callbackUrl |
Optional |
String |
When the user clicks a button in the message pop-up window, the system initiates a GET request to the specified URL to notify the server that the user has clicked the message button. Both unencoded and encoded URLs are supported:
Where |
actionName |
Optional |
I18nString |
The name of the custom button in the message pop-up window, which supports multi-language display. It is recommended to specify 2 characters for Chinese and 3 characters for English, such as and “ACK”. If this parameter is not provided, the button will not be displayed. If the button needs to be displayed, at least one of |
actionPermissionCode |
Optional |
String |
Permission ID, which can be used to restrict the operation permissions of the button. When the user who can see this message has this permission, they can view and click the button in the message pop-up box, otherwise the button will not be displayed. If this parameter is not provided, all users who can see this message can see the button by default. |
Response parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Boolean |
Whether the message rule is deleted successfully. |
Samples¶
Request Sample¶
url: https://{apigw-address}/app-portal-service/v2.2/message/produce?orgId=your_org_id
method: POST
requestBody:
{
"messages": [
{
"zoneOffset": "+08:00",
"linkedMenuCode": "menucode",
"linkedAppId": "yourAppId",
"color": 1,
"ring": 1,
"messageId": "your_message_id",
"produceTime": "2022-07-24 11:22:01",
"body": {
"default": "your_message",
"en_US": "your_message_en",
"zh_CN": "your_message_zh",
"ja_JP": "",
"es_ES": ""
},
"type": 1,
"tags": [
{
"default": "Severe",
"en_US": "Severe",
"zh_CN": "",
"ja_JP": "",
"es_ES": ""
},
{
"default": "Performance Alarm",
"en_US": "Performance Alarm",
"zh_CN": "",
"ja_JP": "",
"es_ES": ""
},
{
"default": "Inverter",
"en_US": "Inverter",
"zh_CN": "",
"ja_JP": "",
"es_ES": ""
}
],
"orgId": "your_org_id",
"authUnitId": "your_auth_unit_id",
"feature": {
"default": "your_message",
"en_US": "your_message_en",
"zh_CN": "your_message_zh",
"ja_JP": "",
"es_ES": ""
},
"assetId": "your_asset_id",
"accessKey": "your_access_key",
"linkedStates": "states",
"callbackUrl":"https://{app-service-address}/app-portal/test/v1/callback?appId=yourAccessKey&messageId=yourMessageId",
"actionName":
{
"en_US":"ACK",
"zh_CN":"",
"ja_JP": "",
"es_ES": ""
}
}
]
}
Return Sample¶
{
"code": 0,
"message": "",
"data": true
}