Skip to content

Messages

Run in Postman

Messages resource is the main entry point for sending messages. You have to specify a channel and contact to deliver the message.

The structure of JSON body is the same for all the channels. However, not all message types are supported by all channels.

Response Body Params

Parameter Type Description
id string Id of the message.
direction string Specifies if the message has been received or sent: received, sent.
sent string Iso 8601 Timestamp - time when the message was sent.
delivered string Iso 8601 Timestamp - time when the message was delivered. null means that it hasn’t been delivered yet.
read string Iso 8601 Timestamp - time when the message was read. null means that it hasn’t been read yet.
channel object Channel in which the message was sent or received.
contact object Message belongs to a contact.
content object Content of the message.

GET https://api.amio.io/v1/channels/{channel_id}/contacts/{contact_id}/messages

Parameters

Name In Type Required Description
channel_id path string yes Id of the channel.
contact_id path string yes Id of the contact.
max query integer Maximum number of messages to be listed. Values larger than 100 are accepted but the list will never contain more than 100 messages. (default is 10) Default: 10.
offset query integer Offset of the starting position in the message list. Default: 0.
since query string Allows filtering messages by date. Must be in ISO 8601 format.
before query string Allows filtering messages by date. Must be in ISO 8601 format.

Response 200

[
{
"id": "6456078996108088196",
"direction": "sent",
"sent": "2018-02-06T19:15:38.860Z",
"delivered": null,
"read": null,
"channel": {
"id": "6456078759331238786",
"type": "{{CHANNEL_TYPE}}"
},
"contact": {
"id": "6456078781510718339"
},
"content": {
"payload": "{{CONTENT_TYPE}}",
"type": "{{CONTENT_PAYLOAD}}"
}
}
]

Response Body Params

Parameter Type Description
id string Id of the message.

POST https://api.amio.io/v1/messages

Request body

Parameter Type Required Description
channel object
channel.id string yes Id of the channel you wish to send the message to. You can get channel id in administration.
contact object
contact.id string yes Id of the contact you wish to send the message to. There are different ways how to a contact (they are typically specific to a channel type), see Platform Specific Requests for more details.
content object
content.type string yes Different types of the content can be sent: text, file, audio, video and image, structure, etc. See Platform Specific Requests for more detail.
content.payload string yes Payload is specific to message type. Different message types are documented in Platform Specific Requests.
metadata object Metadata allows you to send any arbitrary data with the message. They are delivered back with Message Echo webhook.

Example request

{
"channel": {
"id": "6456078759331238786"
},
"contact": {
"id": "6456078781510718339"
},
"content": {
"type": "{{CONTENT_TYPE}}",
"payload": "{{CONTENT_PAYLOAD}}"
}
}

Response 201

{
"id": "{{MESSAGE_ID}}",
"channel": {
"id": "6456078759331238786",
"type": "{{CHANNEL_TYPE}}"
},
"contact": {
"id": "6456078781510718339"
},
"content": {
"type": "{{CONTENT_TYPE}}",
"payload": "{{CONTENT_PAYLOAD}}"
}
}

Developer-defined metadata can be sent with any type of Message. They are delivered back in Message Echo webhook.

{
"channel": { ... },
"contact": { ... },
"content": { ... },
"metadata": {
"any": "arbitrary data"
}
}

Select a channel to see its specifics.

Message resource is the main entry point for sending messages. To send a message, you have to specify an Amio Chat contact id. You receive contact.id when the user starts a conversation with you, see Message Received webhook.

Response Body Params

Parameter Type Description
id string Id of the message.
direction string Specifies if the message has been received or sent: received, sent.
sent string Iso 8601 Timestamp - time when the message was sent.
delivered string Iso 8601 Timestamp - time when the message was delivered. null means that it hasn’t been delivered yet.
read string Iso 8601 Timestamp - time when the message was read. null means that it hasn’t been read yet.
channel object Channel in which the message was sent or received.
contact object Message belongs to a contact.
content object Content of the message.

GET https://api.amio.io/v1/channels/{channel_id}/contacts/{contact_id}/messages

Parameters

Name In Type Required Description
channel_id path string yes Id of the channel.
contact_id path string yes Id of the contact.

Response 200

[
{
"id": "6456078996108099701",
"direction": "sent",
"sent": "2019-03-27T13:15:38.860Z",
"delivered": null,
"read": null,
"channel": {
"id": "6456078759331248741",
"type": "amio_chat"
},
"contact": {
"id": "6456078781510715474"
},
"content": {
"type": "text",
"payload": "Hello world!"
}
}
]

POST https://api.amio.io/v1/messages

Request body

