WeChatAuto.SDK: An AI-Powered Modern WeChat Automation Framework for Smarter WeChat Operations

Summary

WeChatAuto.SDK is a .NET-based, AI-friendly automation framework for WeChat PC client, built on UI automation technology. It supports message sending/receiving, group management, Moments interactions, and seamless LLM integration. Compatible with .NET Framework 4.8+/.NET 6.0+, it requires WeChat PC v3.9.12.55 and offers both software-only and hardware-assisted automation to minimize WeChat risk control triggers.

What is WeChatAuto.SDK?

If you frequently perform repetitive tasks on WeChat for PC—such as bulk messaging, group chat management, monitoring Moments updates, or integrating WeChat with artificial intelligence (like large language models) for intelligent replies—WeChatAuto.SDK is the tool you need.

In simple terms, WeChatAuto.SDK is an AI-focused automation framework designed specifically for the WeChat PC client. Developed with .NET and UI automation technologies, it enables automated operations for nearly all daily WeChat tasks. From sending and forwarding messages to creating and managing groups, or liking and commenting on Moments, this SDK has you covered. Most importantly, it’s tailored for AI integration—for example, letting large language models (LLMs) generate context-aware auto-replies—making WeChat operations smarter and more efficient.

Key Features of WeChatAuto.SDK

WeChatAuto.SDK boasts a comprehensive feature set covering almost every aspect of WeChat usage, while adapting to diverse scenario requirements:

  • Comprehensive Message Operations: Send text, emojis, and files; support @mentions; forward messages. Ideal for both one-on-one chats and group conversations.
  • Simplified Group Chat Management: Create groups, add/remove members, update group announcements, and more. A time-saver for anyone managing multiple WeChat groups.
  • Moments Interaction Tools: Like, comment on, and monitor Moments updates. Stay engaged with friends’ content or automate interaction workflows.
  • Intelligent Contact Management: Auto-add friends, organize contacts, and handle friend requests. Perfect for expanding networks or managing client relationships.
  • Real-Time Event Listening: Monitor incoming messages (with LLM context support), Moments updates, and new friend requests—enabling instant responses.
  • Risk Control Mitigation: Supports both software-only automation and hardware keyboard/mouse simulator integration. Choose the right approach for your security and business needs.
  • Easy Project Integration: Compatible with dependency injection, allowing seamless integration into existing .NET projects without full restructuring.
  • Multi-WeChat Instance Support: Manage multiple WeChat PC clients simultaneously, differentiated by WeChat nicknames.
  • AI-First Design: Natively supports LLM context integration and includes an MCP Server for connecting to mainstream AI agents/platforms (e.g., MEAI, SK, MAF), accelerating intelligent application development.

System Requirements for WeChatAuto.SDK

To use WeChatAuto.SDK, ensure your system meets the following specifications:

  • Operating System: Windows (exclusively—no support for macOS or Linux).
  • .NET Framework: .NET Framework 4.8+ or .NET 6.0+ (Windows-specific versions), including: net48; net481; net6.0-windows; net7.0-windows; net8.0-windows; net9.0-windows; net10.0-windows.
  • WeChat Client: Installed and running WeChat PC client (version 3.9.12.55). Compatibility issues may arise with other versions due to UI structure dependencies.

Getting Started with WeChatAuto.SDK

Follow these steps to start using WeChatAuto.SDK quickly:

1. Install WeChatAuto.SDK

The easiest way to install is via NuGet. Run the following command in your terminal:

dotnet add package WeChatAuto.SDK

2. Basic Usage Examples

Below are practical examples to help you implement core functionalities.

Example 1: Send a Message to a Friend or Group

Step 1: Create a new .NET console project:

dotnet new console -n demo01

Step 2: Modify the demo01.csproj file to set the target framework to net10.0-windows (or your preferred Windows-specific .NET version):

<PropertyGroup>
  <OutputType>Exe</OutputType>
  <TargetFramework>net10.0-windows</TargetFramework>
  <ImplicitUsings>enable</ImplicitUsings>
  <Nullable>enable</Nullable>
</PropertyGroup>

Note: Always set TargetFramework to a Windows-specific version (e.g., net10.0-windows) to avoid compilation warnings—this SDK is Windows-exclusive.

Step 3: Install required dependencies:

dotnet add package WeChatAuto.SDK
dotnet add package Microsoft.Extensions.DependencyInjection

Step 4: Update Program.cs with the following code to send a test message:

using Microsoft.Extensions.DependencyInjection;
using WeChatAuto.Components;
using WeChatAuto.Services;

