How do I send and receive SMS using the REST API?

You can use the Hologram REST API to send and receive SMS messages on your device.

Send an SMS to your device

Make a request to the following endpoint:

POST https://dashboard.hologram.io/api/1/sms/incoming

With the following body:

{
  "deviceid": 1234,
  "body": "Hello world!"
}

The Device ID is the unique device identifier of the device you would like to message.

This will send a SMS from Hologram to your device from a +44 number. Your device can reply back to this, and the response appears in the logs.

See device responses from the log history

Make a request to the following endpoint:

GET https://dashboard.hologram.io/api/1/csr/rdm?deviceid=[YOUR_DEVICE_ID]

The response will look like this:

{ 
"success": true,
"limit": 25, "size": 1,
"data":
{
"id": 99999,
"logged": "2018-06-19 19:39:08.407233",
"orgid": 0001,
"deviceid": 01234,
"record_id": "1abc2d-34f5-67g9-a0123-3456bc0002",
"device_metadata": "{}",
"data": {
"received": "2018-06-19 19:39:07+00:00",
"authtype": "deviceid",
"tags": ["_TAG_1245_","_DEVICE_1502_", "_SMS_DO_"],
"device_name": "Test Device",
"source": 1502,
"record_id": "1abc2d-34f5-67g9-a0123-3456bc0002",
"data": "UmVwbHk=",
"device_id": 160502
},
"matched_rules":
{
"ruleid": 2655,
"error": true,
"result_data": ""
} ,
"tags": [ "_SMS_DO_", "_DEVICE_1502_", "_TAG_1245_" ]
}
}

Note that the "data": "UmVwbHk=" is the Base64 encoded form of the SMS reply from your device, and will need to be decoded, for example this string decodes as follows:

"UmVwbHk=\" - "Reply"

There is more documentation for expanding the csr query here: https://hologram.io/docs/reference/cloud/http/#/reference/hologram-cloud/data-engine-messages/list-csr-messages

Was this article helpful?
0 out of 0 found this helpful