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": "https://api.yourdomain.com/message/webhook",
    "FinishTodoWebhookUrl": "https://api.yourdomain.com/todo/webhook",
    "WebhookHeaders": {}
    }

    Configuration Parameters:

    • WebhookUrl: Required, the API endpoint for receiving messages.
    • FinishTodoWebhookUrl: Optional, the API endpoint for receiving to-do messages. No need to configure if to-do status sync is not required.
    • WebhookHeaders: Optional, custom request headers for authentication and other purposes.
  3. Message Body Specification

    HAP sends JSON data to WebhookUrl via POST with application/json format.

    Message Push Format

    {
    "messageId": "Message Id",
    "message": "Message Content",
    "messageType": 11,
    "messageTypeV2": 11,
    "appId": "App Id",
    "appName": "App Name",
    "attachments": ["Attachment Link|Attachment Name"],
    "redirectUrl": "Redirect URL",
    "targets": ["User Id"],
    "projectId": "Organization Id",
    "createUserId": "Creator",
    "processId": "Process Id"
    }
    FieldDescription
    messageType11: Worksheet 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
    messageTypeV211: Worksheet 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
    attachmentsImages can be used directly; document types currently only serve as a reminder of the number of attachments (cannot be downloaded directly)
    redirectUrlCorresponding to the landing page for message processing in the HAP system
    targetsThird-party user ID in single sign-on
    createUserIdThird-party user ID in single sign-on; empty for system-triggered messages
    processIdOnly available for workflow messages

    Completed To-do Push Format

    {
    "messageId": "Message Id",
    "projectId": "Organization Id",
    "userId": "Operator",
    "processId": "Process Id"
    }
  4. Mount the configuration file appextensions.json to the microservice container at /usr/local/MDPrivateDeployment/integrate/appextensions.json.

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

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