Groups
GET /v1/accounts/{a}/group-mutations/by-idempotency-key
Find a group change by the Idempotency-Key it was submitted with.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
key | query | string | The Idempotency-Key the group change was submitted with. |
Response: NativeOperation
POST /v1/accounts/{a}/group-sync
Start syncing the group catalog from WeChat. Poll the returned operation.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
GET /v1/accounts/{a}/groups
List the saved groups.
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: NativeGroupPage
POST /v1/accounts/{a}/groups
Create a group chat with the chosen members. Poll the returned operation.
Scope: admin
| 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: NativeGroupCreateRequest
Response: NativeOperation
GET /v1/accounts/{a}/groups/{id}
Show one saved group.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Group ID. |
Response: NativeGroup
PATCH /v1/accounts/{a}/groups/{id}
Rename a group.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Group ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeGroupNameRequest
Response: NativeOperation
DELETE /v1/accounts/{a}/groups/{id}/announcement
Clear the announcement of a group.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Group ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Response: NativeOperation
POST /v1/accounts/{a}/groups/{id}/leave
Leave a group.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Group ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Response: NativeOperation
POST /v1/accounts/{a}/groups/{id}/members/refresh
Ask WeChat for the latest member list of one group. Poll the returned operation.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Group ID. |
GET /v1/accounts/{a}/groups/{id}/members/{username}
Show one member of a group.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Group ID. |
username (required) | path | string | Contact ID of the group member. |
Response: NativeGroupMemberLookup
PUT /v1/accounts/{a}/groups/{id}/my-name
Set your own display name in a group.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Group ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeGroupMyNameRequest
Response: NativeOperation
POST /v1/accounts/{a}/groups/{id}/refresh
Ask WeChat for the latest details of one group. Poll the returned operation.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Group ID. |
GET /v1/accounts/{a}/groups/{room}/lookup
Fetch one group’s member list live from WeChat, without saving it, optionally from a known member-list version.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
room (required) | path | string | Group ID. |
version | query | integer | The member-list version you already know. Defaults to 0. |
DELETE /v1/accounts/{a}/groups/{room}/members
Remove members from a group.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
room (required) | path | string | Group ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeGroupMembersRequest
Response: NativeOperation
GET /v1/accounts/{a}/groups/{room}/members
List the members of a group.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
room (required) | path | string | Group 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: NativeGroupMemberPage
POST /v1/accounts/{a}/groups/{room}/members
Add members to a group.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
room (required) | path | string | Group ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeGroupMembersRequest
Response: NativeOperation
Types
NativeGroup
A group chat saved in the account’s profile.
| Field | Type | Description |
|---|---|---|
administratorIds (required) | array of string, nullable | IDs of the group’s administrators. The owner is not listed unless WeChat lists them too, and the field is null when the saved data cannot say. |
announcement (required) | string, nullable | Text of the group’s current announcement. Null when there is none. |
canMentionAll (required) | boolean, nullable | Whether this account may mention everyone: true for the owner and administrators and false for other members. Null means permission is not established, and older servers omit the field. |
classification | PeerClassification or , nullable | |
displayName (required) | string, nullable | Name to show for the group: your remark if set, else the group’s name, else the ID. |
id (required) | string | Group ID, ending with @chatroom. It is the same as roomId. |
isInGroup (required) | boolean, nullable | True when this account is still a member of the group and false when it is not. Null when the saved data does not say. |
minimized (required) | boolean, nullable | True when the group is minimized (folded) in the chat list and false when it is not. Null when the saved data does not say. |
muted (required) | boolean, nullable | True when notifications for the group are muted and false when they are on. Null when the saved data does not say. |
myDisplayName (required) | string, nullable | This account’s own display name in the group. Null or omitted when it is not known. |
name (required) | string, nullable | The group’s own shared name. Null when none is saved. |
ownerId (required) | string, nullable | ID of the member who owns the group. Null when the saved data does not say. |
remark (required) | string, nullable | Your private name for the group. Null when none is saved. |
roomId (required) | string | Group ID, the same as id. |
NativeGroupCreateRequest
Request to create a group chat.
| Field | Type | Description |
|---|---|---|
members (required) | array of string | IDs of the contacts to add, from 2 to 40, without repeats and without this account’s own ID. |
name | string, nullable | Name for the new group, up to 512 bytes. Optional. |
NativeGroupMember
A member of a group, as saved in the account’s profile.
| Field | Type | Description |
|---|---|---|
alias (required) | string, nullable | The custom WeChat ID the member chose, which they can change. Null when none is saved. |
classification | PeerClassification or , nullable | |
displayName (required) | string, nullable | Name to show for the member: your remark, else their name in this group, else their nickname, else their username. |
id (required) | string | Member ID. It is the same as username. |
mentionName | string, nullable | Name used for this member in mention text. It comes from their name in the group or their nickname, never from your private remark, and falls back to the username. |
nickname (required) | string, nullable | The name the member chose for themselves. Null when none is saved. |
roomDisplayName (required) | string, nullable | The member’s own display name in this group. Null when none is saved. |
username (required) | string | The member’s WeChat username. |
NativeGroupMemberLookup
Result of looking up one person in a group’s saved member list.
| Field | Type | Description |
|---|---|---|
coverage (required) | string | How the answer was obtained. It is currently always cached, meaning saved data only. |
groupId (required) | string | ID of the group that was searched. |
member (required) | NativeGroupMember or , nullable | The member’s details when state is present, otherwise null. |
state (required) | string | present when the person is in the saved member list and unconfirmed when they are not. A missing row does not prove they left, because the saved list can be incomplete. |
username (required) | string | Username that was looked up. |
NativeGroupMemberPage
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 NativePageItemOfNativeGroupMember | 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. |
NativeGroupMembersRequest
Members to add to or remove from a group.
| Field | Type | Description |
|---|---|---|
members (required) | array of string | IDs of the contacts, from 1 to 40, without repeats and without this account’s own ID. |
NativeGroupMyNameRequest
Request to change this account’s display name in a group.
| Field | Type | Description |
|---|---|---|
displayName (required) | string | The new display name, up to 512 bytes. |
NativeGroupNameRequest
Request to rename a group.
| Field | Type | Description |
|---|---|---|
name (required) | string | The new group name. It must not be blank and can be up to 512 bytes. |
NativeGroupPage
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 NativePageItemOfNativeGroup | 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. |
NativePageItemOfNativeGroup
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 |
|---|---|
| NativeGroup | |
| NativeTombstone |
NativePageItemOfNativeGroupMember
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 |
|---|---|
| NativeGroupMember | |
| NativeTombstone |
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. |