If you need to utilize a temporary callback service, consider using https://webhook.site/ or speak with a Mobility API Development Team about other options.
GEMM API Callbacks
The GEMM API uses callback services (also called webhooks) to send messages to your application. There are following categories of callback messages:
- Asynchronous API Responses - Messages that contain the status or requested information from API requests that take time to process, such as suspending or restoring devices.
Subscribing to Callback Service
To receive callback messages, you will need to create and deploy a web service that can validate and process REST messages that conform to the Callback Examples. You then need to share the URL of your web service with GemmApiSupport@granitenet.com so that it can be registered under your account to send the callback messages.
NOTE: You will have to provide a way through your firewalls for the callback messages, such as by whitelisting the IP address used by the Granite servers. The IP address is:
- 34.21.11.224
NOTE: To test your callback listening services in a non-production environment, you must have an external URL for the computer or server that is hosting the web services. The GEMM Platform cannot send callback messages to a system that does not have a URL.
Callback Security
GEMM sends an X-API-KEY header with every callback message. This header contains a 36 characters unique value associated with your API account. Check it on each request, like this:
If your webhook client is also configured with an identity endpoint and credentials, GEMM additionally sends an Authorization: Bearer <token> header. The bearer token is optional, so do not require it; X-API-KEY is the header that is always sent. See GEMM Webhook Service Security for how to validate the token.
Callback Reliability
Your callback listener web service must acknowledge receipt of a callback message by sending back a 2xx status code, such as 200, 201, 202 or 204. Callback messages that are not acknowledged by your application will be resent by GEMM 4 more times, about one minute apart, for a total of 5 attempts to send the message. Failed (unacknowledged) callback messages are archived for 30 days. During the 30 day period, you can contact support with the TransactionID of failed callbacks and ask for them to be resent.
Receiving Asynchronous API Callbacks
For API service requests that require significant processing time, such as suspending service for a device, the GEMM API replies first with a synchronous response that simply acknowledges the request and allows your application to continue processing. Later, the API sends an asynchronous callback message, reporting the results of the request.
The synchronous response contains a unique TransactionID. The callback message will contain the same TransactionID so that you can correlate the callback with the original API request.
Info
Callback Fields
| Parameter | Type | Description |
|---|---|---|
requestType | string | Name of the requested action, for example Suspend, Restore or Deactivate. |
transactionID | string | The transactionID returned in the immediate response. All callbacks for a request share the same transactionID. |
ticketId | string | Support ticket number for this SIM. Included when a ticket is created for the request. |
simInfo | object | Information that identifies the SIM in this callback. |
iccid | string | ICCID of the SIM. |
eid | string | EID of the SIM360. Returned instead of the ICCID for SIM360 callbacks. |
msisdn | string | MSISDN of the SIM. |
imei | string | IMEI of the device. |
simCarrier | string | Carrier of the SIM. |
result | object | Result status for this callback. |
status | string | success or failure. |
message | string | Included in successful callbacks. The value is always Request completed successfully. |
errors | array of objects | Included in failed callbacks. Each entry has errorCode and errorMessage. |
callbackCount | integer | The number of times this callback message has been sent. |
maxCallbackThreshold | integer | The maximum number of times this callback message is sent if it is not acknowledged. The value is 5. |
Callback Examples
Suspend
Restore
Deactivate
Failure Responses
A failed request is reported in the same message structure, with the errors listed in result.errors: