Send a message to the shopper
POST /v2/post_checkout/chat/{order_id}/messages
Sends a message to the shopper associated with the order.
Security
Name | In | Description |
---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
order_id | path | string | The order ID for this message. |
Request
Field | Type | Required | Description |
---|---|---|---|
body | string | The body of the message. Maximum length is 1000 characters. |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url 'https://connect.instacart.com/v2/post_checkout/chat/{order_id}/messages' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"body": "string"
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/post_checkout/chat/{order_id}/messages")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"body\": \"string\"\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"body\": \"string\"\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/post_checkout/chat/{order_id}/messages", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://connect.instacart.com/v2/post_checkout/chat/{order_id}/messages"
payload := strings.NewReader("{\n \"body\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response
Field | Type | Required | Description |
---|---|---|---|
id | integer | The ID of this message. | |
type | string | The type of the chat message. | |
created_at | string | When the message was created. | |
timezone | string | The time zone for this message. |
Response examples
200 Success
200
Message Sent
{
"id": 123,
"type": "CHAT",
"created_at": "2021-01-01T05:00:00Z",
"timezone": "Timezone"
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Body length exceeds maximum | "is too long (maximum is 1000 characters)" | 1001 | {"key":"body"} |
403 | Chat Action Disabled | "Sending a message is not allowed at this time" | null | Not applicable |
403 | Shopper Not Available | "Sending a message is not allowed at this time" | null | Not applicable |
404 | Order not found | "Resource not found" | 4000 | Not applicable |