Parameter Type Required Description
channel object
channel.id string yes Id of the channel you wish to send the message to.
contact object
contact.id string yes Id of the contact. Id is unique across channels and is generated by Amio.
content object
content.type string yes Must be set to text.
content.payload string yes Text to be sent. Maximum size of 1000 characters.
content.quick_replies array Quick Replies enrich the message with buttons that are dismissed as soon as user taps one.
metadata object Metadata allows you to send any arbitrary data with the message. They are delivered back with Message Echo webhook.

Example request

{
"channel": {
"id": "6456078759331248741"
},
"contact": {
"id": "6456078781510715474"
},
"content": {
"type": "text",
"payload": "Hello world!"
}
}

Response 201

{
"id": "6456078996108099701",
"channel": {
"id": "6456078759331248741",
"type": "amio_chat"
},
"contact": {
"id": "6456078781510715474"
},
"content": {
"type": "text",
"payload": "Hello world!"
}
}

POST https://api.amio.io/v1/messages/

Request body

Parameter Type Required Description
channel object
channel.id string yes Id of the channel you wish to send the message to.
contact object
contact.id string yes Id of the contact. Id is unique across channels and is generated by Amio.
content object
content.type string yes Must be set to image.
content.payload object
content.payload.url string yes Url of the image to be sent.
content.quick_replies array Quick Replies enrich the message with buttons that are dismissed as soon as user taps one.
metadata object Metadata allows you to send any arbitrary data with the message. They are delivered back with Message Echo webhook.

Example request

{
"channel": {
"id": "6456078759331248741"
},
"contact": {
"id": "6456078781510715474"
},
"content": {
"type": "image",
"payload": {
"url": "https://upload.wikimedia.org/wikipedia/commons/1/11/V%C3%A1clav_Havel_cut_out.jpg"
}
}
}

Response 201

{
"id": "6456078996108099701",
"channel": {
"id": "6456078759331248741",
"type": "amio_chat"
},
"contact": {
"id": "6456078781510715474"
},
"content": {
"type": "image",
"payload": {
"url": "https://upload.wikimedia.org/wikipedia/commons/1/11/V%C3%A1clav_Havel_cut_out.jpg"
}
}
}

Structure messages allows you to send well formatted message containing image, title, description, link and action buttons. This format is suitable when you’d like to send messages with visual content and possible call to action buttons, i.e. today’s menu of your restaurant.

POST https://api.amio.io/v1/messages

Structure messages allows you to send well formatted message containing image, title, description, link and action buttons. This format is suitable when you’d like to send messages with visual content and possible call to action buttons, i.e. today’s menu of your restaurant.

Request body

Parameter Type Required Description
channel object
channel.id string yes Id of the channel you wish to send the message to.
contact object
contact.id string yes Id of the contact. Id is unique across channels and is generated by Amio.
content object
content.type string yes Must be set to structure.
content.payload object
content.payload.title string Title of the message. Max size 80 characters. Title has to be specified with one more additional attribute: text, image_url or buttons. You can also omit the title attribute and use only text and buttons attributes.
content.payload.text string Message text. Max size 80 characters. However, you can use up to 640 characters if you use text with buttons only.
content.payload.image_url string Url of an image to be displayed. Image ratio is 1.91:1.
content.payload.item_url string Url which is opened when the message is tapped.
content.payload.buttons array Buttons to be shown below the message. Limited to 3 buttons. See Buttons chapter for more details.
content.quick_replies object Quick Replies enrich the message with buttons that are dismissed as soon as user taps one.
metadata object Metadata allows you to send any arbitrary data with the message. They are delivered back with Message Echo webhook.

Example request

{
"channel": {
"id": "6456078759331238786"
},
"contact": {
"id": "6456078781510718339"
},
"content": {
"type": "structure",
"payload": {
"title": "Leaf salad with smoked eggplant and zuchhini and dried tomatoes",
"text": "9.5 €",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/f/fa/Fish_-lunch.jpg",
"item_url": "https://example.com/daily-menu",
"buttons": [
{
"type": "url",
"title": "Show Details",
"payload": "https://example.com/daily-menu/food-1"
}
]
}
}
}

Response 201

{
"id": "6456078996108088196",
"channel": {
"id": "6456078759331238786",
"type": "amio_chat"
},
"contact": {
"id": "6456078781510718339"
},
"content": {
"type": "structure",
"payload": {
"title": "Leaf salad with smoked eggplant and zuchhini and dried tomatoes",
"text": "9.5 €",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/f/fa/Fish_-lunch.jpg",
"item_url": "https://example.com/daily-menu",
"buttons": [
{
"type": "url",
"title": "Show Details",
"payload": "https://example.com/daily-menu/food-1"
}
]
}
}
}

It is also possible to send multiple structured messages. They are displayed according to how you implement your GUI.

POST https://api.amio.io/v1/messages

