Updated on 2022-02-22 GMT+08:00

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.