Get a conversation
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.
https://api.alia.cx/api/v1/ agencies/ {agencyId}/ conversations/ {phone}Path parameters
agencyIdstringRequiredAgency ID from
GET /me, such asagy_9f2c4e1a7b3d4c5e8f60a1b2c3d4e5f6.phonestringRequiredContact phone number in E.164 format.
Query parameters
pageSizeintegerMessages in the returned message page, from 1 to 100. Default 50.
min 1max 100default 50
cursorstringnextCursorfrom a previous message page, to read older messages. Leave it out for the newest.
Responses
conversationobjectRequiredA conversation with its current state.
Show 4 child fieldsHide child fields
summaryobjectRequiredOne WhatsApp conversation with a contact.
Show 17 child fieldsHide child fields
phoneNumberstringRequiredContact phone number in E.164 format.
contactNamestring or nullRequiredContact name, when known.
lastMessageAtstring or nullRequiredTime of the last message, in either direction.
lastMessagePreviewstring or nullRequiredStart of the last message text.
lastMessageDirectionstring or nullRequiredDirection of the last message:
inbound(from the contact) oroutbound.totalMessagesintegerRequiredNumber of messages in the conversation.
failedMessagesintegerRequiredOutbound messages that failed, went undelivered or carry an error code.
activeFlowsintegerRequiredAlia flows now running for this contact.
completedFlowsintegerRequiredAlia flows this contact has finished.
latestFlowStatusstring or nullRequiredStatus of the most recently updated flow, such as
active,waiting,completed,cancelled,failedortimeout.lastInboundAtstring or nullRequiredTime of the last message from the contact.
windowExpiresAtstring or nullRequiredWhen the WhatsApp 24-hour window closes: 24 hours after the last message from the contact. Null when the contact has never written. After this time a send is queued, not sent.
aiEnabledbooleanRequiredTrue when the AI may reply to this contact.
queuedMessagesintegerRequiredMessages waiting for the contact to reopen the WhatsApp window.
isUnlinkedbooleanRequiredTrue when no agency owns this conversation.
visibilityobjectRequiredWhy this agency can see the conversation.
Show 3 child fieldsHide child fields
reasonstringRequiredWhy the agency sees this conversation.
focus: the agency owns it.unlinked: no agency owns it.tagged: the agency sees it through an agency tag.unknown: none of these.One of
focusunlinkedtaggedunknownisSharedbooleanRequiredTrue when other agencies may also see this conversation.
isVisibleThroughAgencyTagbooleanRequiredTrue when the agency sees it through an agency tag.
cursorstring or nullRequiredOpaque position of this row in the list. Pass it as
cursorto read the rows after it. Null in lookup results.
queuedMessagesarray of objectsRequiredThe text waiting for the window to reopen, if any. Holds at most one entry.
Show 9 child fieldsHide child fields
idstringRequiredQueue entry id.
bodystringRequiredText Alia will send once the contact reopens the window.
attachmentUploadIdstring or nullRequiredUpload id of an attached file, or null. API sends never attach files.
attachmentFileNamestring or nullRequiredName of the attached file.
attachmentMimeTypestring or nullRequiredMIME type of the attached file.
attachmentFileSizeinteger or nullRequiredSize of the attached file in bytes.
statusstringRequiredQueue status. Always
queuedhere.createdAtstringRequiredWhen Alia queued the text.
updatedAtstringRequiredWhen the queued text last changed.
aiSettingsobjectRequiredAI state for this contact.
Show 3 child fieldsHide child fields
enabledbooleanRequiredTrue when the AI may reply to this contact.
disabledReasonstring or nullRequiredWhy the AI is off:
manual_send(a person sent a message) oruser_toggle(agency staff turned it off). After amanual_send, the AI turns back on when the contact writes more than 24 hours later.disabledAtstring or nullRequiredWhen the AI was turned off.
windowReopenReadinessobjectRequiredWhether Alia can reach this contact after the 24-hour window closes, by queuing the text and sending a consent template first.
Show 9 child fieldsHide child fields
configuredbooleanRequiredTrue when the agency has the consent flow turned on.
templatesApprovedbooleanRequiredTrue when every consent flow and template exists and is approved.
eligibleForManualSendbooleanRequiredTrue when a send outside the 24-hour window can be queued: templates are approved and at least one language exists.
availableLanguagesarray of stringsRequiredLanguages you may pass as
consentLanguage.defaultLanguagestring or nullRequiredLanguage Alia uses by default.
flowCodesarray of stringsRequiredConsent flow codes for the agency.
missingFlowCodesarray of stringsRequiredConsent flow codes Alia could not find.
missingTemplatesarray of stringsRequiredConsent templates the agency lacks.
unapprovedTemplatesarray of objectsRequiredConsent templates waiting for WhatsApp approval.
Show 2 child fieldsHide child fields
templateCodestringRequiredTemplate code.
statusstring or nullRequiredWhatsApp approval status.
messagePageobjectRequiredA page of messages, newest first.
Show 4 child fieldsHide child fields
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
Look up conversationsPOST
Returns the conversation summary for each phone number you send, up to 100, in the same order. A number with no conversation gets conversation: null. Use it to show WhatsApp status next to a list of contacts; read messages with List messages. It only reads, so it needs conversations:read.
List messagesGET
Lists the messages in one conversation, newest first. Pass nextCursor as cursor to read older messages; stop when hasMore is false.