Skip to main content

How to enable message integration

Assuming that single sign-on has been integrated (such as integration based on WeCom, DingTalk, Welink, Feishu, or Organization Structure Sync API which is equivalent to enabling single sign-on), the HAP system supports pushing application messages to external systems, and can also be customized by the HAP team to integrate with external systems [custom development will incur additional charges].

To actively receive application messages from HAP:

  1. If not based on integration with WeCom, DingTalk, Welink, Feishu, or Organization Structure Sync API, you need to mount the following configuration file in advance:

    /data/hap/script/volume/sso/extend.json

    {
    "relation": true
    }

    Add the following to docker-compose.yaml volumes corresponding microservice application:

    - ./volume/sso/extend.json:/usr/local/MDPrivateDeployment/sso/extend.json
  2. Create the configuration file required to receive application messages:

    /data/hap/script/volume/integrate/appextensions.json

    {
    "WebhookUrl": "API address to receive messages", // Required, e.g., https://api.domain.com/hooks/NjA0NzdjMDNjMGFjMTE3ZGUwMjRjN2Nl
    "FinishTodoWebhookUrl": "API address to receive to-do completion messages", // Optional, no need to synchronize pending status, no need to configure
    "WebhookHeaders": {} // Custom parameters for request headers, optional
    }

    Message format is as follows: (POST application/json)

    {
    "messageId": "Message id",
    "message": "Message content",
    "messageType": 11, // 11: Workheet system message, 12: Mentions in worksheet discussion, 13: Replies in worksheet discussion, 14: To-do message in workflow (fill in, approval, system message with sending record), 15: Workflow system message without sending record
    "messageTypeV2": 11, // 11: Workheet system message, 12: Mentions in worksheet discussion, 13: Replies in worksheet discussion, 14: To-do message in workflow (fill in, approval), 15: Workflow system message without sending record, 16: Workflow system message with sending record
    "appId": "App id",
    "appName": "App name",
    "attachments": ["Attachment link|Attachment name"], // Images can be used directly, document types currently only serve as a reminder of the number of attachments (cannot be downloaded directly)
    "redirectUrl": "Redirect url", // Corresponding to the landing page for message processing in the HAP system
    "targets": ["User id"], // Third-party user id in single sign-on
    "projectId": "Organization Id",
    "createUserId": "Creator", // Third-party user id in single sign-on,system triggered message is empty
    "processId": "Process id" // Only workflow messages have value
    }

    The format of the completed to-do message is as follows: (POST application/json)

    {
    "messageId": "Message id",
    "projectId": "Organization Id",
    "userId": "Creator", // Third-party user id in single sign-on
    "processId": "Process id"
    }

  3. Mount configuration file

    Add the following to the docker-compose.yaml volumes of the microservice application:

    - ./volume/integrate/appextensions.json:/usr/local/MDPrivateDeployment/integrate/appextensions.json
  4. Restart the HAP microservice application