API Integration Guide
See the end-to-end steps for generating a key, testing the endpoint, and integrating in your service.
If you want to connect subscribed WeChat messages to your own system, use this flow:
- Open "Profile menu > API Key management" or the standalone API Key page
- Create a new API key
- Test the API in the dashboard first
- Reuse the same key in your own service
Step 1: Create an API key
Enter a clear name in the API Key management page, for example:
- Operations dashboard sync
- Feishu bot
- Data warehouse incremental pull
The full key is shown only once when it is created, so copy and store it immediately.
Step 2: Test the endpoint in the dashboard
The unified API Key management page includes a built-in test flow:
- Paste the key you just created
- Click "Test API"
- Confirm that subscribed messages are returned
If this works in the dashboard, your auth and endpoint are already correct.
Step 3: Call the endpoint from your service
Endpoint:
GET https://api.fafafa.ai/api/v1/wechat/messages
The domain part comes from the system environment variable WORKER_PUBLIC_BASE_URL, and the full endpoint is assembled automatically from that base URL.
Authorization:
Authorization: Bearer YOUR_API_KEY
Example request:
curl 'https://api.fafafa.ai/api/v1/wechat/messages?page=1&pageSize=20' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Accept: application/json'
Recommended integration strategy
Initial sync
Use page and pageSize to paginate through historical messages and complete the initial import.
Incremental sync
Store the timestamp of your last successful sync and use since to fetch only newer messages.
curl 'https://api.fafafa.ai/api/v1/wechat/messages?since=2026-03-19T00:00:00.000Z&page=1&pageSize=20' \
-H 'Authorization: Bearer YOUR_API_KEY'
Idempotency
Deduplicate by article identifier or original URL before writing data into your own system.
Common integration tips
- If a key is exposed, delete it in the dashboard and create a new one
- Use different key names for staging and production so they are easier to audit
- The same key also works for the MD import API, so you do not need a second key
- If no messages are returned, verify that the web app already has active subscriptions
Actions that should stay in the web app
- Add subscriptions
- Cancel subscriptions
- Review quota and plans
- Create, delete, and rotate API keys
The API is best for consuming subscribed messages, while the web app remains the management console.