Skip to main content

Get the messages associated to the order

GET /v2/post_checkout/chat/{order_id}/messages

Gets all the messages of the conversation between the customer and the shopper.

Security

NameInDescription
AuthorizationheaderThe Authorization header with the bearer token acquired during authentication.

Parameters

NameInTypeRequiredDescription
order_idpathstringRequiredThe ID of the order.
X-Treat-Ids-As-InternalheaderbooleanOptional

Request

None.

Request examples

curl --request GET \
--url 'https://connect.instacart.com/v2/post_checkout/chat/{order_id}/messages' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'X-Treat-Ids-As-Internal: true'

Response

FieldTypeRequiredDescription
chat_messagesArray(Message)RequiredThe list of messages.
metadataChatMessagesMetadataRequiredMetadata associated with the chat messages.

Message Object

FieldTypeRequiredDescription
idintegerRequiredThe ID of the message.
order_idintegerRequiredThe order ID for this message.
created_atstringRequiredWhen this message was created.
recipient_idintegerRequiredThe ID of the message recipient.
recipient_typestringRequiredThe type of the message recipient. One of be 'user' or 'driver'.
sender_idintegerRequiredThe ID of the message sender.
sender_typestringRequiredThe type of the message sender. One of 'user' or 'driver'.
readbooleanRequiredIndicates whether this message has been read.
read_atstringOptionalIndicates the time this message was read.
bodystringRequiredThe body of this message.
imagestringOptionalThe image associated with this message.

ChatMessagesMetadata Object

FieldTypeRequiredDescription
customerChatUserRequiredThe metadata of the customer.
current_shopperChatUserRequiredThe metadata for the current shopper.
shoppersArray(ChatUser)OptionalThe metadata of the shoppers.

ChatUser Object

FieldTypeRequiredDescription
idintegerRequiredThe ID of the user.
display_namestringRequiredThe display name of the user.
avatar_urlstringOptionalThe URL of the user's avatar.

Response examples

200 Success

{
"chat_messages": [
{
"id": 123456789,
"order_id": 122233,
"created_at": "2021-01-01T00:00:00Z",
"recipient_id": 334354343,
"recipient_type": "user",
"sender_id": 55655345,
"sender_type": "driver",
"read": false,
"body": "MessageBody"
}
],
"metadata": {
"customer": {
"id": 862,
"display_name": "John",
"avatar_url": ""
},
"current_shopper": {
"id": 16,
"display_name": "Robert",
"avatar_url": "https://speedwagon.foundation/avatar/reospeedwagon.jpg"
},
"shoppers": [
{
"id": 55655345,
"display_name": "SomeFirstName",
"avatar_url": "SomeURL"
},
{
"id": 123456789,
"display_name": "SomeFirstName2",
"avatar_url": "SomeURL2"
},
{
"id": 16,
"display_name": "Robert",
"avatar_url": "https://speedwagon.foundation/avatar/reospeedwagon.jpg"
}
]
}
}

4XX Errors

Error responses return either a single error or multiple errors.

HTTP CodeCauseError MessageError CodeError Meta
404Order not found"Resource not found"4000Not applicable