List messages
Lists the messages in one conversation, newest first. Pass nextCursor as cursor to read older messages; stop when hasMore is false.
https://api.alia.cx/api/v1/ agencies/ {agencyId}/ conversations/ {phone}/ messagesPath parameters
agencyIdstringRequiredAgency ID from
GET /me, such asagy_9f2c4e1a7b3d4c5e8f60a1b2c3d4e5f6.phonestringRequiredContact phone number in E.164 format.
Query parameters
pageSizeintegerMessages per page, from 1 to 100. Default 50.
min 1max 100default 50
cursorstringnextCursorfrom the previous page. Leave it out to read the newest messages.
Responses
messagesarray of objectsRequiredMessages, newest first.
Show 16 child fieldsHide child fields
idintegerRequiredAlia message id.
messageSidstringRequiredTwilio message SID.
bodystring or nullRequiredMessage text. Null for a message with only files.
directionstringRequiredinbound(from the contact) oroutbound.createdAtstring or nullRequiredWhen the message was sent or received.
deliveredAtstring or nullRequiredWhen WhatsApp reported delivery.
readAtstring or nullRequiredWhen WhatsApp reported the contact read it.
statusstring or nullRequiredTwilio message status, such as
queued,sent,delivered,read,failed,undeliveredor, for inbound messages,received.mediaarray of objects or nullRequiredFiles the contact sent. Sending files is not supported yet.
Show 4 child fieldsHide child fields
urlstringRequiredMedia link as WhatsApp delivered it.
indexnumberPosition of the file in the message.
contentTypestringMIME type.
content_typestringMIME type (older records).
mediaStoredarray of objects or nullRequiredCopies of inbound files, when the agency has media storage on.
Show 6 child fieldsHide child fields
sizenumberRequiredFile size in bytes.
stored_urlstringRequiredLink to the copy Alia keeps.
content_typestringRequiredMIME type.
original_urlstringRequiredThe WhatsApp media link the copy came from.
storage_pathstringRequiredPath of the copy in Alia storage.
downloaded_atstringRequiredWhen Alia stored the copy.
numMediainteger or nullRequiredNumber of files in the message.
templateNamestring or nullRequiredTemplate code, when Alia sent a template.
buttonClickedstring or nullRequiredCode of the button the contact tapped.
profileNamestring or nullRequiredWhatsApp profile name of the contact.
interactiveContentobjectButtons or lists the template showed the contact.
Show 3 child fieldsHide child fields
quickRepliesarray of objects or nullReply buttons.
Show 2 child fieldsHide child fields
codestringRequiredCode Alia receives when the contact taps it.
textstringRequiredButton label.
listPickerobject or nullA list of choices.
Show 2 child fieldsHide child fields
buttonTextstring or nullLabel of the button that opens the list.
itemsarray of objectsRequiredChoices in the list.
Show 3 child fieldsHide child fields
idstringRequiredItem id Alia receives when the contact picks it.
titlestringRequiredItem label.
descriptionstring or nullExtra line under the label.
ctaButtonsarray of objects or nullCall-to-action buttons.
Show 6 child fieldsHide child fields
typestringRequiredButton kind, such as
URLorPHONE_NUMBER.titlestringRequiredButton label.
urlstring or nullLink the button opens.
phonestring or nullNumber the button calls.
codestring or nullCode the button copies.
ttl_minutesnumber or nullMinutes the code stays valid.
replyToobjectThe message the contact replied to.
Show 5 child fieldsHide child fields
bodystring or nullRequiredText of the quoted message.
directionstring or nullRequiredinboundoroutbound.createdAtstring or nullRequiredWhen the quoted message was sent.
templateNamestring or nullRequiredTemplate code, when the quoted message was a template.
hasMediaboolean or nullRequiredTrue when the quoted message had files.
nextCursorstring or nullRequiredPass as
cursorto read older messages. Null when there are no more.pageSizeintegerRequiredThe page size used for this page.
hasMorebooleanRequiredTrue when older messages exist.
Errors
- 400Bad request
PartnerBadRequestThe request is not valid. - 401Unauthorized
PartnerUnauthorizedThe bearer token is missing or not valid. - 403Forbidden
PartnerForbiddenThe key may not do this. - 404Not found
PartnerNotFoundNot found. - 500Server error
PartnerInternalErrorAlia failed to handle the request.
Every error body is JSON with the same two fields: _tag names the error and message explains it. How errors work
Get a conversationGET
Returns one conversation, its AI and window state, any queued text and its newest messages. Use it to check whether a send would go out now or be queued.
Send a messagePOST
Sends a plain-text WhatsApp message as the agency. If the 24-hour window is closed, Alia queues the text and asks the contact for consent first. A send takes over the conversation and turns the AI off for this contact.