Sigfox backend has built-in functionality for sending email, but sometimes email isn’t convenient and you’d like to send Sigfox messages directly to a phone using SMS / text.
Thanks to 46elks and their wonderful API, sending SMS / text messages can be done with a very simple callback.
The URL pattern is 46elks‘ API endpoint, https://api.46elks.com/a1/SMS
HTTP method is POST and make sure “Send SNI” is checked.
46elks uses basic auth to prevent others from using your account. You can find your username and password in the “API credentials” section in your account.
To generate the authorization header, you can use an online tool like this, or use a terminal window and run the following command:
echo -n 'u092...a70e:0439...9577'| base64
where u092…a70e is the username and 0439…9577 is the password. Type “Authorization” in the first header field, and the contents generated above as value.
The payload needs three parameters:
- “from” is the phone number / text id that the message should appear coming from. I’ve selected to use the text “SF” prepended to the Sigfox device id.
- “to” is the phone number that the sms should be sent to.
- “message” is the contents of the message. I selected to just display the text “Data:” followed by the raw data from the device.
Save the callback and trigger a message from your device. You should get a message that looks similar to this:
Each outgoing message costs 0.038EUR. For full details, see 46elks’ price list.