It is also possible to send multiple structured messages. They are displayed according to how you implement your GUI.

Request body

Parameter Type Required Description
channel object
channel.id string yes Id of the channel you wish to send the message to.
contact object
contact.id string yes Id of the contact. Id is unique across channels and is generated by Amio.
content object
content.type string yes Must be set to structure.
content.payload object
content.payload.title string yes Title of the message. Max size 80 characters. Title has to be specified with one more additional attribute: text, image_url or buttons.
content.payload.text string Message text. Max size 80 characters.
content.payload.image_url string Url of an image to be displayed. Image ratio is 1.91:1.
content.payload.item_url string Url which is opened when the message is tapped.
content.payload.buttons array Buttons to be shown below the message. Limited to 3 buttons. See Buttons chapter for more details.
content.quick_replies object Quick Replies enrich the message with buttons that are dismissed as soon as user taps one.
metadata object Metadata allows you to send any arbitrary data with the message. They are delivered back with Message Echo webhook.

Example request

{
"channel": {
"id": "6456078759331238786"
},
"contact": {
"id": "6456078781510718339"
},
"content": {
"type": "structure",
"payload": [
{
"title": "Leaf salad with smoked eggplant and zuchhini and dried tomatoes",
"text": "9.5 €",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/f/fa/Fish_-lunch.jpg",
"item_url": "https://example.com/daily-menu",
"buttons": [
{
"type": "url",
"title": "Show Details",
"payload": "https://example.com/daily-menu/food-1"
}
]
},
{
"title": "Beef burger with Coleslaw salad",
"text": "12.0 €",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/9/9b/YOKOSUKA-NAVY-BURGER-TSUNAMI.JPG",
"item_url": "https://example.com/daily-menu",
"buttons": [
{
"type": "url",
"title": "Show Details",
"payload": "https://example.com/daily-menu/food-2"
}
]
}
]
}
}

Response 201

{
"id": "6456078996108088196",
"channel": {
"id": "6456078759331238786",
"type": "amio_chat"
},
"contact": {
"id": "6456078781510718339"
},
"content": {
"type": "structure",
"payload": [
{
"title": "Leaf salad with smoked eggplant and zuchhini and dried tomatoes",
"text": "9.5 €",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/f/fa/Fish_-lunch.jpg",
"item_url": "https://example.com/daily-menu",
"buttons": [
{
"type": "url",
"title": "Show Details",
"payload": "https://example.com/daily-menu/food-1"
}
]
},
{
"title": "Beef burger with Coleslaw salad",
"text": "12.0 €",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/9/9b/YOKOSUKA-NAVY-BURGER-TSUNAMI.JPG",
"item_url": "https://example.com/daily-menu",
"buttons": [
{
"type": "url",
"title": "Show Details",
"payload": "https://example.com/daily-menu/food-2"
}
]
}
]
}
}

Quick Replies are buttons with a set of pre-defined short replies that appear above the user input, making the keyboard less important. When a button is tapped, the message is sent as a text and you’ll receive it to your webhook. The buttons are dismissed as soon as the user taps one or replies with own text.

Quick Replies can be attached to any Message type in the content.quick_replies attribute.

{
"channel": { ... },
"contact": { ... },
"content": {
"type": "...",
"payload": "...",
"quick_replies": [
{ "..." },
{ "..." },
{ "..." }
]
}
}
Parameter Type Description
quick_replies array of objects Holds a list of up to 11 objects of Text Quick Reply type.

Text Quick Replies show buttons with text and optionally a small image icon. Each button can also hold a developer-defined payload, which is invisible to the user but can be used for automated processing. When the user taps on the button, it fires Message Received webhook with text and developer payload if specified.

...
"quick_replies": [
{
"type": "text",
"title": "Pilsner Urquell",
"payload": "DEVELOPER_DEFINED_PAYLOAD",
"image_url": "http://www.logotypes101.com/logos/778/70D1EF7E13BFAC232F2D05DE2E5594E0/pubisc.png"
},
{
"type": "text",
"title": "Heineken",
"payload": "DEVELOPER_DEFINED_PAYLOAD",
"image_url": "http://www.logotypes101.com/free_vector_logo_png/33082/85D3F063102F2476DC36D26D4D7A15C1/Heineken29"
}
]
...
Parameter Type Description
type* string Must be set to text.
title* string Button title with limit of 20 character; longer text gets truncated.
payload* string Developer-defined payload with limit of 1000 character. This payload is delivered back together with title as a text message in Message Received webhook.
image_url string Image to be displayed on the button. It should have dimension of at least 24x24 px.

Developer-defined metadata can be sent with any type of Message. They are delivered back in Message Echo webhook.

{
"channel": { ... },
"contact": { ... },
"content": { ... },
"metadata": {
"any": "arbitrary data"
}
}