Sending Messages

Sending SBD messages to your device is as simple as sending the following payload to the Rock7_MT queue.

{
  "id": "your-own-id-goes-here",
  "imei": "123412341234123",
  "payloadHex": "ff00ff00ff",
  "vehicle": "IRIDIUM",
  "version": 1
}

This can be sent in a few lines of code:

import com.amazonaws.services.sqs.AmazonSQS;
import com.amazonaws.services.sqs.AmazonSQSClientBuilder;
import com.amazonaws.services.sqs.model.SendMessageResult;
import org.json.simple.JSONObject;

public class SQSDemo {
    private static final AmazonSQS sqs = AmazonSQSClientBuilder.defaultClient();
    public static final String QUEUE_NAME = "Rock7_MT";

    public static void main(String[] args) {
        //Build a JSON object to contain your message
        JSONObject message = new JSONObject();
        message.put("id", "your-own-id-goes-here");
        message.put("imei", "123412341234123");
        message.put("payloadHex", "ff00ff00ff");
        message.put("vehicle", "IRIDIUM");
        message.put("version", new Integer(1));

        // Send the message
        SendMessageResult sendMessageResult = sqs.sendMessage(QUEUE_NAME, message.toJSONString());
    }
}
import boto3
import json

# Get the service resource
sqs = boto3.resource('sqs')

# Get the queue
queue = sqs.get_queue_by_name(QueueName='Rock7_MT')

# A python object
payload = {
  "id": "your-own-id-goes-here",
  "imei": "123412341234123",
  "payloadHex": "ff00ff00ff",
  "vehicle": "IRIDIUM",
  "version": 1
}

# Send your message
queue.send_message(MessageBody=json.dumps(payload))

After your message has been sent to the Iridium network, you will receive a reply on the Rock7_MT_Confirm queue.

{
  "id": "your-own-id-goes-here",
  "timeOfSubmission": "2019-10-29T15:01:53.294Z",
  "vehicle": "IRIDIUM",
  "vehicleMeta": {
    "mtMessageStatus": 1
  },
  "result": "DELIVERED_TO_NETWORK",
  "version": 1
}

A positive myMessageStatus value indicates your message's queue position. Negative values indicate a problem:

Error Responses

Code
-1Invalid IMEI
-2Unknown IMEI
-3Payload size exceeded maximum allowed
-4Missing payload
-5MT message queue full
-6MT resources unavailable
-7Protocol error
-8Ring alerts disabled
-9IMEI Not attached

IAM Permissions

{
    "Version": "2012-10-17",
    "Statement": [
      {
        "Sid": "mt",
        "Effect": "Allow",
        "Action": [
          "sqs:SendMessage"
        ],
        "Resource": "arn:aws:sqs:<YOUR_REGION>:<YOUR_ACCOUNT_ID>:Rock7_MT"
      },
      {
        "Sid": "confirm",
        "Effect": "Allow",
        "Action": [
          "sqs:ReceiveMessage",
          "sqs:DeleteMessage"
        ],
        "Resource": "arn:aws:sqs:<YOUR_REGION>:<YOUR_ACCOUNT_ID>:Rock7_MO_Confirm"
      }
    ]
}

To send a message, only the first statement mt is required. In some cases you might split this into two policies if you process the confirmations using a different server.