Automatically translate this page?
30 November, 2017

Configuring a tracker via SMS: Teltonika set up over SMPP protocol

Sending text messages to a tracking device is a convenient alternative to configuring it using a wired connection to the laptop — the device can be anywhere.

We assume that you’ve already got the idea behind flespi gateway: a device connects to your gateway channel’s IP:port and then flespi magic takes care of all the rest. But what about the very first step — how to configure a device to send telemetry to a certain IP:port? The most experienced hardware engineers in our company remember good old times when the set of tools for device configuration included screwdrivers, wires, connectors, soldering iron, oscilloscope, unicorn hooves etc. Today I don’t even need to touch the device to configure it! All I need is a laptop and flespi.

Disclaimer: this is a hardcore article since the solution discussed here uses exclusively REST API calls from the flespi documentation. No UI, no diagrams, no cat pictures. People without STEM degree are advised to read further only under the supervision of a qualified engineer.

Configuring SMPP connection

I’ve got Teltonika FMB920 with a SIM-card installed, and a channel operated via Teltonika protocol. Hmm, how do I pair them up?

All modern trackers support configuration via SMS – the feature I am going to use here. To send a configuration command to the tracker in a text message I need to set up an SMPP account.

Note: SMPP — Short Message Peer-to-Peer is an open standard protocol designed to provide a communication interface to transfer SMS.

SMPP services provide simple methods to send and receive text messages. Designed for high-load services and guaranteeing reliable message delivery SMPP protocol is a rather complex entity. But if you use flespi, all the complexity is invisible to you. You only need to provide SMPP account credentials. Basic SMPP instance in the flespi platform is a modem. You can create a modem instance with a gateway POST gw/modems REST API call:

flespi gateway api modems smpp

There are many SMPP service providers that you can use to set up SMS communication with your trackers:,,,, etc. So before doing anything else, you need to sign up for the services with one of the SMPP providers. The result should be a URI to establish SMPP connection and login details to authorize. This is enough to create a modem instance (establish an SMPP connection).

Note: according to platform limitations you can create only one modem instance. If you entered wrong credentials or want to add another instance, use PUT /gw/modems method to edit data or DELETE /gw/modems to delete an outdated instance and create a new one. 

To check that SMPP connection was successful make a GET /platform/logs request.

Sending configuration commands to the tracker

Well done. The next step is to send configuration commands to the device. But which ones? Execute GET /gw/protocols/name=teltonika/commands/all. and look for the following commands:

  • set_server
  • set_apn

The full description of the set_sever command looks like:

{     "title": "Configure server",
"description": "Reconfigures device to send data by GPRS to specified target server",
"name": "set_server",
"address": ["sms"],
"required": [ "host", "port" ],
"properties": {
"port": {"title": "Server port","type": "integer”},
"host": {"title": “Server host or IP","type": "string"},
"transport": {"default": "tcp","enum": ["tcp","udp"], "title": "Transport protocol type: TCP or UDP", "type": "string"},
"loginpass": {"default": " ","title": "Device username+password","type": "string"}

Now that I know how to create commands, let’s send them to my Teltonika tracker:

  1. go to Gateway API -> commands -> POST /channel/name=teltonika/commands-queue
  2. add a command to the commands queue:
    gateway api commands queue
  3. hit “Try it out!” button and verify that no errors occurred in the result;
  4. perform steps 1-3 above with the command name “set_apn”.

That’s it for now. In a little while the tracker will receive and apply the settings and the channel logs will announce that the tracker got connected to the channel and is sending telemetry. Or check the connections info:

flespi panel connections info

You can find the messages received via SMPP connection in the Platform API. Use GET /customer/logs request to limit or filter the output. E.g. the request like

flespi platform api log request

will respond the following

flespi logs response body

Alternatively, specify “event_code” with required value in the “filter” field. E.g. filter “event_code=200” will return all SMS received by the modem. The full list of event codes is available in the documentation.

Please note that not all protocols declaring SMS support in the specs can already work so via flespi. If the protocol you intend to use operates via SMS but says “no SMS option” in Protocols -> Commands, please contact us.

Try texting your devices but don't mistake flespi for the Facebook Messenger ;)

Get the latest updates and monthly newsletters from flespi in your inbox

When The Clouds Close Down: Feeding GPS Data to Microsoft Azure IoT

How to get messages from GPS trackers in MS Azure IoT via flespi telematics hub.

12 July, 2018 | about flespi | Jan Bartnitsky

MQTT scores again: flespi REST API over MQTT

How to use flespi HTTP REST API over MQTT and when not to do that.