- Content in the gray box = Copy and paste directly into the WorkBuddy dialog boxinstructions for
- Start from step one in order, and proceed to the next step only after completing each one
- Steps 1 and 2 only need to be done once (environment setup); after that, each document generation only requires Step 4
- If you run into problems, see the FAQ at the bottom
Configure once, and after that each document generation only takes one sentence.
Step 1: Register on the Open Platform and get your Client ID and Client Secret
Just as a WeChat Official Account needs an AppID and AppSecret, Tencent Docs also requires a pair of keys to call the API.
1.1 Register as a developer
https://docs.qq.com/open/developers/
| Parameter name | Description | Purpose |
|---|---|---|
Client ID | Unique application identifier | Required for both authorization and API calls |
Client Secret | Application secret (keep confidential!) | Used when exchanging for an Access Token |
http://localhost:8080/callback(this is fine for local development).Step 2: Configure the Python environment
Copy the following message and send it to WorkBuddy, and it will help you set up the entire environment with one click:
Help me set up the Tencent Docs auto-generation environment: Client ID: enter your Client ID here Client Secret: enter your Client Secret here Callback URL: http://localhost:8080/callback Please help me: 1. Create a Python virtual environment and install dependencies (requests, flask, python-dotenv) 2. Create a config file .env to store the Client ID and Client Secret 3. Create an authorization script auth_server.py (start a local Flask service to complete OAuth authorization) 4. Create a document generation script tencent_docs.py (supports creating documents + writing content) 5. Test whether the configuration works properly
2.1 Complete OAuth authorization
On first use, you need to authorize manually once to obtain Access Token(valid for 30 days). After that, WorkBuddy will automatically refresh the Token, so no repeated action is needed.
Start the Tencent Docs OAuth authorization flow and obtain the Access Token.
2.2 Verify the environment
Test whether the Tencent Docs API connection works properly and verify whether the Access Token is valid.
Step 3: Customize document content and format
Tell WorkBuddy what you want to write, and it will generate the content and write it into Tencent Docs via API.
Option 1: Let AI write the full content
Help me write an article and automatically create it as a Tencent Doc: Topic: write the topic here (e.g., 2024 AI Industry Annual Summary) Style: professional and concise, suitable for internal reporting Word count: no less than 2000 words Structure requirements: - Opening summary - 3-5 chapters, each with a clear heading - Key data in bold - Closing summary and outlook Document title: write the document title here
Option 2: You already have content and only need to write it into Tencent Docs
Help me write the following content into a Tencent Doc: Document title: enter the title here Body: (paste your article content here) Formatting requirements: - Title in size 2, bold - Body in size 4 - Important content highlighted with a blue background - Keep spacing between paragraphs
Option 3: Import a Markdown file directly
Help me import the following Markdown file into a Tencent Doc: C:\Users\your username\Desktop\my article.md Document title: enter the title here
Step 4: One-click generation of Tencent Docs (most commonly used!)
Once the environment is set up, you only need to say this sentence each time:
Help me write an article and automatically create it as a Tencent Doc.
After successful execution, WorkBuddy will return the document link, like this:
# Example output of successful generation
✓ Document created successfully!
Document ID: DQWxxxxxxx
Link: https://docs.qq.com/doc/DQWxxxxxxx
✓ Wrote 2150 words across 5 chapters
✓ Formatting completed (bold headings, paragraph indentation, key content highlighted)
Where to view it after generation?
Open docs.qq.com, log in to the same account, and you will see the document just generated in "My Documents".
Step 5: Set up scheduled automatic document generation
Help me create a scheduled task that automatically writes an article and generates a Tencent Doc every day: Execution time: 9 AM every day Content topic: daily tech news roundup, different each time Article style: concise and professional, suitable for team weekly reports Output location: Tencent Docs (default directory)
Common Commands Quick Reference
| What you want to do | Copy this text |
|---|---|
| Write an article and generate Tencent Docs | Help me write an article about "xxx" and create it as a Tencent Doc. |
| Import Markdown into Tencent Docs | Import "xxx.md" as a Tencent Doc. |
| Batch generate multiple documents | Help me write 3 articles about "xxx" from different angles and create each as a Tencent Doc. |
| Update existing document content | Update the content of Tencent Doc xxx and change Chapter 2 to "xxx". |
| List my documents | List the 10 most recent documents in my Tencent Docs account. |
| Copy document | Make a copy of Tencent Doc xxx. |
| Test API connection | Test whether the Tencent Docs API connection works properly. |
| Refresh Token | Check and refresh the Tencent Docs Access Token. |
| Modify default format | Modify the Tencent Docs generation script to change the default font to "Microsoft YaHei" and the font size to 14px. |
| View scheduled tasks | Check which automation tasks are currently running. |
FAQ
❓ What to do if "invalid_client" error occurs?
The Client ID or Client Secret is incorrect. Check that you copied them completely and watch out for extra spaces. If you're sure they're correct, go to the open platform to reset the Client Secret and try again:
Update the Tencent Docs Client Secret: enter the new Secret here
❓ What to do if the Access Token expires?
The Access Token is valid for 30 days. WorkBuddy automatically refreshes it using the Refresh Token, so manual action is usually unnecessary. If it does expire:
Refresh the Tencent Docs Access Token.
❓ What to do if the user cancels authorization?
If the user cancels third-party authorization in Tencent Docs settings, re-authorization is required:
Re-run the Tencent Docs OAuth authorization flow.
❓ Document generated successfully but the content format is wrong?
The Tencent Docs v3 API uses JSON format to describe document structure (paragraphs, text, styles). If you find the format is wrong, you can ask WorkBuddy to adjust it:
Adjust the Tencent Docs generation format: - Change the title to "Size 1, bold, blue" - Change the body text to "Size 4, SimSun" - Indent the first line of paragraphs by 2 characters - Use a gray background for code blocks
❓ Is there a limit on the number of documents?
Tencent Docs Open API provides each app with 20,000 free API calls(starting July 2025), which is enough for daily use. Contact the official team if you need more capacity.
❓ How to generate to a specified folder?
Help me write an article about "xxx" and create it in the "Weekly Report" folder in Tencent Docs.
❓ Scheduled task didn't run?
- Check whether WorkBuddy is kept running
- Check whether the Access Token has expired (refresh it with the command above)
- Copy the following command to check the task status:
Check the status of the daily Tencent Docs generation scheduled task, and view the last execution time and next execution time.
| Configuration item | Description | Where to find it |
|---|---|---|
| Client ID | Unique application identifier | Open Platform → App Details |
| Client Secret | Application secret (keep confidential!) | Same as above, generated when creating the app |
| Callback URL | OAuth callback URL | http://localhost:8080/callback |
| Access Token | API call credential (30 days) | Automatically obtained after OAuth authorization |
| Refresh Token | Refresh credential (1 year) | Obtained together with the Access Token |
| API documentation | API reference | docs.qq.com/open/document/app |