Send a message
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.
https://api.alia.cx/api/v1/ agencies/ {agencyId}/ messagesPath parameters
agencyIdstringRequiredAgency ID from
GET /me, such asagy_9f2c4e1a7b3d4c5e8f60a1b2c3d4e5f6.
Request body
application/jsontostringRequiredContact phone number in E.164 format.
bodystringRequiredPlain text to send. Files are not supported yet.
operationIdstringYour id for this send. While the window is open, a retry with the same id does not send twice. Reusing an id with a different body fails. Without an id, every request is a new message.
subaccountIdstring (uuid) or nullThe agency's WhatsApp sender to use. Leave it out to use the agency's default sender.
consentLanguagestringLanguage of the consent template, such as
fr, used only when the window is closed. Required when the agency has more than one consent language. SeewindowReopenReadiness.availableLanguages.
Responses
successbooleanRequiredAlways true on success.
queuedbooleanRequiredFalse: Alia sent the text now. True: the 24-hour window was closed, so Alia queued the text and sent the contact a consent template. Alia sends the text once the contact accepts. A new send while one is queued replaces the queued text.
messageIdstring or nullRequiredTwilio message SID of the sent text. Null when queued.
queueIdstring or nullRequiredQueue entry id. Null when sent now.
statusstring or nullRequiredTwilio status right after sending, such as
queuedoraccepted. Null when queued or on a retry.windowOpenbooleanRequiredTrue when the WhatsApp 24-hour window was open.
windowExpiresAtstring or nullRequiredWhen the 24-hour window closes. Null when the contact has never written.
Errors
- 400Bad request
PartnerBadRequestThe request is not valid. - 401Unauthorized
PartnerUnauthorizedThe bearer token is missing or not valid. - 403Forbidden
PartnerForbiddenThe key may not do this. - 409Conflict
PartnerConflictThe conversation changed during the request. - 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