Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
blocks:app-note:sms42elks [2025-05-22 06:38] mattias created |
blocks:app-note:sms42elks [2025-05-30 08:43] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
=====Send texts to mobile===== | =====Send texts to mobile===== | ||
+ | This application note describes a way to send text messages (SMS) from blocks via a SMS gateway service. It can serve as a boilerplate for anyone that wants to develop a similar script for some other SMS gateway service, or simply just needs the functionality and is happy to use the https:// | ||
+ | ===== Installation ===== | ||
+ | You need a computer with a running blocks server with internet access and a web browser to test this application note. | ||
+ | |||
+ | We have prepared a PIXILAB-blocks-root folder containing everything you need to run the example. | ||
+ | {{ : | ||
+ | |||
+ | ====Getting your Credentials==== | ||
+ | |||
+ | Goto [[https:// | ||
+ | |||
+ | ====Configuring the User Script==== | ||
+ | Before we can send a text we must apply our credentials obtained in the previous step. They can be set as properties from a task. This must be done before attempting to send texts. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | In production environment one may instead store the credentials more securely in a file on the server. The script looks for the file script/ | ||
+ | |||
+ | < | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ====Send a text message from a task==== | ||
+ | |||
+ | Use a task to send a message, the phone number must include the country code, as shown in this example. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Aternatively, | ||
+ | |||
+ | ====Result==== | ||
+ | |||
+ | A text message should be received. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | If not, check your log file for any error messages related to the SMS service, such as incorrect credentials. |