Sending Messages
You can only send messages to contacts who have opted-in/subscribed through the Loop Message. You can't send messages to random recipients or contacts who have given you consent to contact them through other services.
Send a single message to a specific contact
POST https://a.loopmessage.com/api/v1/message/send/
You can use a contact ID or a phone number/email address (depending on what the user provided you with when subscribing).
Headers
Authorization*
String
API Key. Required*.
Content-Type*
String
application/json
Request Body
contact*
String
Phone number, Email, or Contact ID.
text*
String
Your message text
subject
String
Optional. Your message subject. A recipient will see this subject as a bold title before the text.
sender
String
Optional. ID of your sender name. Send message from a specific sender name.
attachments
Array
Optional. An array of strings. The string must be a full URL of your image. URL should start with
https://. HTTP links (without SSL) are not supported. This must be a publicly accessible file URL: we will not be able to reach any URLs that are hidden or that require authentication. Max length of each URL: 256 characters, max elements in the array: 3.
effect
String
Optional. Add effect to your message. Possible values: slam, loud, gentle, invisibleInk, echo, spotlight, balloons, confetti, love, lasers, fireworks, shootingStar, celebration.
You can check the Apple guide about expressive messages.
reply_to_id
String
Optional. The message_id that you got from the webhook.
You can check the Apple guide about the reply to feature.
passthrough
String
Optional. A string of metadata you wish to store with the checkout. Will be sent alongside all webhooks associated with the outbound message. Max length: 1000 characters.
{
"message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": true,
"contact": "+13231112233",
"text": "text"
}Phone number will be converted to the next format +13231112233, without spaces and brackets. Email will be converted into a lowercase format.
{
"message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": false,
"message": "error description",
"contact": "+13231112233",
"text": "text"
} "message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": false,
"message": "error description",
"contact": "+13231112233",
"text": "text"
}Important
When you receive success response with code 200 from send request, it means that the server accepted your request for send and added it to the queue. But this does not mean that the message was delivered to the recipient or will be sent.
To handle messages status for this request, need to observe Webhooks or use API method to check the status by message ID which you received in JSON response.
We recommend using webhooks to track statuses, as you will receive a callback as soon as an event is fired.
Send single message to iMessage group

POST https://a.loopmessage.com/api/v1/message/send/
Headers
Authorization*
String
API Key. Required*
Content-Type*
String
application/json
Request Body
group*
String
iMessage group ID. You can only get this ID from the webhook: message_inbound.
text*
String
Your message text
subject
String
Optional. Your message subject. A recipient will see this subject as a bold title before the text.
sender
String
Optional. ID of your sender name. Send message from a specific sender name.
attachments
Array
Optional. An array of strings. The string must be a full URL of your image. URL should start with
https://..., http links (without SSL) are not supported. This must be a publicly accessible URL: we will not be able to reach any URLs that are hidden or that require authentication. Max length of each URL: 256 characters, max elements in the array: 3.
effect
String
Optional. Add effect to your message. Possible values: slam, loud, gentle, invisibleInk, echo, spotlight, balloons, confetti, love, lasers, fireworks, shootingStar, celebration.
You can check the Apple guide about expressive messages.
reply_to_id
String
Optional. The message_id that you got from the webhook.
You can check the Apple guide about the reply to feature.
passthrough
String
Optional. A string of metadata you wish to store with the checkout. Will be sent alongside all webhooks associated with the outbound message. Max length: 1000 characters.
{
"message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": true,
"group": {
"group_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"name": "String", # Optinal field
"participants": ["+13231112233", "+13232223344"]
},
"text": "text"
}{
"message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": false,
"message": "error description",
"group": {
"group_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"name": "String", # Optinal field
"participants": ["+13231112233", "+13232223344"]
},
"text": "text"
} "message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": false,
"message": "error description",
"group": {
"group_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"name": "String", # Optinal field
"participants": ["+13231112233", "+13232223344"]
},
"text": "text"
}Send a voice message