// Initialize WeAutomation service
var serviceProvider = WeAutomation.Initialize(options =>
{
    options.DebugMode = true;   // Enable debug mode (highlights focused windows with borders); disable in production
    //options.EnableRecordVideo = true;  // Enable video recording (saves to /Videos in the project's runtime directory)
});

using var clientFactory = serviceProvider.GetRequiredService<WeChatClientFactory>();
Console.WriteLine($"Currently open WeChat clients: {string.Join(",", clientFactory.GetWeChatClientNames())} ({clientFactory.GetWeChatClientNames().Count} total).");

// Get list of open WeChat client names
var clientNames = clientFactory.GetWeChatClientNames();    
// Retrieve the first WeChat client instance
var wxClient = clientFactory.GetWeChatClient(clientNames.First());  
 // Send a message to a friend named "AI.Net" (replace with your contact's name)
wxClient?.SendWho("AI.Net", "Hello! Welcome to the AI-Powered WeChat Automation Framework!"); 

Additional Notes:

  • If manually managing WeChatClientFactory, call clientFactory.Dispose() when the application ends, or use a using block for automatic disposal (as shown above). No action is needed if the SDK is integrated into your dependency injection container.
  • WeAutomation.Initialize() has two overloads: one for external dependency injection and one for internal use.

Example 2: Listen to Messages and Auto-Reply

Prerequisite: Install dependencies:

dotnet add package WeChatAuto.SDK
dotnet add package Microsoft.Extensions.Hosting

Update Program.cs to listen to a group chat and respond to messages:

using Microsoft.Extensions.Hosting;
using WeChatAuto.Services;
using WeChatAuto.Components;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

var builder = Host.CreateApplicationBuilder(args);

WeAutomation.Initialize(builder.Services, options =>
{
    options.DebugMode = true;  // Enable debug mode; disable in production
    //options.EnableRecordVideo = true;  // Enable video recording (saves to /Videos)
});

// Inject your custom services (e.g., LLM services)
builder.Services.AddSingleton<LLMService>();

var serviceProvider = builder.Services.BuildServiceProvider();
var clientFactory = serviceProvider.GetRequiredService<WeChatClientFactory>();
// Retrieve the WeChat client instance named "Alex" (replace with your WeChat nickname)
var client = clientFactory.GetWeChatClient("Alex");

// Listen to the group chat named "Test Group 11" (replace with your group name)
await client.AddMessageListener("Test Group 11", (messageContext) =>
{
    var index = 0;
    // Print newly received messages
    foreach (var message in messageContext.NewMessages)
    {
        index++;
        Console.WriteLine($"Received Message {index}: {message.ToString()}");
        Console.WriteLine($"Received Message {index}: {message.Who}: {message.MessageContent}");
    }

    // Print the last 10 messages from the full chat history
    var recentMessages = messageContext.AllMessages.Skip(messageContext.AllMessages.Count - 10).ToList();
    index = 0;
    foreach (var message in recentMessages)
    {
        index++;
        Console.WriteLine($"Recent Message {index}: {message.Who}: {message.MessageContent}");
        Console.WriteLine($"Detailed Message {index}: {message.ToString()}");
    }

    // Respond if mentioned (@)
    if (messageContext.IsBeAt())
    {
        var mentionedMessage = messageContext.MessageBubbleIsBeAt().FirstOrDefault();
        if (mentionedMessage != null)
        {
            messageContext.SendMessage("I was mentioned!!! I'll reply right away!!!", new List<string> { mentionedMessage.Who });
        }
        else
        {
            messageContext.SendMessage("I was mentioned!!! I'll reply right away!!!");
        }
    }

    // Respond if message is quoted
    if (messageContext.IsBeReferenced())
    {
        messageContext.SendMessage("My message was quoted!!!");
    }

    // Respond if tapped (WeChat's "nudge" feature)
    if (messageContext.IsBeTap())
    {
        messageContext.SendMessage("I got a nudge [smile]!!!");
    }

    // Generic reply for other messages (integrate LLM here for intelligent responses)
    if (!messageContext.IsBeAt() && !messageContext.IsBeReferenced() && !messageContext.IsBeTap())
    {
        var sender = messageContext.NewMessages.FirstOrDefault()?.Who;
        var content = messageContext.NewMessages.FirstOrDefault()?.MessageContent;
        messageContext.SendMessage($"I received your message, {sender}: {content}");
    }

    // Access your injected service (e.g., LLM logic)
    var llmService = messageContext.ServiceProvider.GetRequiredService<LLMService>();
    llmService.DoSomething();
});

var app = builder.Build();
await app.RunAsync();

