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.

To protect personal data, messages exchanged between the customer and the shoppers remain accessible for 24 hours, starting from when an order is delivered or cancelled. The is_expired field in the response indicates whether that time period has elapsed. If true, then the messages are no longer accessible and chat_messages[] is empty. If false, then any exchanged messages still exist in that array. Additionally, if the remove shopper information feature is enabled, then the response has a 403 status code. For more information, see Personal data protection

Security

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

Parameters

NameInTypeRequiredDescription
order_idpathstringRequired

The 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)Required

The list of messages.

metadataChatMessagesMetadataRequired

Metadata associated with the chat messages.

Message Object

FieldTypeRequiredDescription
idintegerRequired

The ID of the message.

order_idintegerRequired

The order ID for this message.

created_atstringRequired

When this message was created.

recipient_idintegerRequired

The ID of the message recipient.

recipient_typestringRequired

The type of the message recipient. One of be 'user' or 'driver'.

sender_idintegerRequired

The ID of the message sender.

sender_typestringRequired

The type of the message sender. One of 'user' or 'driver'.

readbooleanRequired

Indicates whether this message has been read.

read_atstringOptional

Indicates the time this message was read.

bodystringRequired

The body of this message.

imagestringOptional

The image associated with this message.

ChatMessagesMetadata Object

FieldTypeRequiredDescription
customerChatUserRequired

The metadata of the customer.

current_shopperChatUserRequired

The metadata for the current shopper.

shoppersArray(ChatUser)Optional

The metadata of the shoppers.

is_expiredbooleanOptional

Indicates whether messages exchanged between the customer and the shoppers are still accessible. If true, more than 24 hours have passed since the time of order delivery or cancellation and the messages are no longer accessible. If false, the messages remain accessible.

ChatUser Object

FieldTypeRequiredDescription
idintegerRequired

The ID of the user.

display_namestringRequired

The display name of the user.

avatar_urlstringOptional

The 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": 1043,
"display_name": "John",
"avatar_url": ""
},
"current_shopper": {
"id": 26,
"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": 26,
"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
403Retailer requested to redact shopper PII"Shopper PII"nullNot applicable
404Order not found"Resource not found"4000Not applicable