Messages API
Allows you to send messages containing text, image, audio, video or file to Contacts in the platform.
Channel token is required to access this API resource.
Tokens can be generated by using the key icon, next to the desired channel in Settings.
The Contacts API is composed of several type of requests:
This request sends a text message directly to the Contact as per defined in the Endpoint.
POST /v1/message/sendContent/{contactId}
curl -X POST \
https://app.respond.io/api/v1/message/sendContent/{contactId} \
-H 'Authorization: Bearer {channel_token}' \
-H 'Content-Type: application/json' \
-d '{
"body": [
{
"type" : "text",
"text" : "Hi there"
}
]
}'
{
"status": "Success",
"message": "Message Sent",
"data": []
}
Please note that in case of Viber Channel - due to a certain limitation - the Contact ID needs to be provided in a Base64 encoded format.
This request sends attachment in form of URL directly to the Contact as per defined in the Endpoint. The file can either be image, video, audio or file.
POST /v1/message/sendContent/{contactId}
curl -X POST \
https://app.respond.io/api/v1/message/sendContent/{contactId} \
-H 'Authorization: Bearer {channel_token}' \
-H 'Content-Type: application/json' \
-d '{
"body": [
{
"type" : "image",
"url" : "http://abc.com"
}
}
]
}'
{
"status": "Success",
"message": "Message Sent",
"data": []
}
curl -X POST \
https://app.respond.io/api/v1/message/sendContent/{contactId} \
-H 'Authorization: Bearer {channel_token}' \
-H 'Content-Type: application/json' \
-d '{
"body": [
{
"type" : "video",
"url" : "http://abc.com"
}
}
]
}'
{
"status": "Success",
"message": "Message Sent",
"data": []
}
curl -X POST \
https://app.respond.io/api/v1/message/sendContent/{contactId} \
-H 'Authorization: Bearer {channel_token}' \
-H 'Content-Type: application/json' \
-d '{
"body": [
{
"type" : "audio",
"url" : "http://abc.com"
}
}
]
}'
{
"status": "Success",
"message": "Message Sent",
"data": []
}
curl -X POST \
https://app.respond.io/api/v1/message/sendContent/{contactId} \
-H 'Authorization: Bearer {channel_token}' \
-H 'Content-Type: application/json' \
-d '{
"body": [
{
"type" : "file",
"url" : "http://abc.com"
}
}
]
}'
{
"status": "Success",
"message": "Message Sent",
"data": []
}
This request send text message with quick replies for the receivers.
curl -X POST \
https://app.respond.io/api/v1/message/sendContent/{contactId} \
-H 'Authorization: Bearer {channel_token}' \
-H 'Content-Type: application/json' \
-d '{
"body": [
{
"type":"quick_reply",
"title" : "What is you favorite color?",
"replies" : ["Black","Blue","Grey","Red"]
}
]
}'
{
"status": "Success",
"message": "Message Sent",
"data": []
}
{
"status": "error",
"message": "API Token is invalid.",
"data": []
}
{
"status": "error",
"message": "Too many requests",
"data": []
}
{
"status": "error",
"message": "405 Method Not Allowed.",
"data": []
}
{
"status": "error",
"message": "Message String",
"data": []
}
{
"status": "error",
"message": "Sorry, Url provided is not an image/audio/video file",
"data": []
}
- Only one message can be sent in 1 API call.
- API has rate limit of 25 RPS.
- 10 Quick replies with 20 characters each are allowed.
- Survey is not cancelled by default.
forceCancelSurvey : true
must explicitly be sent in the payload. - Contact status will not be changed on API call.
Last modified 2yr ago