Messages
此内容尚不支持你的语言。
GET /v1/accounts/{a}/messages
Search the saved messages of every chat in the account.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
cursor | query | string, nullable | The nextCursor of the previous page, up to 8192 characters. Send it with the same query. |
kind | query | string, nullable | Only list chats of this kind: direct, group or system. |
limit | query | integer, nullable | Items per page, from 1 to 200. |
relation | query | string, nullable | Contact lists only: friend (default), non_contact, unknown, or all cached people. |
search | query | string, nullable | Text to search for, up to 256 characters. The name query is accepted too. |
Response: NativeMessagePage
GET /v1/accounts/{a}/messages/{id}
Show one saved message.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Message ID. |
Response: NativeMessage
POST /v1/accounts/{a}/messages/{id}/recall
Recall a message you sent, identified by its exact server ID. Poll the returned operation.
Scope: send
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Message ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeRecallRequest
Response: NativeOperation
POST /v1/accounts/{a}/sends
Send text, a share card, a contact card, staged media or a stable sticker reference. The body shape follows its kind; the same Idempotency-Key returns the original send.
Scope: send
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: any
GET /v1/accounts/{a}/sends/by-idempotency-key
Find a send by the Idempotency-Key it was submitted with.
Scope: send
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
key | query | string | The Idempotency-Key the send was submitted with, up to 200 characters. |
GET /v1/accounts/{a}/sends/{id}
Show the state of a send, including media sends.
Scope: send
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Send ID. |
POST /v1/accounts/{a}/sends/{id}/cancel
Cancel a send that has not gone out yet.
Scope: send
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Send ID. |
GET /v1/accounts/{a}/threads/{thread}/messages
List the saved messages of one chat, newest first.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
thread (required) | path | string | Chat ID. |
cursor | query | string, nullable | The nextCursor of the previous page, up to 8192 characters. Send it with the same query. |
kind | query | string, nullable | Only list chats of this kind: direct, group or system. |
limit | query | integer, nullable | Items per page, from 1 to 200. |
relation | query | string, nullable | Contact lists only: friend (default), non_contact, unknown, or all cached people. |
search | query | string, nullable | Text to search for, up to 256 characters. The name query is accepted too. |
Response: NativeMessagePage
Types
CallMedia
Media type of a stored VoIP call record.
| Value | Description |
|---|---|
| ”video” | Video call record. |
| ”voice” | Voice-only call record. |
| ”unknown” | Call record whose media type could not be established. |
CallOutcome
Outcome recorded on a stored VoIP call record.
| Value | Description |
|---|---|
| ”connected” | Call connected and recorded a duration. |
| ”not_connected” | Call did not connect. |
| ”canceled” | Caller canceled before pickup. |
| ”canceled_by_peer” | Other user canceled before pickup. |
| ”declined” | Call was declined locally. |
| ”declined_by_peer” | Call was declined by the other user. |
| ”busy” | Local line was busy. |
| ”busy_peer” | Other user’s line was busy. |
| ”not_answered” | Call was not answered locally. |
| ”not_answered_by_peer” | Other user did not answer. |
| ”answered_elsewhere” | Call was already answered on another device. |
| ”declined_elsewhere” | Call was declined on another device. |
| ”ended” | Call ended or disconnected. |
| ”unsupported_by_peer” | Other user’s client cannot accept calls. |
| ”unknown” | Outcome could not be determined from stored metadata. |
ChannelsLiveStatus
Live-stream status carried on a Channels Live share card.
| Value | Description |
|---|---|
| ”live” | Stream was reported live when the card was stored. |
| ”ended” | Stream was reported ended when the card was stored. |
| ”unknown” | Live status was absent or unrecognized. |
ContactCardKind
Category of a shared WeChat contact card.
| Value | Description |
|---|---|
| ”personal” | Ordinary personal WeChat contact card. |
| ”official_account” | Official Account or Service Account card. |
| ”wecom” | WeCom (OpenIM) business contact card. |
| ”customer_support” | WeCom Customer Support contact card. |
| ”photo_account” | Photo Account contact card. |
LinkCard
Details of a shared link, article, music or video card, or a Channels post.
| Field | Type | Description |
|---|---|---|
description (required) | string, nullable | Card description or summary. Null when there is none. |
durationSeconds | integer, nullable | Length of a Channels video in seconds. Omitted for other cards and when the card does not say. |
sourceName (required) | string, nullable | Name of the site or account that published the card, such as a Channels account. Null when there is none. |
title (required) | string, nullable | Card title. Null when there is none. |
url (required) | string, nullable | Address the card opens. Null when the card has none or it is not a valid http or https address. |
LocationCard
A static location pin. No map service is contacted and the coordinates are not converted.
| Field | Type | Description |
|---|---|---|
address (required) | string, nullable | Address text supplied with the pin. Null when there is none. |
coordinateSystem (required) | LocationCoordinateSystem | Coordinate system of the numbers. It is always unknown, because coordinates are reported as sent. |
latitude (required) | number | Latitude in degrees, from -90 to 90. |
longitude (required) | number | Longitude in degrees, from -180 to 180. |
mapType (required) | string, nullable | Map type text supplied with the pin, as sent. Null when there is none. |
name (required) | string, nullable | Place name supplied with the pin. Null when there is none. |
poiId (required) | string, nullable | Place identifier supplied with the pin, as sent. Null when there is none. |
scale (required) | integer, nullable | Map scale value supplied with the pin, as sent. Null when there is none. |
LocationCoordinateSystem
Coordinate system of a location pin’s latitude and longitude.
Type: “unknown”
MessageSummary
Structured read-only summary for a rich message type.
| Value | Description |
|---|---|
| object | Shared contact card (personal, Official Account, WeCom, Customer Support or Photo Account). |
| object | Stored voice or video call record (type 50). |
| object | Shared WeChat favorite note (type 49, subtype 24). |
| object | Shared Mini Program card or Mini Program profile card (type 49, subtypes 33 and 36). |
| object | Shared WeChat Channels live stream card (type 49, subtype 63). |
| object | Read-only WeChat Transfer record (type 49, subtype 2000). |
| object | Read-only WeChat Red Packet record (type 49, subtype 2001 with non-split-bill scene). |
| object | Read-only group split-bill request (type 49, subtype 2001 with scene 1001). |
| object | Passive live-location sharing notice (type 49, subtype 17). |
| object | Passive file-upload placeholder notice (type 49, subtype 74). |
| object | Plain-text group announcement notice (type 49, subtype 87). |
NativeMentions
Who a message mentions, read from the mention list saved with the message.
| Field | Type | Description |
|---|---|---|
all (required) | boolean, nullable | True when the message mentions everyone, false when it does not, and null when the mentions are unknown. |
self (required) | boolean, nullable | True when this account is among the mentioned members, false when it is not, and null when the mentions are unknown. |
source (required) | string, nullable | Where the mentions were read from, currently msgsource.atuserlist. Null when there is no source, for example when state is unknown. |
state (required) | string | known when the mention list was read, unknown when it is missing or cannot be parsed. When unknown, userIds is empty and the flags are null. |
userIds (required) | array of string | IDs of the members mentioned by name, not counting the mention-everyone marker (see all). |
NativeMessage
A saved message as read from the account’s profile. It carries only readable fields and never raw message XML.
| Field | Type | Description |
|---|---|---|
accountId (required) | string | ID of the account the message belongs to. |
appMessageType (required) | integer, nullable | For app messages (type 49), the app subtype, such as 5 link, 6 file, 8 shared sticker, 19 forwarded chat and 57 quote reply. Null for other messages. |
body (required) | string, nullable | Readable text of the message, such as the text itself or a summary of a link, location or forwarded chat. Null when there is nothing readable, for example for a photo. |
createdAt (required) | string, nullable | When the message was created, as an RFC 3339 time. Null when the saved time is missing. |
direction (required) | string, nullable | outgoing when this account sent the message and incoming when someone else did. Null for system notices and when it cannot be determined. |
id (required) | string | Message ID. Pass it back unchanged to routes that take a message ID. |
link (required) | LinkCard or , nullable | Link card details when the message is a shared link, article, music or video card, or a Channels post. Null otherwise. |
location | LocationCard or , nullable | Pin details when the message is a static location. Omitted for other messages. |
media (required) | array of any | Always an empty list today. Use the message’s media routes to list its attachments. |
mentions (required) | NativeMentions | Which members the message mentions. |
quote (required) | NativeQuoteReference or , nullable | The message this one replies to, when it is a quote reply. Null otherwise. |
recall | NativeRecallInfo or , nullable | Recall details. Present only when the message was recalled, in which case body is [Message recalled]. |
senderId (required) | string, nullable | ID of the sender. Null for system notices and when the sender cannot be determined. |
serverId (required) | string, nullable | WeChat’s own ID for the message, as a string because it can exceed the largest whole number JavaScript holds exactly. Null when the saved message has none. |
summary | MessageSummary or , nullable | Structured read-only summary for supported rich message types. Currently emitted for basic contact cards (42) and passive notices (49/17, 49/74, 49/87); additional variants in MessageSummary are reserved for follow-up parsers. Omitted for other messages. |
threadId (required) | string | ID of the chat the message is in. |
type (required) | integer | WeChat’s numeric message type, such as 1 text, 3 image, 34 voice, 43 video, 47 sticker, 48 location, 49 app message (links, files, quotes) and 10000 system notice. |
version (required) | string | Fingerprint of the saved profile data this message was read from. It changes whenever the profile files change, not only when this message changes. |
NativeMessagePage
One page of a list. items holds the resources, nextCursor continues the list, and the other fields describe the saved data the list was read from.
| Field | Type | Description |
|---|---|---|
asOfEventCursor (required) | string, nullable | Event cursor that was current when the list was first read. Resume the event stream from it to catch changes made after the read. |
coverage (required) | any | Which saved databases the read covered, as partial (true when some could not be read) and databases (each one with its state). It describes local data, not completeness on WeChat’s servers. |
items (required) | array of NativePageItemOfNativeMessage | The entries on this page, in list order. |
nextCursor (required) | string, nullable | Pass it as cursor with the same query to get the next page. Null on the last page. |
sourceGeneration (required) | string | Fingerprint of the saved profile data the page was read from. It changes when the profile files change. |
NativeOperation
A background operation such as signing in or out, refreshing contacts or changing a group. Poll it by ID until it finishes.
| Field | Type | Description |
|---|---|---|
accountId (required) | string | ID of the account the operation belongs to. |
createdAt (required) | string | When the operation was created, as an RFC 3339 time. |
id (required) | string | Operation ID. |
kind (required) | string | What the operation does, such as login, logout, sync, metadata, group_mutation, message_recall or media-writeback. |
result (required) | any | Details of the outcome. Its fields depend on kind, and it is empty until the operation has something to report. |
state (required) | string | Where the operation stands, such as queued, running, succeeded, failed or cancelled. Some kinds report more states, for example needs_review, or awaiting_scan and awaiting_approval during a login. |
updatedAt (required) | string | When the operation last changed, as an RFC 3339 time. |
NativePageItemOfNativeMessage
One entry on a page: the resource itself, or a tombstone when the resource has been removed since the list was first read.
| Value | Description |
|---|---|
| NativeMessage | |
| NativeTombstone |
NativeQuoteReference
The message a quote reply refers to. Its content comes only from the excerpt carried inside the reply, never from a saved copy of the original.
| Field | Type | Description |
|---|---|---|
appMessageType (required) | integer, nullable | App subtype of the quoted message when it is an app message (type 49), such as 5 for a link. Null for other messages. |
direction (required) | string, nullable | outgoing when the quoted message was sent by this account and incoming when someone else sent it. Null when that cannot be told. |
embeddedImage (required) | boolean, nullable | True when the reply carries the quoted image, so it can be downloaded through the reply’s media routes. |
embeddedLink | LinkCard or , nullable | Link card of the quoted message when it was a shared link, with the same fields as link on a message. |
embeddedSticker | boolean, nullable | True when the quoted message is a sticker. Omitted otherwise. |
embeddedSummary | MessageSummary or , nullable | Structured read-only summary of the quoted message when carried inside the reply. Omitted otherwise. |
embeddedText (required) | string, nullable | Readable text of the quoted message, taken from the reply. Null when there is none. |
senderId (required) | string, nullable | ID of the quoted message’s sender, when the reply says who it was. |
senderName | string, nullable | Sender’s display name carried inside the reply, when supplied by WeChat. |
serverId (required) | string | WeChat’s ID of the quoted message, as a string. |
state (required) | string, nullable | How much of the quote could be shown: embedded when the reply carries readable content, missing when it carries none, unsupported for a kind of message that cannot be shown as a quote, and recalled when the original was recalled and its content is hidden. |
type (required) | integer | WeChat’s numeric type of the quoted message, with the same values as type on a message. |
NativeRecallInfo
Details of a recalled message.
| Field | Type | Description |
|---|---|---|
observedAt (required) | string | When the daemon first saw the recall, as an RFC 3339 time. |
recalledAt | string, nullable | When WeChat says the message was recalled, as an RFC 3339 time. Omitted when that time is not known. |
replacementText | string, nullable | The notice text WeChat saved in place of the message. Omitted or null when there is none. |
NativeRecallRequest
Request to recall a message this account sent.
| Field | Type | Description |
|---|---|---|
serverId (required) | string | The message’s serverId, copied as a string. The recall is refused if it does not match the message in the URL. |
NativeTombstone
Stands in for a resource that was in the list when it was first read but is no longer in the saved profile. It keeps the resource’s place in the list.
| Field | Type | Description |
|---|---|---|
deleted (required) | boolean | Always true, marking the resource as removed. |
id (required) | string | ID of the removed resource. |
version (required) | string | Fingerprint of the saved profile data in which the resource is missing, the same value as sourceGeneration on the page. |
RedPacketScene
Red-packet scene category carried on subtype 2001 messages.
| Value | Description |
|---|---|
| ”ordinary” | Ordinary direct or group red packet. |
| ”enterprise” | Enterprise or OpenIM red packet. |
| ”other” | Other red-packet scene. |
RedPacketStatus
Claim status of a red packet when known from canonical evidence.
| Value | Description |
|---|---|
| ”unopened” | Red packet is unopened. |
| ”opened” | Red packet has been opened. |
| ”all_opened” | All shares of the red packet have been claimed. |
| ”expired” | Red packet expired before being claimed. |
| ”unknown” | Status is not established from the stored message row alone. |
SplitBillInvolvement
Whether this account created or owes payment on a group split-bill request.
| Value | Description |
|---|---|
| ”creator” | This account created the split-bill request. |
| ”payer” | This account is listed as a payer. |
| ”not_involved” | This account does not need to pay. |
| ”unknown” | Involvement could not be determined from the stored message. |
TransferStatus
Status carried inside a WeChat Transfer message row.
| Value | Description |
|---|---|
| ”pending” | Transfer is awaiting recipient confirmation. |
| ”pending_delayed” | Delayed-arrival transfer is awaiting recipient confirmation. |
| ”accepted” | Transfer was accepted and settled. |
| ”accepted_delayed” | Delayed-arrival transfer was accepted and awaits deposit. |
| ”rejected” | Transfer was rejected or refunded. |
| ”expired” | Transfer expired before acceptance. |
| ”unknown” | Transfer status was absent or unrecognized. |