Threads
GET /v1/accounts/{a}/threads
List the chats, newest activity first.
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: NativeThreadPage
GET /v1/accounts/{a}/threads/{id}
Show one chat.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Chat ID. |
Response: NativeThread
PUT /v1/accounts/{a}/threads/{id}/notifications
Mute or unmute notifications for a chat.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Chat ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeThreadNotificationsRequest
Response: NativeOperation
PUT /v1/accounts/{a}/threads/{id}/pin
Pin or unpin a chat.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Chat ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeThreadPinRequest
Response: NativeOperation
POST /v1/accounts/{a}/threads/{thread}/read-state
Mark a chat as read when its read-state version still matches the one in the body.
Scope: read-state
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
thread (required) | path | string | Chat ID. |
Request body: NativeReadRequest
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. |
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). |
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. |
NativePageItemOfNativeThread
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 |
|---|---|
| NativeThread | |
| NativeTombstone |
NativeReadRequest
Request to mark a chat as read.
| Field | Type | Description |
|---|---|---|
expectedVersion (required) | string | The chat’s readStateVersion from when you read it. The request is refused if the chat has changed since. |
NativeThread
A chat in the chat list: a direct chat, a group or a built-in chat such as File Transfer. Summaries come from saved history and are not refreshed from WeChat.
| Field | Type | Description |
|---|---|---|
accountId (required) | string | ID of the account the chat belongs to. |
avatarMembers (required) | array of NativeThreadAvatarMember, nullable | Up to four cached group members, for drawing the group’s picture. Empty for direct chats or when the member list is unavailable. |
classification | PeerClassification or , nullable | |
displayName (required) | string, nullable | Name shown for the chat: your remark if set, else the contact’s nickname or the group’s name, else the ID. |
history (required) | any | How complete the saved history is. It currently always reports partial coverage and no local message count. |
id (required) | string | Chat ID. For a direct chat it is the contact’s username, and for a group it ends with @chatroom. |
kind (required) | string | direct for a one-to-one chat, group for a group, and system for a built-in chat such as File Transfer. |
lastMessage | NativeThreadMessage or , nullable | Preview of the latest message. Omitted when local message data is unavailable, and null when the chat has no messages. |
muted (required) | boolean, nullable | Saved notification preference: true when the chat is muted and false when it is not. Null means the profile cannot establish it. |
peerId (required) | string | ID of the person or group on the other side of the chat. It is the same as id. |
pinned (required) | boolean, nullable | Saved pin preference: true when the chat is pinned and false when it is not. Null means the profile cannot establish it. |
readStateVersion (required) | string | Version of the chat’s read state. Send it as expectedVersion when marking the chat read; the request is refused if the chat changed since. |
unreadCount (required) | integer, nullable | Number of unread messages as saved in the profile. Null when the saved data does not say. |
NativeThreadAvatarMember
A group member shown in the group’s picture.
| Field | Type | Description |
|---|---|---|
displayName (required) | string | Name to show for the member. |
id (required) | string | Member ID. |
NativeThreadMessage
Preview of the latest message in a chat.
| Field | Type | Description |
|---|---|---|
createdAt (required) | string, nullable | When the message was created, as an RFC 3339 time. Null when unknown. |
direction (required) | string, nullable | outgoing when this account sent the message and incoming when someone else did. Null when it cannot be determined. |
id (required) | string | ID of the message, the same as id on the full message. |
senderId (required) | string, nullable | ID of the sender. Null for system notices and when the sender is unknown. |
senderName (required) | string, nullable | Name of the sender, taken from the group’s cached members or your contacts. Null when the message has no sender or the name is unknown. |
summary | MessageSummary or , nullable | Structured read-only summary of the latest message when available. Omitted otherwise. |
text (required) | string | Plain-text preview of up to 160 characters. Media messages use labels such as Photo and Sticker, and a recalled message shows its recall notice. |
type (required) | integer | WeChat’s numeric message type, with the same values as type on a message. |
NativeThreadNotificationsRequest
Request to mute or unmute notifications for a chat.
| Field | Type | Description |
|---|---|---|
muted (required) | boolean | True to mute the chat and false to turn its notifications back on. |
NativeThreadPage
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 NativePageItemOfNativeThread | 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. |
NativeThreadPinRequest
Request to pin or unpin a chat.
| Field | Type | Description |
|---|---|---|
pinned (required) | boolean | True to pin the chat and false to unpin it. |
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. |
PeerApplication
Reference to an account type for one language, from the saved WeCom application data. The label of the account type is not included.
| Field | Type | Description |
|---|---|---|
accountTypeCached (required) | boolean | True when the profile also holds the label for this account type and language. The label itself is not returned. |
accountTypeId (required) | string, nullable | ID of the account type for this language. Null when none is saved. |
languageId (required) | integer | The language this entry applies to, as the number WeChat stores. |
PeerBusinessKind
Kind of business account, worked out from the numeric businessType.
| Value | Description |
|---|---|
| ”official_account” | An official account (business type 0). |
| “service_account” | A service account (business type 1). |
| “enterprise” | An enterprise account (business type 2). |
| “enterprise_child” | An enterprise child account (business type 3). |
| “photo_account” | A photo account (business type 5). |
PeerCategory
What kind of peer this is. It is separate from the chat type and from whether the peer is in your contacts.
| Value | Description |
|---|---|
| ”unknown” | No category is established. Do not assume a personal account or a friend. |
| ”system” | A built-in peer such as File Transfer. |
| ”group” | A group chat. |
| ”business” | An official or business account. |
| ”openim” | A WeCom contact. |
| ”openim_customer_service” | A WeCom customer-service identity. |
PeerClassification
What kind of peer this is, worked out from the saved profile each time it is read. Missing details do not mean the peer is an ordinary person or that you are not subscribed to it.
| Field | Type | Description |
|---|---|---|
businessKind (required) | PeerBusinessKind or , nullable | |
businessType (required) | integer, nullable | Numeric service type saved for a business account: 0 official account, 1 service account, 2 enterprise, 3 enterprise child, 5 photo account. Null for other peers and when the saved values conflict. |
category (required) | PeerCategory | |
namespace (required) | PeerNamespace | |
openIm (required) | PeerOpenIm or , nullable | Saved WeCom details, present for openim and openim_customer_service peers when the profile has them. Null otherwise. |
PeerNamespace
The family of IDs a peer’s ID belongs to, worked out from the ID itself. It does not grant any extra actions.
| Value | Description |
|---|---|
| ”wechat” | An ordinary WeChat ID, including groups ending with @chatroom. |
| ”openim” | An ID containing @openim, a WeCom contact. |
| ”openim_customer_service” | An ID containing @kefu.openim, a WeCom customer-service identity. |
| ”im_chatroom” | A group ID containing @im.chatroom. |
| ”qy” | An ID ending with @qy_u (a person) or @qy_g (a group). |
| “weclaw” | An ID containing @weclaw. |
| ”other” | Any other ID containing @ that matches no known family. |
PeerOpenIm
Saved WeCom (OpenIM) details for a peer.
| Field | Type | Description |
|---|---|---|
appId (required) | string, nullable | ID of the WeCom application the peer belongs to. Null when none is saved. |
applications (required) | array of PeerApplication | Account type references, one per language. |
wordingId (required) | string, nullable | ID of the set of labels in wordings. Null when none is saved. |
wordings (required) | array of PeerWording | Localized labels for the peer, one per language. |
PeerWording
A label in one language.
| Field | Type | Description |
|---|---|---|
languageId (required) | integer | The language of the text, as the number WeChat stores. Choose the language to show in your app. |
text (required) | string | The label text. |
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. |