User Tools

Site Tools


send_notifications

Functions to send notifications

SendSMS(phone_number, message)

Starting September 1, 2023, support for sending messages has been discontinued. Please use SendTelegramMsg function instead.

The SendSMS function sends a request to send an SMS to the number phone_number with the text message. Returns false if an error occurred and true if successful. Success does not mean delivering a message, but only success when creating a query. This function requires an Internet connection, an account in Level2 system and a positive balance in it. The service is paid.

Format of phone_number - only digits with the country code, without spaces, brackets, plus sign. For example, “380123456789”.

SendEmailMessage(emailAddress, subject, message)

The SendEmailMessage function sends a request to send an e-mail to emailAddress with the subject of the letter subject and the text message. Returns false if an error occurred and true if successful. Success does not mean delivering a message, but only success when creating a query. This function requires an Internet connection, an account in Level2 system and a positive balance in it. The service is paid.

The field message can contain the html-code.

Example:

function main (userId)
    SendEmailMessage("address@company.com", 
               "Cooler malfunction. Low oil level.", 
                "<p style='color: red;'>Cooler error #12 has occurred.</p><p>Низкий уровень масла.</p>");
end

The function is available since WebHMI 2.7.4710 version.

SendTelegramMessage(chatId, message)

The SendTelegramMessage function sends a message with the text message to the chat with Id = chatId. Returns 1 if an error occurred and 0 if successful. Success does not mean delivering a message, but only success when creating a query. To use this function, you must have an Internet connection, an account in the Level2 system. The service is free. To get ChatId, go to http://telegram.me/webhmibot on your mobile phone (by pre-installing Telegram) and start the dialog with bot webhmibot using the /start command. In response you will receive a message with a unique chatId.

Example:

Please refer for the example of this function on Lua scripts.

SendViberMessage(chatId, message)

The SendViberMessage function sends a message with the text 'message' to the chat with Id = chatId. Returns 1 if an error occurred and 0 if successful. Success does not mean delivering a message, but only success when creating a query. To use this function, you must have a working Internet connection, an account in the system Level2 and a positive balance in this system. The service is chargeable. This feature is available starting with firmware version 2.4.4227. To get ChatId, go to http://viber.com/webhmi on your mobile phone (having previously installed Viber), click 'Have a look' button.

You will be taken to the public WebHMI account. Go to the personal messages of the public account by clicking the button at the top right.

Write any text in the chat. In response you will receive a message with a unique chatId chat ID.

send_notifications.txt · Last modified: 2023/10/02 11:37 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki