Skip to content

Send messages

Send messages from the CLI or the HTTP API. Files, images, video and voice notes are on the attachments page, and stickers are on the stickers page.

Send text

Terminal window
wx messages send CHAT_ID --text "On my way"

The command waits up to 30 seconds for WeChat to accept the message. Add --detach to return right away. If the wait ends first, it exits with code 7 and the send keeps going; check it with wx messages sends get SEND_ID. See exit codes.

Quote a message

  1. Copy the id and serverId of the message you’re replying to:

    Terminal window
    wx messages list CHAT_ID --json
  2. Send the reply with both quote flags:

    Terminal window
    wx messages send CHAT_ID --text "Agreed" \
    --quote-message-id MESSAGE_ID --quote-server-id SERVER_ID --detach

The original has to be saved in the same chat. Missing, recalled or mismatched originals are rejected. These kinds can be quoted:

OriginalCan be quoted
Text, image, voice, video, file, sticker or shared linkYes
Shared contact or static locationYes, in the saved forms that can be checked
Existing quoted replyYes, its own comment is quoted
Forwarded chat historyYes, its summary only
System messages, upload notices and other cardsNo

Mention group members

In a group, add --mention MEMBER_ID or --mention-all to a text message or a quoted reply. Over HTTP, use mentions with userIds or all. Member IDs and the permissions that apply are on the groups page.

Terminal window
wx messages send GROUP_ID --text "Meeting moved to 3pm" --mention MEMBER_ID
Terminal window
wx messages send CHAT_ID --share https://example.com/post --title "Worth a read"

Add --description for the text under the title, and --thumbnail-url for a preview image.

The card shows the title you give. Nothing is fetched from the linked page.

Share a contact card

Send your own card (self), a contact (wxid_...) or an Official Account (gh_...) as a WeChat contact card.

Terminal window
wx messages send CHAT_ID --contact-card self
wx messages send CHAT_ID --contact-card CONTACT_ID

Recall a message

Recall a message you sent. You need its full id and serverId, which you can get from wx messages list CHAT_ID --json.

Terminal window
wx messages recall MESSAGE_ID --server-id SERVER_ID