POST https://a.loopmessage.com/api/v1/message/send/
Headers
Authorization*
String
API Key. Required*.
Content-Type*
String
application/json
Request Body
contact*
String
Phone number or Email.
media_url*
String
The string must be a full URL of your audio file. URL should start with https://..., http links (without SSL) are not supported. This must be a publicly accessible URL: we will not be able to reach any URLs that are hidden or that require authentication. Max length of each URL: 256 characters.
Audio files of the following formats are supported: mp3, wav, m4a, caf, aac.
sender
String
Optional. Your dedicated sender name. This parameter will be ignored if you send a request to a recipient who is added as a sandbox contact. DON'T use a phone number as a value for this parameter.
passthrough
String
A string of metadata you wish to store in the request. Will be sent alongside all webhooks associated with the outbound message. Max length: 1000 characters.
{
"message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": true,
"recipient": "+13231112233",
"text": "text"
}Phone number will be converted to the next format +13231112233, without spaces and brackets. Email will be converted into a lowercase format.
{
"message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": false,
"message": "error description",
"recipient": "+13231112233",
"text": "text"
} "message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": false,
"message": "error description",
"recipient": "+13231112233",
"text": "text"
}Send a reaction

POST https://a.loopmessage.com/api/v1/message/send/
Headers
Authorization*
String
API Key. Required*.
Content-Type*
String
application/json
Request Body
contact*
String
Phone number or Email.
message_id*
String
The message_id that you got from the webhook.
reaction*
String
Possible values:
love, like, dislike, laugh, exclaim, question, -love, -like, -dislike, -laugh, -exclaim, -question. Reactions that started with - mean "remove" it from the message.
You can check the Apple guide about reactions and tapbacks.
Failed responses
Please note that in most cases, handling failed responses can be far more important than handling successful ones. If something goes wrong, it may help to quickly take further action.
If your request has a failed status, you will receive a JSON response with the following content:
{
"success": false,
"code": 100,
"message": "string"
}It is important to implement handling the "code" field. It helps to understand how to manage your further actions according to the error code.
Response example
{
"message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": true,
"recipient": "+13231112233",
"text": "text"
}Phone number will be converted to the next format +13231112233, without spaces and brackets. Email will be converted into a lowercase format.
{
"message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": false,
"message": "error description",
"recipient": "+13231112233",
"text": "text"
} "message_id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
"success": false,
"message": "error description",
"recipient": "+13231112233",
"text": "text"
}Limits
Messages
Max text length in each message must be less than 10000 characters. Otherwise, all extra characters will be truncated. If you have larger requirements, we recommend breaking the message up into several smaller messages.
You can use characters from any languages, emojis and
\nfor new lines. HTML tags aren't supported.If you need to send messages to a few contacts who haven't recently sent you any inbound messages, you must keep a minimal interval of 2 minutes between each such message. Otherwise, your request may be rejected.
Attachments
When you send an attachment file for the first time, it takes a while for it to download into the cache before it's sent to the recipient. If your attachments are large (more than a couple of megabytes), it will take a while for them to be delivered to your contact. If you update your file but it still has the same URL, the cached version still be used. To avoid a cached version, you need to change the file URL (for example, by renaming the file name).
Best Practices
Handling failed cases
It's recommended to implement handling of the next failed/error cases:
If the response code for sending message is not equal
200. In most cases, it means that something is wrong with your parameters.You receive a webhook with the type
message_failedor message status isfailed. This means that the message can't be delivered to this recipient. Check theerror_codeJSON field to better understand your case.You receive a webhook with the type
message_sent, but thesuccessJSON field contains thefalsevalue. That means a message was successfully sent, but it was unsuccessfully delivered on the recipient side. Examples: your recipient blocked you or uses filters from unknown senders. This case equal to "Not delivered" status in the Messages app.You receive a webhook with the type
message_timeoutor message status istimeout. This happens if you passed thetimeoutparameter in the request to send a single message. In this case, this means that we failed to deliver a message within the specified time and it was assigned the timeout status.
Last updated