Jasper is an IoT platform providing flexible connectivity management for IoT devices. Many cellular service providers (like Telefonica, EE, Beeline, KPN, Tele2, Swisscom etc.) partner with Jasper to provide Jasper API in addition to the cellular service, in particular, the API to send SMS to SIM-cards owned by providers. This article shows the way to utilize Jasper modem type in flespi to send messages using the ICCID instead of the phone number (which is cheaper and well-suited for communication with devices).
How to set up a Jasper modem in flespi
Jasper API uses ICCID instead of a regular phone number!
The configuration of the Jasper modem has the following fields:
- username — that is used to authorize on Jasper server, e.g:
- api_key — go to Help -> API -> REST APIs -> API key and copy the key string.
host — where to send the request. Common Jasper API page shows the following host: https://restapi{PODnumber}.jasper.com.
Make sure to select the right POD number — e.g. Beeline uses POD=10 so the URI looks like https://restapi10.jasper.com.
If everything is configured correctly, you can try to configure a device via SMS and see the log of the Jasper modem in the following format:
{
address : "ICCID of target device"
event_code : 201
event_origin : "gw/modems/your-modem-id"
event_text : "sent"
send_code : 0
text : "SMS text sent to device"
timestamp : 154356789.12345 // timestamp of the request
type : "text" // may be text or binary
}
Bonus! Hacker mode
As flespi sends requests in the Jasper format (which is known and open), you can tune your HTTP server to accept requests from flespi in Jasper format. If you have your own system that can send SMS to devices using ICCID, you can set up an HTTP server to accept requests from flespi and tune it in the following way:
Attribute | Value |
Method | POST |
Authorization header | base64-encoded string “username:api_key” |
URI | host/rws/api/v1/devices/{ICCID}/smsMessages |
Data | "{\"messageText\": \"message_text\"}" |
Where username, api_key, and host are taken from the modem configuration, ICCID is a flespi device phone number and message_text is the message itself.
The response from your server must be 200 code and JSON:
Result | Response | Meaning |
Success (code 200) | {"smsMessageId":6704925119} | smsMessageId must be not 0 number. Jasper users can track SMS using this ID |
Fail (code not 200) | {"errorMessage":"Resource not found - Invalid ICCID","errorCode":"20000001"} | errorMessage will be passed to modem logs |
***
Using Jasper modem type in flespi may be a more cost-efficient option if you heavily rely on SMS for configuring the tracking devices. Telecom providers charge less for sending messages to the ICCID engraved on the SIM-card. So you have one more option now — keep it in mind for your current or future projects.