App Logo
web.whatsapp.com

WhatsApp — Send message or attachment

Send a WhatsApp message to a chat picked either by its exact name (as returned by get_inbox) or by phone number in international format, which needs no saved contact. The message is either text, an attached image, video or document with an optional caption, or a saved contact's card. Confirms the send by inspecting the conversation afterwards — a delivery tick for text, a cleared upload for an attachment, the contact's own bubble for a card — and throws if WhatsApp flagged it as failed or left it stuck, rather than trusting the bubble appearing. Returns the message id, the account that sent it, and whether identical text was already in the conversation beforehand. Attachment bytes must be supplied inline, since they cannot be fetched from a URL at run time.

Input

kind required

What to send: a plain text message, an attached file of the given kind, or a saved contact's card.

name optional

Exact chat/contact/group name to send to (the `name` field from get_inbox). Provide this OR `phone`, not both.

text optional

Message text. Required when kind is "text".

phone optional

Recipient phone in international format, no saved contact needed. Confirm this number with the user before running; don't guess or reuse a number from context without checking. Non-digits are stripped, a leading "00" international prefix is removed, and a national number (leading trunk 0) is rejected with a clear error. e.g. "+1 555 123 4567", "15551234567" or "0015551234567". Provide this OR `name`, not both.

caption optional

Optional caption for image/video/document.

filename optional

Filename to send it as, e.g. photo.png / clip.mp4 / file.pdf. Required when kind is image/video/document.

mimeType optional

MIME type; inferred from kind + filename extension when omitted.

fileBase64 optional

File contents, base64-encoded (no data: prefix). This is the only way to supply the bytes: they cannot be fetched from a URL at run time, so a large file is limited by whatever the caller's own transport allows inline. Required when kind is image/video/document.

contactName optional

The saved name of the contact whose card to send, exactly as WhatsApp's address book shows it. Every phone number saved for that contact is included. Required when kind is "contact".

Output

kind required

What was sent: "text", "image", "video", "document" or "contact".

sent required

True once the send is confirmed: for text, a delivery tick appeared and WhatsApp did not flag a failure; for an attachment, the upload cleared its pending state and stayed unflagged through a settle window; for a contact card, the outgoing bubble naming the contact appeared unflagged.

recipient required

The chat name the message was sent to, read back from the conversation header.

account_used required

The phone number of the WhatsApp account that actually sent this, read back from the live session rather than taken from the request.

verified_on_page required

True when the send was confirmed by inspecting the conversation afterwards, rather than assumed from the click.

id optional

WhatsApp message id of the message that was sent. Populated for every kind.

text optional

The text that was sent; null for attachment and contact sends.

time optional

Timestamp of the sent message as shown in the bubble (e.g. "3:14 PM"); null for attachment and contact sends.

caption optional

The caption sent with the attachment, or null.

filename optional

The filename the attachment was sent as, or null for text and contact sends.

contactName optional

The saved contact whose card was sent, or null for other kinds.

numbersSent optional

How many of the contact's phone numbers the card carried, counted on WhatsApp's own confirmation screen. Null for other kinds.

already_present optional

Whether an outgoing message with exactly this text was already in the conversation before this send. Reported, not enforced - re-sending the same text is legitimate. Null for image/video and contact sends, where no comparable content is visible in the bubble.

Start building not clicking