send_message
Sends a WhatsApp message to one person or group: text, or a file (photo, document/PDF, voice note, audio file or sticker) with optional text as its caption. On the free plan, text works only to people who have messaged the user in the last 90 days (starting new conversations needs the paid plan), and "Sent via wa-mcp.com" is added at the end of it; files (media) need the paid plan. to can be a contact name, a phone number with country code, or a JID (…@s.whatsapp.net, …@lid, …@g.us); if a name could match more than one contact, call search_contacts first. To reply to a specific message (a quoted reply), pass its id from read_chat_history or search_messages as quote_id. To send a file, pass media with exactly one source: media.url, a link to the file; media.message_id, the id of a photo, video, voice note, audio, document or sticker message from read_chat_history or search_messages, to send that file on to someone (e.g. "send Ana the photo Juan sent me"); or media.data, base64 for small files you generated yourself (up to 512 KB). You can't pass on a file the user attached to this conversation: ask them to upload it to Google Drive, click Share, set access to "Anyone with the link", and paste the link here; pass that link unchanged as media.url. Google Drive file links, and Google Docs (sent as PDF), Sheets (XLSX) and Slides (PDF) links work directly; so does any public direct link to a file. Don't upload the user's files to other sites without asking them. The type is detected from the file: JPEG/PNG/WebP/GIF go as photos, MP4 (H.264) as a video, OGG/Opus audio as a voice note, other audio (MP3, M4A) as an audio file, everything else (PDF, Office files, other videos such as iPhone MOV/HEVC, HEIC) as a document. A file sent on with media.message_id keeps its kind (a voice note stays a voice note, a document keeps its name) and isn't marked as forwarded; its original caption isn't copied, so pass text for one. Limits: photos, videos and audio 16 MB, documents 32 MB. If you are writing the text yourself rather than sending words the user gave you, call get_writing_style for this chat first and write it the way the user writes; skip that for dictated text. To protect the user's number from WhatsApp's anti-spam bans, messages that start a conversation with someone who hasn't messaged the user in the last 90 days may be limited to 1 per minute and 10 every 12 hours; the result says so and explains why when it happens. People who have written to the user are never limited. Sending can't be undone: confirm the recipient, text and file with the user first unless they already gave them. Returns { to, status (sent, failed, or scheduled), recipient, message_id, media?, text_message_id?, note?, error?, scheduled_id?, send_at? }: recipient is who the message went to, with the contact fields (name; name_source: address_book, push_name, group_subject, business, phone or unresolved; canonical_jid: the JID to pass to send_message and read_chat_history; phone_jid and lid_jid: the chat's phone-number and LID forms, null when unknown or for groups; phone_display: the number as +). scheduled means the new-contact limit moved the message to the next free minute: it goes out by itself at send_at (scheduled message scheduled_id), so don't send it again. message_id can be used as quote_id later. With media, media says how the file was sent ({ sent_as, mimetype, size_bytes, file_name? }) and note explains a fallback (e.g. a HEVC video sent as a document); tell the user. If WhatsApp rejects the send, the result is an error that still includes recipient and error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Contact name, phone number with country code, chat JID (person or group), or a group's exact name (case, accents, spaces and punctuation ignored; part of a group name doesn't match). | |
| text | No | The message text. With media, the caption of a photo or document (for audio and stickers, it is sent as a separate message just before the file). Required unless media is given. | |
| media | No | Optional. A file to send. Pass exactly one of url, message_id or data. | |
| quote_id | No | Optional. The `id` of the message to reply to (from read_chat_history or search_messages). | |
| quote_participant | No | Optional. The quoted message's `sender_jid` (from read_chat_history). Usually looked up automatically from quote_id; pass it if a group reply asks for it. |