SMS from Sigfox using 46Elks

Send SMS / text message directly from Sigfox backend using 46elks

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.

46Elks Sigfox send SMS callback

The URL pattern is 46elks' API endpoint,
Use HTTP method is POST.
Make sure "Send SNI" is checked.

Content-type needs to be application/x-www-form-urlencoded. Note that I have included a newline just before SeqNumber in the Body to make the format of the SMS prettier:

from=SF{device}&to=+<YOUR_NUMBER>&message=Data {data}
SeqNumber {seqNumber}

Authorization header

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:

Received SMS from Sigfox using 46Elks API


If you run into trouble, check the output of the Sigfox callback by going to Device -> (your device) -> Messages in Sigfox Backend and click on the callback icon:

Sigfox SMS 46Elks callback result

You can also use 46Elks excellent logs at to see how they treated the callback request:

46Elks log from Sigfox callback

Another helpful tool is to use curl:

curl -S -s -i -X POST -H "Authorization: Basic dT<REMOVED>c3" -H "Content-Type: application/x-www-form-urlencoded" -d"from=SFtest&to=+46<REMOVED>31&message=Test" ''

A working response should look like this:

HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Tue, 31 Mar 2020 12:35:59 GMT
Content-Type: application/json
Content-Length: 237
Connection: keep-alive
{"status": "created", "direction": "outgoing", "from": "SFtest", "created": "2020-03-31T12:35:59.679121", "parts": 1, "to": "+46<REMOVED>31", "cost": 3500, "message": "Test", "id": "s5f045776116903bca259097879385968"}


Each outgoing message costs 0.038EUR. For full details, see 46elks' price list.

16 thoughts on “Send SMS / text message directly from Sigfox backend using 46elks

  1. Hello,
    Could you help me?
    I would like to do the same thing with a voice call.
    Thank you in advance.


  2. Hi Mikael,
    I tried to execute your instructions to send SMS directly from the sigfox callback using and verifying step by step all your tutorial but I receive the error message SMS ERROR 400 bad request!
    Could you help me?
    Marco Andrenacci

    1. Hi Marco.

      There is probably a mistake in the callback setting. The callback i made for this tutorial still works, I verifed just now.
      The result of the callback (can be seen on the Messages page for your device in the Sigfox Backend) might give some clue to what's wrong.

      This is the result of my callback:
      Sigfox backend successful callback result

      1. Hi Mikael, this is the error reported by Sigfox text box Callback Error:

        [ERROR] – Base station 2771 – 1 second
        400 – Bad Request – #1
        POST HTTP/1.0
        authorization : Basic dWFB
        content-length : 103
        accept-encoding : gzip,deflate
        accept-language : fr
        host :
        accept-charset : UTF-8;q=0.9,*;q=0.7
        user-agent : SIGFOX
        content-type : application/json

        "from": "SF306701",
        "to": "+393346903778",
        "message": "Data: 0a2100000000780a14000000"

        1. Interesting. When I perform the request using my own credentials, using curl, I get a success message from 46 Elks:
          curl -i -X POST -H "Authorization: Basic dTc3" --data '{"from": "SF306701","to": "+3978","message": "Mikael test"}' -H "Content-Type: application/json" ''
          HTTP/1.1 200 OK
          Server: nginx/1.10.3
          Date: Tue, 31 Mar 2020 07:33:02 GMT
          Content-Type: application/json
          Content-Length: 225
          Connection: keep-alive

          {"status": "created", "direction": "outgoing", "from": "SF306701", "created": "2020-03-31T07:33:02.060744", "parts": 1, "to": "+3978", "cost": 6400, "message": "Mikael test", "id": "s27850fe6a9407ef96111210330c67e14"}

          But when I perform the same call with your credentials (you should reset them to avoid anyone else using up your credit), I get the following response:
          HTTP/1.1 400 Bad Request
          Server: nginx/1.10.3
          Date: Tue, 31 Mar 2020 07:34:42 GMT
          Content-Type: text/plain
          Content-Length: 155
          Connection: keep-alive

          Support for application/json is deprecated and has been disabled. Please use application/x-www-form-urlencoded instead (like a regular POST of a HTML form)

          So it seems 46Elks has removed support for using json. That's a pity, because json is what most systems use today, and Sigfox Backend doesn't support the older application/x-www-form-urlencoded required by 46Elks.

          1. Thanks to great help from Victoria at 46Elks, I have updated the guide with new instructions that work with the latest version of the 46Elks API.

            The reason the old instructions didn't work is that 46Elks have updated their API to only accept urlencoded data. This change lowers complexity, both for API uses and for 46Elks internal support and maintenance.

            Big thanks to Marco Andrenacci for noticing the problem.

  3. Hi Mikael,
    many thanks to you for your help and support ……
    Marco Andrenacci

  4. Hi Mikael,
    I ran some SMS sending tests and everything is OK!
    I ask you one last thing, as I will use this SMS service to send alarm reporting like theft, robbery, assault etc. etc.
    replacing message = Data {data} and SeqNumber {seqNumber} with more understandable "Theft Alarm"?
    Many thanks

  5. Hi Mikael,
    sorry if I still ask you for help but I don't understand how to correctly write the message "THEFT ALARM"
    I tried to write it after message = THEFT ALARM but the message was not sent!
    With reference to your string (from=SF{device}&to=+&message=Data {data}
    SeqNumber {seqNumber}, how can I insert the phrase THEFT ALARM.
    Many thanks
    Cordially Marco

      1. Hi Mikael,
        I tried to send an alarm message using your string but the message arrives at the Sigfox backend but strangely no SMS is sent to me!
        If instead I use the mode you have published, I receive the SMS message with a delay of only three seconds from the end of the radio sequence of the Sigfox module, for alarm applications it is an exceptional result!
        Sorry again if I ask you for help ……….

        Many thanks

  6. Hi Mikael,
    everything OK I had made a syntax error!
    I have tried the SMS service several times and it works perfectly, I was wondering if it was possible to insert a second or more phone numbers to the body to send the same SMS to!
    If this were possible you would show me how to write the string in the body.
    Thank you


Leave a Reply

Your email address will not be published. Required fields are marked *