Notice Message Produce


Create and send notice messages, and the message will appear in the pop-up window of the end-user interface. Before using this API, please note:

  • If the message ID already exists in the OU, only the message is sent; if it does not exist, a new message is created and sent.

  • Supports creating or sending multiple messages at the same time, and up to 100 messages can be sent at a time. But if any of them fails, all of them fail.

  • When you send existing messages, the content of existing messages cannot be modified through this API.

  • If some users do not exist or are not in the OU in the specified user ID, they will be automatically filtered and no errors will be reported, and messages will continue to be sent to the remaining users.

Prerequisites


The OU has obtained the application, or the application is a self-built application in the OU.

Request Format


POST https://{apigw-address}/app-portal/api/v3/notice-message/produce

Request Parameters (URI)


Name

Location (Path/Query)

Required/Optional

Data Type

Description

orgId

Query

Required

String

OU ID. How to get orgId >>

Request Parameters (Body)


Name

Required/Optional

Data Type

Description

messages

Required

MessageProduceDTO structure

Message list. Supports creating or sending multiple messages at the same time, and up to 100 messages can be sent at a time. But if any of them fails, all of them fail. MessageProduceDTO Struct >>

MessageProduceDTO structure


Note:

  • appName, features, body, header, and tag need to be provided in international structure format, see Internationalized name struct.

  • If some user IDs in the targets do not exist or are not in the OU, they will be automatically filtered and no errors will be reported, and messages will continue to be sent to the remaining users.

  • When sending existing messages, the existing messages cannot be modified or pushed to the sent user again, nor can the message be withdrawn through this API.


Name

Required/Optional

Data Type

Description

messageId

Required

String

Message ID. If the message ID already exists in the OU, only the message will be sent, and the changes to the message content in the following parameters are invalid. If the message ID does not exist, a new message will be created and sent.

messageType

Optional

Number

Message type. If you need to create and send a new message, that is, messageId does not exist, this parameter is required, and only supports 1, indicating a notice message. If only existing messages need to be sent, any value of this parameter is invalid.

appId

Optional

String

The application accessKey associated with the message. If the application is an external application, it must be left blank. If only existing messages need to be sent, any value of this parameter is invalid.

appName

Optional

Object

The name of the external application, must be filled in when the associated application is an external application. At this time appId is empty. The application name will be displayed in the message pop-up window. Values ​​must be assigned in the form of an international structure and at least specified default or en_US. See Internationalized name struct. If only existing messages need to be sent, any value of this parameter is invalid.

Note: If you need to associate multiple messages with an external application, you must ensure that the internationalized structure of each appName is completely consistent.

url

Optional

String

A external link displayed in the message. The end user can jump to the URL by clicking the message title. If you specify linkedAppId, linkedMenuCode, and linkedStates at the same time, only the link specified in the url parameter will be displayed. If only existing messages need to be sent, any value of this parameter is invalid.

linkedAppId

Optional

String

The application ID associated with the message. linkedAppId will be used together with linkedMenuCode and linkedStates to form the internal URL of Application Portal. The end user can jump to the URL by clicking the message title. If you specify url at the same time, only the link specified in url will be displayed. If only existing messages need to be sent, any value of this parameter is invalid. For example: https://{app-service-address}/portal/abc-123-xyz/alarmProcessing?state=site%abc123, where “{app-service-address}” is the environment domain name, “abc-123-xyz” is linkedAppId, “alarmProcessing” is linkedMenuCode, and “site%abc123” is linkedStates.

linkedMenuCode

Optional

String

The menu ID within the application that is associated with the message. linkedMenuCode will be used together with linkedAppId and linkedStates to form the URL. For details, see the description of the linkedAppId parameter. You can use the Get Application Information API to get the menu IDs within the application. If only existing messages need to be sent, any value of this parameter is invalid.

linkedStates

Optional

String

Other custom parameters in the URL. linkedStates will be used together with linkedAppId and linkedMenuCode to form the URL. For details, see the description of the linkedAppId parameter. If only existing messages need to be sent, any value of this parameter is invalid.

features

Optional

Object

A multilingual description of the link, displayed in a pop-up window as a supplementary description of the link. If you need to display the description, specify at least one of default or en_US. For the structure, see Internationalized name struct. If only existing messages need to be sent, any value of this parameter is invalid.

body

Optional

Object

Multilingual content of the message. If you need to display the message body, specify at least one of default or en_US. For the structure, see Internationalized name struct. If only existing messages need to be sent, any value of this parameter is invalid.

Header

Optional

Object

Multilingual title of the message. If you need to display the message title, specify at least one of default or en_US. For the structure, see Internationalized name struct. If only existing messages need to be sent, any value of this parameter is invalid.

tag

Optional

List

The message tags to be displayed. Supports multiple languages. If you need to display the tag, specify at least one of default or en_US. For the structure, see Internationalized name struct. If only existing messages need to be sent, any value of this parameter is invalid.

targetType

Optional

Map

The type of the message receivers. If you need to create and send a new message, this parameter is required. The following values are supported:

  • 0: All users within the OU.

  • 1: Specify user.

If only existing messages need to be sent, any value of this parameter is invalid.

targets

Optional

List

List of user IDs sent by the message. When targetType is 1, it is required. When targetType is 0, this parameter is invalid. Users whose user ID is invalid, have received the message before, or users who do not belong to the OU will be automatically filtered out, and the message will continue to send to the remaining users.

Response Parameters


Name

Data Type

Description

data

Boolean

Whether the message was sent successfully. true means the sending is successful. false means the sending failed.

Samples

Request Sample


url: https://{apigw-address}/app-portal-service/v2.2/notice-message/produce?orgId=your_org_id

method: POST

requestBody:
{
  "messages": [
    {
      "messageId": "yourMessageId",
      "messageType": 1,
      "url": "http://xxx.com",
      "targetType": 1,
      "targets": ["u123", "u456"],
      "appId": "yourAppAccessKey",
      "appName": {
        "defaultValue": "appName",
        "i18nValue": {"zh_CN": "appNameZh", "en_US": "appNameEn"}
      },
      "header": {
        "defaultValue": "header",
        "i18nValue": {"zh_CN": "headerZh", "en_US": "headerEn"}
      },
      "body": {
        "defaultValue": "body",
        "i18nValue": {"zh_CN": "bodyZh", "en_US": "bodyEn"}
      },
      "tags": [
        {
          "defaultValue": "tag1",
          "i18nValue": {"zh_CN": "tag1Zh", "en_US": "tag1En"}
        },
        {
          "defaultValue": "tag2",
          "i18nValue": {"zh_CN": "tag2Zh", "en_US": "tag2En"}
        }
      ],
      "features": [
        {
          "defaultValue": "feature1",
          "i18nValue": {"zh_CN": "feature1Zh", "en_US": "feature1En"}
        },
        {
          "defaultValue": "feature2",
          "i18nValue": {"zh_CN": "feature2Zh", "en_US": "feature2En"}
        }
      ]
    }
  ]
}

Return Sample

{
  "code": 0,
  "message": "",
  "data": {
    "success": true
  }
}