/// <summary>
/// Sample LLM service to inject into MessageContext
/// </summary>
public class LLMService
{
    private readonly ILogger<LLMService> _logger;
    public LLMService(ILogger<LLMService> logger)
    {
        _logger = logger;
    }
    public void DoSomething()
    {
        _logger.LogInformation("Execute your custom business logic here (e.g., LLM-powered replies)");
    }
}

This example demonstrates how to listen to a specific group chat, respond to different triggers (mentions, quotes, nudges), and integrate custom services (like LLMs) for intelligent automation.

Example 3: Using MCP Server (VS Code Tutorial)

Step 1: Navigate to /.vscode/mcp.json in the source code and update the configuration:

{
    "servers": {
        "wechat_mcp_server": {
            "type": "stdio",
            "command": "dotnet",
            "args": [
                "run",
                "--project",
                "Replace with the path to your WeChatAuto.MCP.csproj file"
            ]
        }
    }
}

Step 2: Click the “Start” button in the mcp.json tab to launch the MCP Server.

Step 3: Open GitHub Copilot Chat and ask: “Please send the message ‘Hello world!’ to my WeChat contact: AI.Net”—the MCP Server will execute the command.

Architecture of WeChatAuto.SDK

WeChatAuto.SDK follows a clean, modular design based on the Page Object Model (POM) pattern. This approach abstracts WeChat’s UI into intuitive, scenario-specific objects, significantly improving the readability and maintainability of automation scripts.

1. Architecture Diagram

View the latest architecture here: WeChatAuto.SDK Architecture Diagram. Future updates will add automation support for Tencent Meeting, WeChat Official Accounts/Subscriptions, and enhanced MCP Server capabilities.

2. Core Class Relationships

Explore the relationships between key classes here: WeChatAuto.SDK Class Relationship Diagram. These classes work together to enable all automation features.

Development Roadmap for WeChatAuto.SDK

WeChatAuto.SDK is continuously evolving. Below is the current development status of planned features:

Category Feature Completion Notes
Message Management Send text messages
Message Management Send files
Message Management Send custom emojis Send by emoji index, name, or description
Message Management Quote messages
Message Management Initiate voice calls/voice conferences Supports 1-on-1 chats and group chats
Message Management Initiate video calls Supports 1-on-1 chats only
Message Management Start live streams Supports group chats
Message Management @group members
Message Management @all group members For group owners/administrators only
Message Management Merge and forward messages
Message Management Retrieve messages
Message Management Listen to messages
Message Management @mention when quoting messages
Message Management Add friends via messages
Message Management Get message details
Message Management Extract links from card messages
Message Management Chat window (contact/group) guardian Reopens accidentally closed windows
Contact Management Get contact list
Contact Management Send friend requests
Contact Management Accept friend requests
Contact Management Delete friends
Contact Management Listen to friend requests
Contact Management Auto-accept friend requests
Contact Management Auto-accept requests with specific keywords (add notes/tags)
Contact Management Edit contact notes
Contact Management Add contact tags
Group Management Create new groups
Group Management Invite members to groups
Group Management Rename groups
Group Management Edit group notes
Group Management Update group announcements
Group Management Edit personal group nickname
Group Management Enable/disable group mute
Group Management Get group list
Moments Retrieve Moments content
Moments Download Moments images
Moments Like Moments posts
Moments Auto-comment on Moments posts
MCP MCP Server
Enterprise Customer Service Auto-respond to queries using company knowledge base Answers based on internal knowledge repositories
Enterprise Supervision Oversee issues raised in enterprise customer groups For enterprise customer service supervision scenarios
Tencent Meeting Auto-schedule Tencent Meetings Automation for Tencent Meeting platform
Official/Subscription Accounts Auto-publish articles to Official/Subscription Accounts Automation for WeChat Official/Subscription Accounts
Productivity Scheduled tasks

Future priorities include:

  • Iterating on core features to improve stability and compatibility
  • Expanding automation scenarios to meet diverse business needs
  • Enhancing documentation and examples for easier integration
  • Prioritizing community feedback and feature requests

Important Considerations When Using WeChatAuto.SDK

To ensure a smooth experience, keep these key points in mind:

1. Risk Control Awareness

WeChat has strict anti-automation measures—frequent or suspicious activities may trigger risk control (e.g., account restrictions). Mitigate risks by:

  • Using hardware keyboard and mouse simulators for high-sensitivity tasks (more human-like input).
  • Limiting operation frequency to avoid rapid, repetitive actions.
  • Avoiding high-risk behaviors like mass friend requests or spamming identical messages.

2. WeChat Version Compatibility

