Contacts
此内容尚不支持你的语言。
GET /v1/accounts/{a}/avatars/{id}
Get the cached avatar picture of a contact or group. It does not download a new one.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Contact ID. |
POST /v1/accounts/{a}/avatars/{id}/refresh
Ask WeChat for the latest avatar of one contact, with optional group context for an OpenIM member. Poll the returned operation.
Scope: media, read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Contact ID. |
Request body: RefreshAvatarRequest
GET /v1/accounts/{a}/contact-mutations/by-idempotency-key
Inspect a contact operation using its original idempotency key.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
key | query | string | Original submitted idempotency key. |
Response: NativeOperation
GET /v1/accounts/{a}/contact-requests
List saved incoming and outgoing request conversations.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
actionable | query | boolean, nullable | Include only current acceptance candidates when true. |
cursor | query | string, nullable | Exact continuation from the same query. |
direction | query | string, nullable | Incoming or outgoing direction. |
limit | query | integer, nullable | Page size, from 1 to 200; default 50. |
search | query | string, nullable | Match saved labels, peer identities or verification text. |
Response: NativeContactRequestPage
POST /v1/accounts/{a}/contact-requests
Send one friend request with an account-bound discovery reference.
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: NativeContactRequestSend
Response: NativeOperation
DELETE /v1/accounts/{a}/contact-requests/{id}
Delete local request history; does not reject or cancel on the server.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Opaque friend request conversation ID from list/get. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeContactRequestVersion
Response: NativeOperation
GET /v1/accounts/{a}/contact-requests/{id}
Read a request conversation and its current version.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Opaque friend request conversation ID from list/get. |
Response: NativeContactRequest
POST /v1/accounts/{a}/contact-requests/{id}/accept
Accept the exact inspected incoming request.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Opaque friend request conversation ID from list/get. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeContactRequestAccept
Response: NativeOperation
POST /v1/accounts/{a}/contact-sync
Start syncing the contact 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}/contacts
List contacts and their relationship privacy when available.
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: NativeContactPage
POST /v1/accounts/{a}/contacts/lookup
Look up one or two contacts by ID live on WeChat, without saving the result.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Request body: ContactLookupRequest
DELETE /v1/accounts/{a}/contacts/{id}
Remove this account contact relationship, preserving chat history.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Contact ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Response: NativeOperation
GET /v1/accounts/{a}/contacts/{id}
Show one contact and its relationship privacy when available.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Contact ID. |
Response: NativeContact
PATCH /v1/accounts/{a}/contacts/{id}
Change relationship privacy or the remark against the inspected version.
Scope: admin
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Contact ID. |
Idempotency-Key (required) | header | string | Repeating a request with the same key returns the original result instead of repeating the work. |
Request body: NativeContactUpdate
Response: NativeOperation
POST /v1/accounts/{a}/contacts/{id}/refresh
Ask WeChat for the latest contact details and privacy. Poll the returned operation.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Contact ID. |
POST /v1/accounts/{a}/search/contacts
Discover a person on WeChat and return an opaque send reference.
Scope: read
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Request body: NativeContactSearchRequest
Response: NativeContactSearch
Types
ContactLookupRequest
Request to look up one or two contacts live on WeChat.
| Field | Type | Description |
|---|---|---|
ids (required) | array of string | One or two distinct contact IDs to look up. |
NativeContact
A contact saved in the account’s profile.
| Field | Type | Description |
|---|---|---|
alias (required) | string, nullable | The custom WeChat ID the contact chose, which they can change. Null when none is saved. |
classification | PeerClassification or , nullable | |
displayName (required) | string, nullable | Name to show: the remark if set, else the nickname, else the username. |
id (required) | string | Contact ID. It is the same as username. |
nickname (required) | string, nullable | The name the contact chose for themselves. Null when none is saved. |
privacy | NativeContactPrivacySettings or , nullable | Current relationship settings, when available for this friend. |
privacyPending | boolean, nullable | True while an accepted relationship edit is awaiting contact sync. |
privacyUnavailable | string, nullable | Why a friend has no privacy or privacyVersion, so it can’t be edited yet: contact_privacy_unresolved (refresh the contact), ordinary_contact_required (not supported for this contact), profile_identity_unavailable or contact_flags_unresolved. |
privacyVersion | string, nullable | Version to send as expectedVersion when changing this contact’s privacy or remark. It changes when the privacy or the relationship changes. |
relation (required) | string | Relationship evidence: friend when membership is established, non_contact when known flags do not establish membership, or unknown when flags are unavailable. |
remark (required) | string, nullable | Your private name for the contact. Null when none is saved. |
remarkPending | boolean, nullable | True while the remark is being fetched from WeChat after it changed, from this account or another device. Edits are still accepted meanwhile. |
username (required) | string | The contact’s WeChat username. |
NativeContactPage
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 NativePageItemOfNativeContact | 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. |
NativeContactPrivacySettings
Relationship privacy selected by the account owner.
| Field | Type | Description |
|---|---|---|
chatsOnly (required) | boolean | Restrict this relationship to chats. |
hideMyPosts (required) | boolean | Hide this account’s Moments posts from this person. |
hideTheirPosts (required) | boolean | Hide this person’s Moments posts from this account. |
NativeContactRequest
One per-peer canonical request conversation with a current action/version.
| Field | Type | Description |
|---|---|---|
actionable (required) | boolean | Whether the current incoming request can be accepted locally. |
attention (required) | boolean | Incoming request needing attention in navigation badges. |
direction (required) | string | Incoming or outgoing current row direction. |
displayName (required) | string | Saved contact label or retained peer identity. |
history (required) | array of NativeContactRequestMessage | Retained per-message verification history. |
id (required) | string | Opaque request identity. |
isContact (required) | boolean | Whether current canonical membership establishes a contact. |
message (required) | string | Current verification text. |
peerId (required) | string | Saved peer identity; does not itself establish friendship. |
state (required) | string | contact, request_received or request_sent; history is not server pending proof. |
updatedAt (required) | integer | Current row time in Unix seconds. |
version (required) | string | Exact version for accept/delete preconditions. |
NativeContactRequestAccept
Accept the inspected request with optional initial relationship privacy.
| Field | Type | Description |
|---|---|---|
expectedVersion (required) | string | Current request version returned by get/list. |
privacy | NativeContactPrivacySettings or , nullable | Initial relationship privacy; omission keeps the supported default. |
NativeContactRequestMessage
One saved verification-history entry without protocol tickets or XML.
| Field | Type | Description |
|---|---|---|
createdAt (required) | integer | Original event time in Unix seconds. |
direction (required) | string | Incoming or outgoing. |
message (required) | string | Verification text, treated as untrusted display data. |
serverId (required) | string | Original server ID as a decimal string; sent entries may use zero. |
NativeContactRequestPage
One page of per-peer request conversations.
| Field | Type | Description |
|---|---|---|
asOfEventCursor (required) | string | Event boundary of the retained list, for continuing the existing account event stream. |
coverage (required) | any | Local profile coverage description. |
items (required) | array of NativePageItemOfNativeContactRequest | Canonical request rows in update-time order. |
nextCursor (required) | string, nullable | Opaque continuation, or null after the final page. |
pendingIncomingCount (required) | integer | Incoming actionable rows needing attention across all filters. |
sourceGeneration (required) | string | Version of this filtered result collection. |
NativeContactRequestSend
Send one greeting to a resolved person.
| Field | Type | Description |
|---|---|---|
message (required) | string | Greeting supplied by the owner; no automatic default is inserted. |
privacy | NativeContactPrivacySettings or , nullable | Initial relationship privacy; omission keeps the supported default. |
recipientRef (required) | string | Exact reference returned by discovery on this account. |
NativeContactRequestVersion
Precondition for accepting or locally deleting the inspected request.
| Field | Type | Description |
|---|---|---|
expectedVersion (required) | string | Current request version returned by get/list. |
NativeContactSearch
Sanitized discovery preview with a short-lived account/session-bound send reference.
| Field | Type | Description |
|---|---|---|
contactId (required) | string, nullable | Canonical saved contact ID when membership is established for this identity. |
displayName (required) | string | Display query for the discovered identity. |
expiresAt (required) | integer | Unix seconds after which a new discovery is required. |
recipientRef (required) | string, nullable | Opaque send reference when verification material is available; null for matches without it. |
request (required) | NativeContactRequest or , nullable | Existing request conversation for the resolved identity, when retained locally. |
source (required) | string | Always wechat for this endpoint. |
NativeContactSearchRequest
Live WeChat contact discovery input. Email and broad nickname search are not supported.
| Field | Type | Description |
|---|---|---|
query (required) | string | Exact WeChat ID query. Phone lookup has not been verified. |
NativeContactUpdate
Update supported contact settings after inspecting their current version.
| Field | Type | Description |
|---|---|---|
expectedVersion (required) | string | Version from the contact’s privacyVersion on this account. |
privacy | NativeContactPrivacySettings or , nullable | Desired relationship settings; unrelated contact flags are preserved. Send either privacy or remark in one request. |
remark | string, nullable | New personal remark: a string sets it, null clears it, and omitting it keeps the current remark. Outer whitespace is removed. |
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. |
NativePageItemOfNativeContact
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 |
|---|---|
| NativeContact | |
| NativeTombstone |
NativePageItemOfNativeContactRequest
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 |
|---|---|
| NativeContactRequest | |
| 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. |
RefreshAvatarRequest
Optional group context for an OpenIM member’s avatar lookup.
| Field | Type | Description |
|---|---|---|
roomId | string, nullable | Group containing this known member, when context is required by WeChat. |