ChatGPT bot for WeChat public accounts
Top 75.7% on sourcepulse
This project provides a ChatGPT bot for WeChat Official Accounts, enabling passive replies to user messages. It targets developers and users looking to integrate ChatGPT's conversational AI into their WeChat presence, offering a bridge between the popular messaging platform and OpenAI's powerful language model.
How It Works
The bot leverages Go for its backend and interacts with the ChatGPT API. A key component is its method for obtaining and maintaining cf_clearance
and session-token
cookies, crucial for bypassing Cloudflare's security measures when accessing chat.openai.com
. It uses Playwright for browser automation to acquire these credentials, which are then stored in config.json
for subsequent API calls.
Quick Start & Requirements
go build -trimpath -o ./dist/weChatGPT -ldflags "-X 'main.wxToken=$(Token)' -w -s -buildid="
.cf-clearance
Python package (pip install --upgrade cf-clearance
)playwright install
)libatk1.0-0
, libcups2
, libpango-1.0-0
, libcairo2
).xvfb
for headless browser operations.cf_clearance
and session-token
via a provided Python script, then configuring config.json
. A reverse proxy (Nginx/Caddy) is needed for deployment.Highlighted Details
cf_clearance
and session-token
.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The project explicitly states it is "almost impossible to work normally" due to ChatGPT API response times frequently exceeding the 15-second limit imposed by WeChat Official Accounts. The author suggests a potential refactor once an official ChatGPT API is released. The cf_clearance
acquisition requires matching the User-Agent and IP address between acquisition and runtime.
2 years ago
1 day