WeChatAuto.SDK is built for WeChat PC v3.9.12.55. UI changes in other versions may cause functionality issues. Always test compatibility if using a different version, or stick to v3.9.12.55 for optimal performance.

3. Multi-Instance Best Practices

While the SDK supports multiple WeChat instances, each instance operates independently. Ensure clear differentiation between accounts to avoid accidental actions (e.g., sending messages from the wrong account).

What Are Hardware Keyboard and Mouse Simulators? Why Use Them?

Hardware keyboard and mouse simulators are specialized devices that replicate physical keyboard and mouse inputs. You might wonder: Why not use software-only methods like API calls (e.g., PostMessage, SetInput) for simulation?

The answer lies in risk control. Software-based input simulation leaves digital traces that WeChat’s anti-automation systems can easily detect, triggering risk control. In contrast, hardware simulators send low-level signals that mimic human hand movements—making them nearly indistinguishable from manual operations. This gives them a significant advantage in terms of security and stealth.

Testing shows that hardware simulators drastically reduce risk control triggers for high-sensitivity tasks (e.g., adding friends in groups). Note that even manual operations can trigger risk control in extreme cases—always use simulators for high-risk scenarios and follow WeChat’s usage guidelines.

WeChatAuto.SDK supports both software-only and hardware-assisted automation, letting you choose the right approach for your needs. Learn more about hardware simulators here: SKSimulator.

What’s New with WeChat 4.X Support?

Development for WeChat 4.x.x is underway, with a new implementation based on computer vision. However, current limitations in computer vision technology make real-time chat history monitoring challenging—this version is not yet suitable for production use. If you have ideas or suggestions to address this, feel free to contribute to the discussion.

What Are the Benefits of VIP Service?

Due to limited time and resources, priority technical support is exclusively available to VIP customers. This ensures that paying users receive the highest quality, most reliable experience while supporting ongoing development.

普通 users can still provide feedback and ask questions via GitHub Issues, but responses may be delayed.

Exclusive VIP Benefits

  • Priority Bug Fixes: Get immediate attention for critical bugs to ensure your projects run smoothly.
  • Comprehensive Documentation: Access detailed, regularly updated API docs to accelerate integration.
  • Step-by-Step Tutorial Videos: Learn from beginner-to-advanced video guides to master the SDK quickly.
  • VIP Technical Chat Group: Get real-time, personalized support from the development team and fellow VIP users.
  • Exclusive Private Repository: Access a dedicated repository with premium extensions and exclusive content.

Non-VIP Users

Non-VIP users have full access to all core features and code—no functional restrictions. Feedback and questions are welcome via GitHub Issues, but response times may vary based on development priorities.

To upgrade to VIP or learn more about pricing and benefits, contact the development team directly.

License Information

WeChatAuto.SDK is licensed under the MIT License. See the full license details here: LICENSE.

Frequently Asked Questions (FAQ)

1. Does WeChatAuto.SDK support macOS or Linux?

No, WeChatAuto.SDK is exclusively designed for Windows operating systems.

2. Why do I get compilation warnings after installing the SDK?

Warnings typically occur if your project’s TargetFramework is not set to a Windows-specific version (e.g., net10.0-windows). Update your .csproj file to resolve this.

3. I’m using WeChat PC v3.9.12.55—why aren’t some features working?

Environmental differences or untested use cases may cause issues. Double-check your code against the examples, and report bugs via GitHub Issues with detailed steps to reproduce.

4. Will using WeChatAuto.SDK get my WeChat account banned?

There is a risk of triggering WeChat’s risk control if you perform excessive or suspicious actions. Follow the risk mitigation guidelines (e.g., use hardware simulators, limit operation frequency) to minimize this risk.

5. Can non-VIP users access all features?

Yes—non-VIP users have full access to all core functionalities. The only difference is priority technical support and exclusive content for VIP users.

6. How do I integrate my custom service (e.g., LLM) with WeChatAuto.SDK?

Use dependency injection to register your service (as shown in Example 2), then retrieve it from the messageContext.ServiceProvider in event listeners.

7. Which features will be developed next?

The team prioritizes community feedback and core stability improvements. Check the development roadmap for the latest updates.

8. When will WeChat 4.X support be ready for production?

No official timeline is available yet. WeChat 4.X support depends on advancements in computer vision technology for reliable chat history monitoring. Follow the project’s GitHub repository for updates.


With its robust feature set, AI-friendly design, and flexible integration options, WeChatAuto.SDK is the ultimate tool for automating WeChat PC workflows. Whether you’re building a chatbot, streamlining customer support, or enhancing productivity, this SDK provides the foundation for intelligent, efficient WeChat automation. For further assistance, refer to the official documentation or join the community via GitHub.