GoiMessage Logo

API Documentation

Documentation for Sending OTP and Marketing Messages via iMessage Using GloID API

1. API Overview

The API allows you to send different types of messages on iMessage using pre-configured templates.

2. Endpoint URL

POST https://app.gloid.io/msg2/send

3. Requirements

  • Content-Type: application/json
  • Authorization: Bearer <token> (replace <token> with your API key)

4. Request Parameters

ParameterTypeRequiredDescription
phonestringYesRecipient's phone number in international format (e.g., +19870123456)
typestringYesMessage type:
"a" - authorization
"i" – informational
"m" – marketing text
"mp" – marketing with media content
code, url (any parameter)stringNoCode, url to be inserted into the message template
tidstringYesRouting template ID for message delivery

5. Usage Examples

Request:

curl -L 'https://app.gloid.io/msg2/send' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <token>' \
-d '{
  "phone": "+19870123456",
  "type": "m",
  "code": "1234",
  "tid": "123456789"
}'

Response:

{
  "id": "18f5dec5-0aff-424b-88ee-abe1f719cfb9"
  "status": "error" | "pending" | "success"
}

6. Message Template Examples

Template 1:

Message template:

GloID authorization code: <code>

Input parameters:

  • code: "5615"

Final message:

GloID authorization code: 5615

Template 2:

Message template:

Here is the discounted insurance you asked us about. Check it out: url.com&lt;url&gt;. Reply STOP to opt out.

Input parameters:

  • url: "/a/67615"

Final message:

Here is the discounted insurance you asked us about. Check it out: url.com/a/67615. Reply STOP to opt out.

7. Response Status Descriptions

StatusDescription
errorThe message failed to send (e.g., issues with the device, request, or iMessage permissions)
pendingThe message has been accepted for sending (the case of sending a message without checking the status in the same request)
successThe message has been successfully delivered to the recipient

8. Notes

  • The field `tid` determines the routing template for SMS messages, which can include logic such as country codes, time of day, default routes, and fallback routes
  • Ensure the recipient's device supports iMessage and the service is activated for successful delivery

9. Errors and Diagnostics

Common causes of the "error" status:

  1. Incorrect phone number format
  2. The recipient's device does not support iMessage (e.g., Android)
  3. iMessage is disabled on the recipient's device
  4. Authorization errors (invalid Bearer token)

10. Callback

It is possible to configure webhook notifications about the status of message delivery.

Example string URL to pass the result:

https://your_url/smsState?sms-id=<SMSID>&state=<state>

where status=1 – delivered, status=7 – not delivered (final status)

11. Code Examples

fetch("https://app.gloid.io/msg2/send", {
  method: "POST",
  headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer <token>"
  },
  body: JSON.stringify({
      phone: "+15552028765",
      type: "a",
      code: "1234",
      tid: "123456789"
  })
})
.then(response => response.text())
.then(console.log)
.catch(console.error);