跳转到内容

Messages

此内容尚不支持你的语言。

GET /v1/accounts/{a}/messages

Search the saved messages of every chat in the account.

Scope: read

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
cursorquerystring, nullableThe nextCursor of the previous page, up to 8192 characters. Send it with the same query.
kindquerystring, nullableOnly list chats of this kind: direct, group or system.
limitqueryinteger, nullableItems per page, from 1 to 200.
relationquerystring, nullableContact lists only: friend (default), non_contact, unknown, or all cached people.
searchquerystring, nullableText 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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringMessage 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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringMessage ID.
Idempotency-Key (required)headerstringRepeating 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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
Idempotency-Key (required)headerstringRepeating 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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
keyquerystringThe 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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringSend ID.

POST /v1/accounts/{a}/sends/{id}/cancel

Cancel a send that has not gone out yet.

Scope: send

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringSend ID.

GET /v1/accounts/{a}/threads/{thread}/messages

List the saved messages of one chat, newest first.

Scope: read

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
thread (required)pathstringChat ID.
cursorquerystring, nullableThe nextCursor of the previous page, up to 8192 characters. Send it with the same query.
kindquerystring, nullableOnly list chats of this kind: direct, group or system.
limitqueryinteger, nullableItems per page, from 1 to 200.
relationquerystring, nullableContact lists only: friend (default), non_contact, unknown, or all cached people.
searchquerystring, nullableText 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.

ValueDescription
”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.

ValueDescription
”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.

ValueDescription
”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.

ValueDescription
”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.

FieldTypeDescription
description (required)string, nullableCard description or summary. Null when there is none.
durationSecondsinteger, nullableLength of a Channels video in seconds. Omitted for other cards and when the card does not say.
sourceName (required)string, nullableName of the site or account that published the card, such as a Channels account. Null when there is none.
title (required)string, nullableCard title. Null when there is none.
url (required)string, nullableAddress 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.

FieldTypeDescription
address (required)string, nullableAddress text supplied with the pin. Null when there is none.
coordinateSystem (required)LocationCoordinateSystemCoordinate system of the numbers. It is always unknown, because coordinates are reported as sent.
latitude (required)numberLatitude in degrees, from -90 to 90.
longitude (required)numberLongitude in degrees, from -180 to 180.
mapType (required)string, nullableMap type text supplied with the pin, as sent. Null when there is none.
name (required)string, nullablePlace name supplied with the pin. Null when there is none.
poiId (required)string, nullablePlace identifier supplied with the pin, as sent. Null when there is none.
scale (required)integer, nullableMap 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.

ValueDescription
objectShared contact card (personal, Official Account, WeCom, Customer Support or Photo Account).
objectStored voice or video call record (type 50).
objectShared WeChat favorite note (type 49, subtype 24).
objectShared Mini Program card or Mini Program profile card (type 49, subtypes 33 and 36).
objectShared WeChat Channels live stream card (type 49, subtype 63).
objectRead-only WeChat Transfer record (type 49, subtype 2000).
objectRead-only WeChat Red Packet record (type 49, subtype 2001 with non-split-bill scene).
objectRead-only group split-bill request (type 49, subtype 2001 with scene 1001).
objectPassive live-location sharing notice (type 49, subtype 17).
objectPassive file-upload placeholder notice (type 49, subtype 74).
objectPlain-text group announcement notice (type 49, subtype 87).

NativeMentions

Who a message mentions, read from the mention list saved with the message.

FieldTypeDescription
all (required)boolean, nullableTrue when the message mentions everyone, false when it does not, and null when the mentions are unknown.
self (required)boolean, nullableTrue when this account is among the mentioned members, false when it is not, and null when the mentions are unknown.
source (required)string, nullableWhere the mentions were read from, currently msgsource.atuserlist. Null when there is no source, for example when state is unknown.
state (required)stringknown 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 stringIDs 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.

FieldTypeDescription
accountId (required)stringID of the account the message belongs to.
appMessageType (required)integer, nullableFor 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, nullableReadable 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, nullableWhen the message was created, as an RFC 3339 time. Null when the saved time is missing.
direction (required)string, nullableoutgoing when this account sent the message and incoming when someone else did. Null for system notices and when it cannot be determined.
id (required)stringMessage ID. Pass it back unchanged to routes that take a message ID.
link (required)LinkCard or , nullableLink card details when the message is a shared link, article, music or video card, or a Channels post. Null otherwise.
locationLocationCard or , nullablePin details when the message is a static location. Omitted for other messages.
media (required)array of anyAlways an empty list today. Use the message’s media routes to list its attachments.
mentions (required)NativeMentionsWhich members the message mentions.
quote (required)NativeQuoteReference or , nullableThe message this one replies to, when it is a quote reply. Null otherwise.
recallNativeRecallInfo or , nullableRecall details. Present only when the message was recalled, in which case body is [Message recalled].
senderId (required)string, nullableID of the sender. Null for system notices and when the sender cannot be determined.
serverId (required)string, nullableWeChat’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.
summaryMessageSummary or , nullableStructured 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)stringID of the chat the message is in.
type (required)integerWeChat’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)stringFingerprint 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.

FieldTypeDescription
asOfEventCursor (required)string, nullableEvent 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)anyWhich 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 NativePageItemOfNativeMessageThe entries on this page, in list order.
nextCursor (required)string, nullablePass it as cursor with the same query to get the next page. Null on the last page.
sourceGeneration (required)stringFingerprint 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.

FieldTypeDescription
accountId (required)stringID of the account the operation belongs to.
createdAt (required)stringWhen the operation was created, as an RFC 3339 time.
id (required)stringOperation ID.
kind (required)stringWhat the operation does, such as login, logout, sync, metadata, group_mutation, message_recall or media-writeback.
result (required)anyDetails of the outcome. Its fields depend on kind, and it is empty until the operation has something to report.
state (required)stringWhere 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)stringWhen 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.

ValueDescription
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.

FieldTypeDescription
appMessageType (required)integer, nullableApp 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, nullableoutgoing 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, nullableTrue when the reply carries the quoted image, so it can be downloaded through the reply’s media routes.
embeddedLinkLinkCard or , nullableLink card of the quoted message when it was a shared link, with the same fields as link on a message.
embeddedStickerboolean, nullableTrue when the quoted message is a sticker. Omitted otherwise.
embeddedSummaryMessageSummary or , nullableStructured read-only summary of the quoted message when carried inside the reply. Omitted otherwise.
embeddedText (required)string, nullableReadable text of the quoted message, taken from the reply. Null when there is none.
senderId (required)string, nullableID of the quoted message’s sender, when the reply says who it was.
senderNamestring, nullableSender’s display name carried inside the reply, when supplied by WeChat.
serverId (required)stringWeChat’s ID of the quoted message, as a string.
state (required)string, nullableHow 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)integerWeChat’s numeric type of the quoted message, with the same values as type on a message.

NativeRecallInfo

Details of a recalled message.

FieldTypeDescription
observedAt (required)stringWhen the daemon first saw the recall, as an RFC 3339 time.
recalledAtstring, nullableWhen WeChat says the message was recalled, as an RFC 3339 time. Omitted when that time is not known.
replacementTextstring, nullableThe 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.

FieldTypeDescription
serverId (required)stringThe 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.

FieldTypeDescription
deleted (required)booleanAlways true, marking the resource as removed.
id (required)stringID of the removed resource.
version (required)stringFingerprint 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.

ValueDescription
”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.

ValueDescription
”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.

ValueDescription
”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.

ValueDescription
”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.