跳转到内容

Groups

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

GET /v1/accounts/{a}/group-mutations/by-idempotency-key

Find a group change by the Idempotency-Key it was submitted with.

Scope: admin

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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

GET /v1/accounts/{a}/groups

List the saved groups.

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: NativeGroupPage

POST /v1/accounts/{a}/groups

Create a group chat with the chosen members. Poll the returned operation.

Scope: admin

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: NativeGroupCreateRequest

Response: NativeOperation

GET /v1/accounts/{a}/groups/{id}

Show one saved group.

Scope: read

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

Response: NativeGroup

PATCH /v1/accounts/{a}/groups/{id}

Rename a group.

Scope: admin

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

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

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

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

GET /v1/accounts/{a}/groups/{id}/members/{username}

Show one member of a group.

Scope: read

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

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

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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
room (required)pathstringGroup ID.
versionqueryintegerThe member-list version you already know. Defaults to 0.

DELETE /v1/accounts/{a}/groups/{room}/members

Remove members from a group.

Scope: admin

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

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
room (required)pathstringGroup 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: NativeGroupMemberPage

POST /v1/accounts/{a}/groups/{room}/members

Add members to a group.

Scope: admin

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

FieldTypeDescription
administratorIds (required)array of string, nullableIDs 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, nullableText of the group’s current announcement. Null when there is none.
canMentionAll (required)boolean, nullableWhether 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.
classificationPeerClassification or , nullable
displayName (required)string, nullableName to show for the group: your remark if set, else the group’s name, else the ID.
id (required)stringGroup ID, ending with @chatroom. It is the same as roomId.
isInGroup (required)boolean, nullableTrue 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, nullableTrue 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, nullableTrue when notifications for the group are muted and false when they are on. Null when the saved data does not say.
myDisplayName (required)string, nullableThis account’s own display name in the group. Null or omitted when it is not known.
name (required)string, nullableThe group’s own shared name. Null when none is saved.
ownerId (required)string, nullableID of the member who owns the group. Null when the saved data does not say.
remark (required)string, nullableYour private name for the group. Null when none is saved.
roomId (required)stringGroup ID, the same as id.

NativeGroupCreateRequest

Request to create a group chat.

FieldTypeDescription
members (required)array of stringIDs of the contacts to add, from 2 to 40, without repeats and without this account’s own ID.
namestring, nullableName for the new group, up to 512 bytes. Optional.

NativeGroupMember

A member of a group, as saved in the account’s profile.

FieldTypeDescription
alias (required)string, nullableThe custom WeChat ID the member chose, which they can change. Null when none is saved.
classificationPeerClassification or , nullable
displayName (required)string, nullableName to show for the member: your remark, else their name in this group, else their nickname, else their username.
id (required)stringMember ID. It is the same as username.
mentionNamestring, nullableName 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, nullableThe name the member chose for themselves. Null when none is saved.
roomDisplayName (required)string, nullableThe member’s own display name in this group. Null when none is saved.
username (required)stringThe member’s WeChat username.

NativeGroupMemberLookup

Result of looking up one person in a group’s saved member list.

FieldTypeDescription
coverage (required)stringHow the answer was obtained. It is currently always cached, meaning saved data only.
groupId (required)stringID of the group that was searched.
member (required)NativeGroupMember or , nullableThe member’s details when state is present, otherwise null.
state (required)stringpresent 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)stringUsername 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.

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

NativeGroupMembersRequest

Members to add to or remove from a group.

FieldTypeDescription
members (required)array of stringIDs 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.

FieldTypeDescription
displayName (required)stringThe new display name, up to 512 bytes.

NativeGroupNameRequest

Request to rename a group.

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

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

NativePageItemOfNativeGroup

One entry on a page: the resource itself, or a tombstone when the resource has been removed since the list was first read.

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

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

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.

PeerApplication

Reference to an account type for one language, from the saved WeCom application data. The label of the account type is not included.

FieldTypeDescription
accountTypeCached (required)booleanTrue when the profile also holds the label for this account type and language. The label itself is not returned.
accountTypeId (required)string, nullableID of the account type for this language. Null when none is saved.
languageId (required)integerThe language this entry applies to, as the number WeChat stores.

PeerBusinessKind

Kind of business account, worked out from the numeric businessType.

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

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

FieldTypeDescription
businessKind (required)PeerBusinessKind or , nullable
businessType (required)integer, nullableNumeric 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 , nullableSaved 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.

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

FieldTypeDescription
appId (required)string, nullableID of the WeCom application the peer belongs to. Null when none is saved.
applications (required)array of PeerApplicationAccount type references, one per language.
wordingId (required)string, nullableID of the set of labels in wordings. Null when none is saved.
wordings (required)array of PeerWordingLocalized labels for the peer, one per language.

PeerWording

A label in one language.

FieldTypeDescription
languageId (required)integerThe language of the text, as the number WeChat stores. Choose the language to show in your app.
text (required)stringThe label text.