Sending Messages
In some scenarios, a skill needs to send messages to users' mobile phones or email addresses. For example, a skill can detect strangers and needs to send messages to the users after detecting strangers. You can call the following API to implement this function:
- API calling
hilens.send_msg(subject, message)
Only firmware 1.0.7 and later versions provide this API.
- Parameter description
Table 1 Parameters Parameter
Mandatory
Type
Description
subject
Yes
Character string, whose length cannot be 0
Subject configured when a message is sent. If the message is sent to the user's mailbox, this field is the subject of the email. If the message is sent to the user's mobile phone, this field is invalid.
You can set the message sending mode (by email or mobile phone) when using the skill. To set the message sending mode, log in to the Huawei HiLens console and set the mode. For details, see Subscribing to Messages.
message
Yes
Character string
Message content to be sent.
- Return value
If the operation is successful, 0 is returned. Otherwise, the operation fails.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot