# wechatpy/wechatpy

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/wechatpy-wechatpy).**

4,290 stars · 825 forks · Python · MIT

## Links

- GitHub: https://github.com/wechatpy/wechatpy
- Homepage: https://www.wechatpy.org
- awesome-repositories: https://awesome-repositories.com/repository/wechatpy-wechatpy.md

## Topics

`python` `sdk` `wechat` `wechat-sdk` `wechatpy` `weixin` `weixin-sdk`

## Description

wechatpy is a Python API SDK designed for interacting with official accounts, mini programs, and corporate communication APIs. It provides a unified interface for managing users, media, and messages, and includes a bot framework for processing incoming events and generating structured responses.

The project implements a component-based client factory to perform actions across different account types and orchestrates OAuth2 flows for identity verification. It features an event-driven bot architecture and a pluggable token storage system to persist authentication sessions across environments.

The library covers a broad set of functional areas, including payment processing and financial invoicing, enterprise workspace administration, and the management of digital assets and e-commerce storefronts. It also provides tools for cloud database operations, device binding, and the automation of corporate workflows.

Additional capabilities include security primitives for AES-based payload encryption, request authenticity verification, and user content auditing.

## Tags

### Networking & Communication

- [API Clients](https://awesome-repositories.com/f/networking-communication/api-clients.md) — Provides a unified API client to programmatically manage users, menus, media, and groups. ([source](https://wechatpy.readthedocs.org/zh_CN/master/quickstart.html))
- [WeChat API SDKs](https://awesome-repositories.com/f/networking-communication/wechat-api-sdks.md) — Provides a comprehensive Python SDK for interacting with the entire WeChat platform ecosystem.
- [Direct Message Replies](https://awesome-repositories.com/f/networking-communication/direct-message-replies.md) — Generates structured XML responses for sending immediate text replies to users. ([source](https://wechatpy.readthedocs.org/zh_CN/master/quickstart.html))
- [Enterprise WeChat Automation](https://awesome-repositories.com/f/networking-communication/enterprise-wechat-automation.md) — Provides programmatic tools for managing organizational structures and communications within WeChat Enterprise.
- [Incoming Message Processors](https://awesome-repositories.com/f/networking-communication/incoming-message-processors.md) — Converts raw XML message bodies into structured objects and decrypts incoming encrypted messages. ([source](https://wechatpy.readthedocs.org/zh_CN/master/quickstart.html))
- [Application Message Dispatch](https://awesome-repositories.com/f/networking-communication/message-brokers/application-message-dispatch.md) — Sends formatted text, markdown, and card messages to specific users or organizational groups. ([source](https://wechatpy.readthedocs.org/zh_CN/master/work/client.html))
- [Message Construction](https://awesome-repositories.com/f/networking-communication/message-construction.md) — Programmatically assembles formatted and encrypted XML response objects for chat messages. ([source](https://wechatpy.readthedocs.org/zh_CN/master/quickstart.html))
- [Message Templating](https://awesome-repositories.com/f/networking-communication/message-templating.md) — Defines the structure of automated notifications by managing subscription and message templates with dynamic placeholders. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/template.html))
- [Direct Message Deliveries](https://awesome-repositories.com/f/networking-communication/text-message-transmission/direct-message-deliveries.md) — Delivers one-to-one text, template, or group messages to maintain active communication. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/index.html))
- [WeChat Message Processing](https://awesome-repositories.com/f/networking-communication/wechat-message-processing.md) — Provides a framework for automating the sending and processing of interactive WeChat communications. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [XML Message Serialization](https://awesome-repositories.com/f/networking-communication/xml-message-serialization.md) — Formats response content into the required XML structure for automatic delivery to users. ([source](https://wechatpy.readthedocs.org/zh_CN/master/replies.html))
- [Targeted User Broadcasting](https://awesome-repositories.com/f/networking-communication/broadcast-messaging-channels/targeted-user-broadcasting.md) — Sends articles to targeted user segments and tracks the delivery status of mass broadcasts. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/message.html))
- [QR Code & Phone Verification Logins](https://awesome-repositories.com/f/networking-communication/communication-platforms-services/messaging-notification-systems/messaging-automation/account-authentication-gateways/account-authentication/qr-code-phone-verification-logins.md) — Generates specialized URLs that allow users to authenticate their identity by scanning a QR code. ([source](https://wechatpy.readthedocs.org/zh_CN/master/oauth.html))
- [System Event Triggers](https://awesome-repositories.com/f/networking-communication/communication-platforms-services/messaging-notification-systems/messaging-services/event-subscriptions/system-event-triggers.md) — Processes platform-specific system events such as user follows and QR scans to trigger application logic. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [Contact Management](https://awesome-repositories.com/f/networking-communication/contact-management.md) — Manages external client interactions through contact configuration and customer tagging. ([source](https://wechatpy.readthedocs.org/zh_CN/master/work/client.html))
- [Customer Service Forwarding](https://awesome-repositories.com/f/networking-communication/customer-service-forwarding.md) — Implements mechanisms to transition user interactions from an automated bot to human customer service operators. ([source](https://wechatpy.readthedocs.org/zh_CN/master/replies.html))
- [Auto-Reply Rule Management](https://awesome-repositories.com/f/networking-communication/direct-message-replies/pattern-triggered-message-replies/auto-reply-rule-management.md) — Retrieves and manages the rules that trigger automatic responses to incoming messages. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/message.html))
- [Group Chat Administration](https://awesome-repositories.com/f/networking-communication/group-chat-administration.md) — Provides tools for creating group chats and managing their memberships and invitations. ([source](https://wechatpy.readthedocs.org/zh_CN/master/work/client.html))
- [Proactive Messaging](https://awesome-repositories.com/f/networking-communication/proactive-messaging.md) — Initiates conversations by delivering images, articles, and coupons directly to specific users. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/message.html))
- [Support Session Control](https://awesome-repositories.com/f/networking-communication/support-session-control.md) — Manages the status of active chat sessions between customers and support agents. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/customservice.html))

### Part of an Awesome List

- [Account Client Factories](https://awesome-repositories.com/f/awesome-lists/devtools/service-factories/cloud-service-client-factories/account-client-factories.md) — Generates specialized API clients using unique identifiers to perform actions for different account types.

### Business & Productivity Software

- [Bot Development Frameworks](https://awesome-repositories.com/f/business-productivity-software/chat-backups/wechat/bot-development-frameworks.md) — Ships a comprehensive framework for building automated chat interfaces and event-driven bots.
- [Interactive Chat Bot Frameworks](https://awesome-repositories.com/f/business-productivity-software/chat-backups/wechat/bot-development-frameworks/interactive-chat-bot-frameworks.md) — Offers a framework for building interactive bots that handle events and structured XML responses.
- [Corporate Communication Platforms](https://awesome-repositories.com/f/business-productivity-software/corporate-communication-platforms.md) — Integrates with corporate communication platforms to manage organizational data and employee communications. ([source](https://cdn.jsdelivr.net/gh/wechatpy/wechatpy@master/README.md))
- [Corporate Organizational Structure Management](https://awesome-repositories.com/f/business-productivity-software/corporate-organizational-structure-management.md) — Organizes company departments, user roles, and external contact relationships within a corporate environment. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [Enterprise Messaging Toolkits](https://awesome-repositories.com/f/business-productivity-software/enterprise-messaging-toolkits.md) — Provides a toolkit for administering corporate workspaces, employee directories, and internal messaging.
- [WeChat Pay Integrations](https://awesome-repositories.com/f/business-productivity-software/payment-integrations/wechat-pay-integrations.md) — Implements backend integrations for processing transactions, refunds, and financial invoices via WeChat Pay.
- [Workspace Administration](https://awesome-repositories.com/f/business-productivity-software/workspace-administration.md) — Manages organizational structures including departments, employee directories, group chats, and internal calendars. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [Corporate Workspace Automations](https://awesome-repositories.com/f/business-productivity-software/corporate-workspace-automations.md) — Coordinates schedules, calendars, and asynchronous tasks for corporate account management. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [Digital Coupon Management](https://awesome-repositories.com/f/business-productivity-software/digital-coupon-management.md) — Generates ticket data and parameters to distribute digital promotional coupons to users. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/jsapi.html))
- [Electronic Invoicing Systems](https://awesome-repositories.com/f/business-productivity-software/electronic-invoicing-systems.md) — Queries structured invoice information and updates reimbursement statuses to manage financial records. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/invoice.html))
- [Account Engagement Events](https://awesome-repositories.com/f/business-productivity-software/engagement-automation/account-engagement-events.md) — Handles notifications for user actions like following, unfollowing, or scanning account codes. ([source](https://wechatpy.readthedocs.org/zh_CN/master/events.html))
- [Support Personnel Account Management](https://awesome-repositories.com/f/business-productivity-software/messaging-account-managers/support-personnel-account-management.md) — Creates and updates personnel accounts used for customer support, including nicknames and passwords. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/customservice.html))
- [Payment Notification Parsing](https://awesome-repositories.com/f/business-productivity-software/payment-notification-parsing.md) — Decodes and validates XML notifications sent by payment servers to confirm transaction results. ([source](https://wechatpy.readthedocs.org/zh_CN/master/pay.html))
- [Payment Order Management](https://awesome-repositories.com/f/business-productivity-software/payment-order-management.md) — Creates, queries, and revokes payment orders for various transaction types across different digital interfaces. ([source](https://wechatpy.readthedocs.org/zh_CN/master/pay.html))
- [Payment Transaction Processings](https://awesome-repositories.com/f/business-productivity-software/payment-transaction-processings.md) — Handles cash envelopes, vouchers, and order management to facilitate payments and refunds. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [Product Listings](https://awesome-repositories.com/f/business-productivity-software/product-variant-management/product-listings.md) — Enables creation and organization of product records and listings for scanning services. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/scan.html))
- [Publication Workflow Controls](https://awesome-repositories.com/f/business-productivity-software/publication-workflow-controls.md) — Provides controls for submitting products for review and managing their public visibility status. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/scan.html))
- [Audience Segmentation](https://awesome-repositories.com/f/business-productivity-software/user-profile-management/audience-segmentation.md) — Handles user profile management and audience segmentation using custom tags and groups.

### Data & Databases

- [Account and Contact Management](https://awesome-repositories.com/f/data-databases/account-discovery/wechat/account-and-contact-management.md) — Provides programmatic management of business account communication and contact relationships. ([source](https://cdn.jsdelivr.net/gh/wechatpy/wechatpy@master/README.md))
- [Cloud Database Management Tools](https://awesome-repositories.com/f/data-databases/cloud-database-management-tools.md) — Performs data operations and record aggregation within cloud-based development environments. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/cloud.html))
- [Collection Management](https://awesome-repositories.com/f/data-databases/collection-management.md) — Provides administrative operations for creating and retrieving data collections within cloud storage. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/cloud.html))
- [XML Serialization](https://awesome-repositories.com/f/data-databases/data-serialization-formats/xml-serialization-formats/xml-serialization.md) — Converts structured Python objects into XML strings and vice versa for platform-compliant communication.
- [Platform Interaction Capture](https://awesome-repositories.com/f/data-databases/event-capture/platform-interaction-capture.md) — Captures platform-level triggers such as menu clicks and location sharing events. ([source](https://wechatpy.readthedocs.org/zh_CN/master/events.html))
- [Financial Statement Retrievers](https://awesome-repositories.com/f/data-databases/financial-data-connectors/corporate-financial-report-retrievers/financial-statement-retrievers.md) — Downloads reconciliation bills and fund flow reports for auditing and record keeping. ([source](https://wechatpy.readthedocs.org/zh_CN/master/pay.html))

### Mobile Development

- [Mini Program Development](https://awesome-repositories.com/f/mobile-development/mini-program-development.md) — Provides tools for the creation and management of lightweight mini-applications within the ecosystem. ([source](https://cdn.jsdelivr.net/gh/wechatpy/wechatpy@master/README.md))
- [Mini Program Native Integrations](https://awesome-repositories.com/f/mobile-development/mini-program-native-integrations.md) — Connects specialized interfaces and system APIs required for developing small-scale mini-applications. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))

### Programming Languages & Runtimes

- [WeChat Mini Program SDKs](https://awesome-repositories.com/f/programming-languages-runtimes/styling-languages/mini-program/wechat-mini-program-runtimes/wechat-mini-program-sdks.md) — Provides an SDK for developing mini programs and managing associated cloud databases and deployments.
- [Cloud Service Development](https://awesome-repositories.com/f/programming-languages-runtimes/cloud-service-development.md) — Enables the development of backend logic and data management for small applications within cloud environments. ([source](https://cdn.jsdelivr.net/gh/wechatpy/wechatpy@master/README.md))
- [Login Authentications](https://awesome-repositories.com/f/programming-languages-runtimes/styling-languages/mini-program/wechat-mini-program-runtimes/wechat-mini-program-sdks/login-authentications.md) — Exchanges temporary login codes for session information to authenticate users within the mini-program environment. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/wxa.html))

### Security & Cryptography

- [Request Signature Verification](https://awesome-repositories.com/f/security-cryptography/authentication-and-authorization/request-signature-verification.md) — Validates incoming server requests using cryptographic signatures and timestamps to ensure authenticity. ([source](https://wechatpy.readthedocs.org/zh_CN/master/quickstart.html))
- [Authentication Token Management](https://awesome-repositories.com/f/security-cryptography/authentication-token-management.md) — Handles the retrieval and storage of authentication tokens to maintain active sessions. ([source](https://wechatpy.readthedocs.org/zh_CN/master/quickstart.html))
- [Authorized Account Actions](https://awesome-repositories.com/f/security-cryptography/authorized-account-actions.md) — Provides mechanisms for executing API operations on behalf of official accounts using authorized identifiers. ([source](https://wechatpy.readthedocs.org/zh_CN/master/component.html))
- [User Profile Management](https://awesome-repositories.com/f/security-cryptography/identity-access-management/identity-management/user-management/user-profile-management.md) — Manages user identities, custom tags, and profile information for account followers. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [Identity Authentication](https://awesome-repositories.com/f/security-cryptography/identity-authentication.md) — Constructs authorization URLs and exchanges codes for identity information to secure web logins. ([source](https://wechatpy.readthedocs.org/zh_CN/master/work/client.html))
- [OAuth 2.0 Authorization Flows](https://awesome-repositories.com/f/security-cryptography/oauth-2-0-authorization-flows.md) — Authenticates users via standard web-based OAuth 2.0 authorization flows. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [Authorization Code Flow Handlers](https://awesome-repositories.com/f/security-cryptography/oauth-2-0-authorization-flows/authorization-code-flow-handlers.md) — Handles the exchange of authorization codes for tokens and the refreshing of expired session keys. ([source](https://wechatpy.readthedocs.org/zh_CN/master/oauth.html))
- [OAuth2 Flow Implementations](https://awesome-repositories.com/f/security-cryptography/oauth2-flow-implementations.md) — Implements the standard OAuth2 sequence of authorization URLs and code exchanges for identity verification.
- [AES Encryption and Decryption](https://awesome-repositories.com/f/security-cryptography/transport-layer-encryption/aes-encrypted-transports/aes-encryption-and-decryption.md) — Implements AES encryption and decryption for securing incoming and outgoing message bodies.
- [User Access Management](https://awesome-repositories.com/f/security-cryptography/user-access-management.md) — Implements authorization and organizes user profiles with tags and groups for personalized interactions. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [User Profile Retrieval](https://awesome-repositories.com/f/security-cryptography/user-profile-retrieval.md) — Fetches detailed identity information and user profiles using valid access tokens or authorization codes. ([source](https://wechatpy.readthedocs.org/zh_CN/master/oauth.html))
- [Token Authenticity Verifications](https://awesome-repositories.com/f/security-cryptography/access-token-management/token-authenticity-verifications.md) — Verifies if a specific access token remains active and valid for the associated user. ([source](https://wechatpy.readthedocs.org/zh_CN/master/oauth.html))
- [Enterprise Personnel Onboarding](https://awesome-repositories.com/f/security-cryptography/identity-access-management/identity-management/user-management/cross-user-record-management/enterprise-personnel-onboarding.md) — Handles the creation of member records and generation of join-in QR codes for corporate onboarding. ([source](https://wechatpy.readthedocs.org/zh_CN/master/work/client.html))
- [Organizational Structure Management](https://awesome-repositories.com/f/security-cryptography/identity-access-management/identity-management/user-management/organizational-structure-management.md) — Updates corporate organizational structures and retrieves member lists for specific departments. ([source](https://wechatpy.readthedocs.org/zh_CN/master/work/client.html))
- [Message Decryption](https://awesome-repositories.com/f/security-cryptography/message-decryption.md) — Decrypts encrypted XML message payloads using secure session keys. ([source](https://wechatpy.readthedocs.org/zh_CN/master/work/quickstart.html))
- [Pluggable Token Persistence](https://awesome-repositories.com/f/security-cryptography/pluggable-token-persistence.md) — Provides a pluggable mechanism to persist authentication tokens using custom backends like Redis.
- [Third-Party Integrations](https://awesome-repositories.com/f/security-cryptography/third-party-integrations.md) — Manages API configurations and credentials for multiple official accounts through a component-based architecture. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))

### Software Engineering & Architecture

- [Official Account Management](https://awesome-repositories.com/f/software-engineering-architecture/component-lifecycle-management/component-detail-retrievers/content-detail-retrievers/wechat-account-detail-retrievers/official-account-management.md) — Manages the lifecycle, messaging, and content interactions of official business accounts. ([source](https://cdn.jsdelivr.net/gh/wechatpy/wechatpy@master/README.md))
- [Event-Driven Bot Handlers](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-bot-handlers.md) — Processes incoming webhooks as distinct events to trigger automated chat response logic.
- [Unified API Clients](https://awesome-repositories.com/f/software-engineering-architecture/unified-api-clients.md) — Wraps diverse platform endpoints into a consistent set of Python methods for managing users, media, and messages.

### Content Management & Publishing

- [Media Asset Management](https://awesome-repositories.com/f/content-management-publishing/media-asset-management.md) — Uploads and organizes images, videos, and other media files for use in messages and menus. ([source](https://wechatpy.readthedocs.org/zh_CN/master/))
- [Navigation Menu Configurators](https://awesome-repositories.com/f/content-management-publishing/navigation-menu-configurators.md) — Provides tools to create and modify interactive navigation menus for user browsing. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/index.html))

### DevOps & Infrastructure

- [Platform Code Deployments](https://awesome-repositories.com/f/devops-infrastructure/platform-code-deployments.md) — Submits application code packages to the platform for review and production deployment. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/wxa.html))

### System Administration & Monitoring

- [Chat Message Retrieval](https://awesome-repositories.com/f/system-administration-monitoring/chat-message-retrieval.md) — Provides administrative tools for fetching historical conversation transcripts between customers and agents. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/customservice.html))
- [Agent Queue Monitoring](https://awesome-repositories.com/f/system-administration-monitoring/outbound-queue-monitoring/agent-queue-monitoring.md) — Identifies online agents and retrieves pending customer sessions waiting for assignment. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/customservice.html))

### User Interface & Experience

- [Navigation Menu Management](https://awesome-repositories.com/f/user-interface-experience/navigation-menu-management.md) — Handles the creation, updating, and deletion of navigation menus within the account interface. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/menu.html))
- [Personalized Menus](https://awesome-repositories.com/f/user-interface-experience/navigation-menu-management/personalized-menus.md) — Assigns specific navigation menus to user groups based on matching rules. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/menu.html))
- [User Categorization Tags](https://awesome-repositories.com/f/user-interface-experience/ui-label-tags/user-categorization-tags.md) — Implements administrative tagging to group and categorize users for detailed audience segmentation and targeted messaging. ([source](https://wechatpy.readthedocs.org/zh_CN/master/client/tag.html))

### Web Development

- [Third-Party Platform Interfaces](https://awesome-repositories.com/f/web-development/third-party-api-clients/third-party-platform-interfaces.md) — Provides a unified interface for performing actions on official accounts via third-party platform relationships. ([source](https://cdn.jsdelivr.net/gh/wechatpy/wechatpy@master/README.md))
- [Third-Party Platform Authorizations](https://awesome-repositories.com/f/web-development/third-party-integrations/third-party-platform-authorizations.md) — Manages authorizations for third-party platforms to perform actions on behalf of official accounts. ([source](https://cdn.jsdelivr.net/gh/wechatpy/wechatpy@master/README.md))
