How to enable SMS service
Configuration
Click the profile photo and go to Platform Mgt > Service Integration > SMS Service:

Default Supported SMS Service Providers
Tencent Cloud
- Enable Tencent Cloud SMS service
- Create domestic SMS templates, and configure them in SMS Service after the templates are approved.

Alibaba Cloud
- Enable Alibaba Cloud SMS service
- Create domestic SMS templates, and configure them in SMS Service after the templates are approved.

Currently, we only support SMS template configuration for verification codes, which satisfy needs such as registering an account via phone number, binding a phone number to an account, and resetting a password. You only need to configure one of the mentioned service providers. If configured all simultaneously, a provider will be randomly chosen when sending verification codes
Additionally, there are some functions that involve sending custom SMS messages, which cannot be standardized. If you need to enable such functions (e.g. the send SMS node in workflows, inviting users to register via phone number, and phone number verification in public forms), you will need to apply for an account with a third-party SMS service provider, and then integrate it independently or customize development by the technical team. Once this mode is activated, the verification code sending channels of Tencent Cloud and Alibaba Cloud in the Platform Mgt will automatically be disabled.
Self Integration
Integration Steps
-
Create the configuration file
appextensions.jsonFor example:
/data/hap/script/volume/sms/appextensions.json:{
"WebhookUrl": "https://api.yourdomain.com/sms/webhook",
"WebhookHeaders": {}
}Configuration Parameters:
- WebhookUrl: Required, the API endpoint for receiving SMS messages.
- WebhookHeaders: Optional, custom request header parameters for authentication and other purposes.
-
Message Body Specification
HAP sends JSON data to
WebhookUrlviaPOSTwithapplication/jsonformat, containing two message types.SMS Message Format:
{
"Type": 1,
"Data": {
"Mobiles": ["Phone number"],
"Message": "SMS content",
"Signature": "Signature"
}
}Mobilesis the list of phone numbers to receive messages.Voice Verification Code Format:
{
"Type": 2,
"Data": {
"Mobile": "Phone number",
"Code": "Verification code"
}
} -
Mount the configuration file
appextensions.jsonto the microservice container at/usr/local/MDPrivateDeployment/sms/appextensions.json.Add the following to the
docker-compose.yamlfile under theappservice'svolumes:- ./volume/sms/appextensions.json:/usr/local/MDPrivateDeployment/sms/appextensions.json -
Restart the service