Sending

    Send a message

    POSThttps://api.batzap.com/v1/send-message

    Sends a WhatsApp message to a person or group and records it in the inbox. Supports text, image, video, audio and voice notes, documents, contact cards, polls, replies and @mentions.

    Pick one content type per request. Precedence when several are sent: image, video, document, audio, contacts, poll, text.

    Media can be sent inline as base64, or uploaded first with Upload media and referenced by s3_key (recommended above a few MB). Limit: 20 MB.

    If to is a Crisp conversation id, the reply goes out through Crisp instead.

    On failure the body carries error and an error_code: WHATSAPP_DISCONNECTED, TIMEOUT, RATE_LIMITED, INVALID_RECIPIENT or SEND_FAILED.

    Body parameters

    tostringrequired

    Recipient: a phone number in E.164 (+5511987654321), a group JID (...@g.us) or a conversation id.

    integration_iduuidoptional

    WhatsApp number to act from (see List integrations). Filled in automatically when the key is restricted to a single number.

    messagestringoptional

    Text, or the caption of an image, document or audio.

    imagestring (base64)optional

    Image to send.

    videostring (base64)optional

    Video to send. Requires mimetype.

    documentstring (base64)optional

    File to send. Requires mimetype and filename.

    audiostring (base64)optional

    Audio to send. Set ptt: true to deliver it as a voice note.

    s3_keystringoptional

    Media uploaded with Upload media, instead of base64. The type comes from mimetype.

    mimetypestringoptional

    Media type. Video: video/mp4, video/webm, video/quicktime. Documents: PDF, CSV, Word, Excel, PowerPoint, plain text, subtitles.

    filenamestringoptional

    File name shown for a document.

    pttbooleanoptional

    Send audio as a voice note.

    quoted_message_idstringoptional

    _id of the message to reply to. If it is not found, the message goes out without the quote.

    mentionsstring[]optional

    Groups only. Phone numbers to @mention; each must also appear as @<number> in message.

    contactsobjectoptional

    Contact card: { displayName?, contacts: [{ name, phones: [{ number, type? }] }] }.

    pollobjectoptional

    Poll: { name, values: [2 to 12 options], selectableCount? }. selectableCount 0 allows any number of choices.

    sender_namestringoptional

    Author shown for this message in the inbox.

    Errors

    400
    Missing to or content, unsupported media type, file over 20 MB, or the number has no WhatsApp.
    402
    BILLING_ACCESS_DENIED The organization's subscription is inactive.
    404
    Conversation, contact or uploaded media not found.
    428
    WHATSAPP_DISCONNECTED The sending number is disconnected or reconnecting.
    503
    NO_SERVER_REASSIGNED The number is being moved between servers. Retry in a few seconds.

    Plus the errors every route can return: see Errors.