Inbox · Messages
Sends a message.
https://api.pozy.ai/v1/inbox/conversations/{conversationId}/messagesGuides: Messages, Message templates, X
Request
Send your API key as Authorization: Bearer pz_live_.... Read-only keys cannot call it. Keys with the messages resource group disabled get 403 resource_group_disabled. Authentication
Path parameters
| Name | Type | Notes |
|---|---|---|
conversationIdrequired | string |
Headers
| Name | Type | Notes |
|---|---|---|
Idempotency-Key | string | Up to 255 charactersRetries with the same key return the original result. See Idempotency |
Request body
application/json, required
accountIdstringrequiredmessagestringattachmentUrlstringcategorystringOne of
utility.linkPreviewbooleanDefault
true.attachmentTypestringOne of
image,video,audio,file.attachmentNamestringvoiceNotebooleansubjectstringUp to 1000 characters.
ccarray of string (email)Up to 50 items.
effectstringOne of
slam,loud,gentle,invisibleInk,echo,spotlight,balloons,confetti,love,lasers,fireworks,shootingStar,celebration.contactCardbooleanchannelstringOne of
imessage,sms,rcs,whatsapp.sharedMediaIdstringMatches
^\d+$.stickerstringOne of
like_heart.quickRepliesarray of objectUp to 13 items.
titlestringrequiredUp to 20 characters.
payloadstringrequiredimageUrlstring
buttonsarray of objectUp to 3 items.
typestringrequiredOne of
url,postback,phone.titlestringrequiredUp to 20 characters.
urlstringpayloadstringphonestring
templateobjecttypestringOne of
generic.imageAspectRatiostringOne of
horizontal,square.elementsarray of objectUp to 10 items.
7 child fields
titlestringUp to 80 characters.
subtitlestringimageUrlstringbuttonsarray of objectUp to 3 items.
4 child fields
typestringOne of
url,postback.titlestringUp to 20 characters.
urlstringpayloadstring
namestringlanguagestringcomponentsarray of object
interactiveobjecttypestringrequiredOne of
list,cta_url,flow,location_request_message,request_contact_info,voice_call,product,product_list,catalog_message,carousel,address_message.headerobject5 child fields
typestringOne of
text,image,video,document.textstringimageobject1 child field
linkstring
videoobject1 child field
linkstring
documentobject1 child field
linkstring
bodyobject1 child field
textstringrequired
footerobject1 child field
textstring
actionobjectOne of:
Option 1 (2 fields)
buttonstringrequiredsectionsarray of objectrequiredAt least 1 item. Up to 10 items.
2 child fields
titlestringrowsarray of objectrequiredAt least 1 item. Up to 10 items.
3 child fields
idstringrequiredtitlestringrequireddescriptionstring
Option 2 (2 fields)
namestringrequiredOne of
cta_url.parametersobjectrequired2 child fields
display_textstringrequiredurlstring (URL)required
Option 3 (2 fields)
namestringrequiredOne of
voice_call.parametersobject3 child fields
display_textstringUp to 20 characters.
ttl_minutesinteger1 to 43200.
payloadstringUp to 512 characters.
Option 4 (2 fields)
namestringrequiredOne of
flow.parametersobjectrequired7 child fields
flow_message_versionstringOne of
3.flow_tokenstringrequiredflow_idstringrequiredflow_ctastringrequiredflow_actionstringrequiredOne of
navigate,data_exchange.flow_action_payloadobject2 child fields
screenstringdataobject
modestringOne of
draft.
Option 5 (1 fields)
namestringrequiredOne of
send_location.
Option 6 (1 fields)
namestringrequiredOne of
request_contact_info.
Option 7 (2 fields)
catalog_idstringrequiredproduct_retailer_idstringrequired
Option 8 (2 fields)
catalog_idstringrequiredsectionsarray of objectrequiredAt least 1 item. Up to 10 items.
2 child fields
titlestringproduct_itemsarray of objectrequiredAt least 1 item.
1 child field
product_retailer_idstringrequired
Option 9 (2 fields)
namestringrequiredOne of
catalog_message.parametersobject1 child field
thumbnail_product_retailer_idstring
Option 10 (1 fields)
cardsarray of objectrequiredAt least 2 items. Up to 10 items.
5 child fields
card_indexinteger0 to 9.
typestringheaderobjectbodyobjectactionobject
Option 11 (2 fields)
namestringrequiredOne of
address_message.parametersobjectrequired4 child fields
countrystringrequiredvaluesobjectsaved_addressesarray of objectvalidation_errorsmap of string
replyMarkupobjecttypestringOne of
inline_keyboard,reply_keyboard.keyboardarray of array of objectoneTimebooleanDefault
true.
messagingTypestringOne of
RESPONSE,UPDATE,MESSAGE_TAG.messageTagstringOne of
CONFIRMED_EVENT_UPDATE,POST_PURCHASE_UPDATE,ACCOUNT_UPDATE,HUMAN_AGENT.replyTostringlocationobjectlatitudenumberrequiredlongitudenumberrequirednamestringaddressstring
contactsarray of objectnameobjectrequired3 child fields
formatted_namestringrequiredfirst_namestringlast_namestring
phonesarray of object2 child fields
phonestringtypestring
emailsarray of object2 child fields
emailstringtypestring
Example
curl -X POST "https://api.pozy.ai/v1/inbox/conversations/6e525f3820fc636aa96d2ee9/messages" \
-H "Authorization: Bearer $POZY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"accountId": "696e0b682d0a31188e7a2ba9"
}'import { randomUUID } from "node:crypto";
const res = await fetch("https://api.pozy.ai/v1/inbox/conversations/6e525f3820fc636aa96d2ee9/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.POZY_API_KEY}`,
"Idempotency-Key": randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
accountId: "696e0b682d0a31188e7a2ba9"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);import os
import requests
resp = requests.post(
"https://api.pozy.ai/v1/inbox/conversations/6e525f3820fc636aa96d2ee9/messages",
headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
json={
"accountId": "696e0b682d0a31188e7a2ba9",
},
timeout=30,
)
resp.raise_for_status()
print(resp.json())Response
200 on success
successbooleanwarningsarray of objectcodestringrequiredOne of
ignored_field.paramstringrequiredOne of
replyTo.messagestringrequired
dataobjectmessageIdstringconversationIdstringattachmentsarray of object2 child fields
typestringurlstring
messageIdsarray of stringpartialFailureobject3 child fields
partstringOne of
text.errorstringplatformErrorobject4 child fields
codeintegersubcodeintegerfbtraceIdstringtypestring
{
"success": true,
"warnings": [
{
"code": "ignored_field",
"param": "replyTo",
"message": "Hello from Pozy"
}
],
"data": {
"messageId": "62d191e7089bc48b8ea56b35",
"conversationId": "6e525f3820fc636aa96d2ee9",
"attachments": [
{
"type": "string",
"url": "https://pozy.ai/media/example-1.jpg"
}
],
"messageIds": [
"Hello from Pozy"
],
"partialFailure": {
"part": "text",
"error": "string",
"platformError": {
"code": 1,
"subcode": 1,
"fbtraceId": "683a6bd99e02a3ca186c487f",
"type": "string"
}
}
}
}Errors
Errors use one shape: { error, type, code, param?, details? }. The ones you are most likely to see here:
| 400 | invalid_request_error | A parameter or body field is missing or invalid. param names it. |
| 401 | authentication_error | The API key is missing, revoked or expired. |
| 403 | permission_error | The key is read-only, scoped to other profiles, or has this resource group disabled. |
| 404 | not_found | Nothing with that id exists in your workspace. |
| 429 | rate_limit_error | Too many requests this minute. Wait for Retry-After seconds. |
Every code is listed in Errors.