send_message
Send a message to a chat.Recipient JID. Can be:
- Direct message:
15551234567@s.whatsapp.net - Group:
120363040237990503@g.us - Newsletter:
120363999999999999@newsletter
Protobuf message to send. Set one of the message fields:
conversation- Plain text messageextended_text_message- Text with formatting/linksimage_message- Image with captionvideo_message- Video with captiondocument_message- Document/fileaudio_message- Audio/voice notesticker_message- Stickerlocation_message- GPS locationcontact_message- Contact card
Unique message ID generated for this message. Use this ID to track delivery receipts and edit/revoke the message.
Example: Text Message
Example: Image with Caption
send_message_with_options
Send a message with additional customization options.Recipient JID
Protobuf message to send
Additional send options (see below)
Unique message ID
SendOptions
Options for customizing message sending behavior.Additional XML nodes to include in the message stanza. Used for advanced protocol features like quoted replies, mentions, or custom metadata.
Example: Send with Custom Options
revoke_message
Delete a message for everyone in the chat (revoke). This sends a revoke protocol message that removes the message for all participants. The message will show as “This message was deleted” for recipients.Chat JID (direct message or group)
ID of the message to delete (from
send_message return value)Who is revoking the message:
RevokeType::Sender- Delete your own messageRevokeType::Admin { original_sender }- Admin deleting another user’s message in a group
RevokeType
Specifies who is revoking (deleting) the message.Default variant. Use when deleting your own message. Works in both DMs and groups.
Use when a group admin is deleting another user’s message. Only valid in groups. Requires
original_sender JID.Example: Revoke Own Message
Example: Admin Revoke in Group
Admin revoke is only valid for group chats. Attempting to use it in a direct message will return an error.
Message Types
Thewa::Message protobuf supports various message types. Set exactly one of these fields:
Text Messages
Simple text message without formatting
Text with formatting, links, quoted replies, or mentionsKey fields:
text- Message textcontextInfo- Quoted message, mentionspreviewType- Link preview behavior
Media Messages
Image with optional caption. Upload the image first using
client.upload(), then populate:url,direct_path,media_key,file_enc_sha256,file_sha256,file_lengthcaption- Image captionmimetype- e.g.,"image/jpeg"
Video with optional caption. Same upload pattern as images.
Audio file or voice note:
ptt- Set totruefor voice notes (Push-To-Talk)mimetype- e.g.,"audio/ogg; codecs=opus"
Document/file with metadata:
file_name- Original filenamemimetype- File MIME typecaption- Optional description
Sticker image (WebP format)
Other Messages
GPS location with latitude, longitude, and optional name/address
Contact card with vCard data
Multiple contact cards
Real-time location sharing
Emoji reaction to another message