Skip to main content

How to push session status to external system

If the user is active (there is the interface call that triggers the HAP system), in the case of configuring the receiving address, it will be pushed to users every 2 minutes, and the push content contains the account ID in the HAP system. If you need to get the corresponding third-party user ID, go to https://www.showdoc.com.cn/mingdao/ 7237672824191664 for more details.

  1. Create a configuration file

    For example, /data/hap/script/volume/wwwapi/appextensions.json

    {
    "AppSettings": {
    "SessionWebhookUrl": "API address to receive push messages", // Required, e.g. https://api.domain.com/hooks/NjA0NzdjMDNjMGFjMTE3ZGUwMjRjN2Nl
    "SessionWebhookHeaders": {} // Custom request headers, optional
    }
    }

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

{
"accountId": "Account ID in HAP"
}
  1. Mount the configuration file

    Modify the corresponding docker-compose.yaml for the microservice application, and add the following in volumes:

    - ./volume/wwwapi/appextensions.json:/usr/local/MDPrivateDeployment/wwwapi/appextensions.json
  2. Restart the HAP microservice application