explaingit

autumnwhj/chatgpt-wechat-bot

4,730TypeScriptAudience · developerComplexity · 2/5Setup · moderate

TLDR

A TypeScript bot that connects a WeChat account to ChatGPT, so anyone messaging that account receives AI-generated replies, including inside group chats.

Mindmap

mindmap
  root((WeChat ChatGPT Bot))
    What it does
      Auto-reply messages
      Group chat responses
      Context memory
    Setup
      OpenAI API key
      Reverse proxy URL
      QR code scan
    Config Options
      Trigger keywords
      Reset keyword
      Group vs private
    Tech Stack
      TypeScript
      Node.js
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Turn a spare WeChat account into an AI assistant that answers questions from friends or customers automatically.

USE CASE 2

Add an AI bot to a WeChat group that only responds when someone at-mentions it.

USE CASE 3

Automate WeChat customer support replies for a small business using ChatGPT.

Tech stack

TypeScriptNode.js

Getting it running

Difficulty · moderate Time to first run · 30min

Requires an OpenAI API key and a reverse proxy server accessible from outside mainland China.

In plain English

ChatGPT-wechat-bot is a TypeScript project that connects a WeChat account to the ChatGPT API, turning the account into an automated chat assistant. Once running, anyone who sends a message to the WeChat account can receive replies generated by ChatGPT. The bot also works inside WeChat group chats, where it responds when someone mentions it with an at-sign. The setup requires an OpenAI API key, which you obtain by creating an account on the OpenAI platform. Because ChatGPT's API is not directly accessible from mainland China, the project also requires a reverse proxy URL, which is a server outside China that forwards requests to OpenAI. You paste your API key and proxy address into a configuration file, then start the program with a couple of npm commands. A QR code appears in the terminal, you scan it with your phone using WeChat, and the bot goes live on that account. The bot keeps track of conversation context within a session, so follow-up questions work naturally. You can send a keyword such as "reset" to clear the context and start a fresh conversation. In group chats, you can configure a keyword that must be included before the bot replies, so it does not respond to every message in the group. The configuration file has a handful of options: the API key, the proxy URL, the keyword that triggers the bot in group chats, a separate keyword for private chats, the reset keyword, and toggles that control whether the bot echoes the original question back in its reply. The project requires Node.js version 16.8 or higher. The README is written mostly in Chinese, with a brief English introduction at the top. Common issues covered include what to do if WeChat sign-in gets stuck, how to handle truncated replies from ChatGPT, and how to fix a browser launch error related to the library used to drive the WeChat web interface.

Copy-paste prompts

Prompt 1
I'm setting up the chatgpt-wechat-bot. My WeChat QR code scan worked but the bot isn't replying. What should I check in the config file?
Prompt 2
Show me a step-by-step guide to configure the chatgpt-wechat-bot with my OpenAI API key and a reverse proxy URL so it works outside mainland China.
Prompt 3
How do I configure chatgpt-wechat-bot so it only responds in a group chat when someone types a specific keyword before their message?
Prompt 4
The chatgpt-wechat-bot is sending truncated replies. How do I fix that?
Open on GitHub → Explain another repo

← autumnwhj on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.