Academy → Messaging ChannelsOfficial documentation · Arabic guidance

QQ Bot

بوت QQ

Intermediate3 min readLesson 344 questions✓ 2026-08-18
Before you read

What this page is, and what it holds.

This page covers QQ Bot. You will use hermes gateway setup here; about 3 minutes to read. Open the channel to yourself first with an allowlist. An open channel means anyone can message your agent.

7sections
4code examples
1tables
1commands
538source words
What you will be able to do

Outcomes taken from this page, not a template.

  • Understand what بوابة المراسلة is and when you need it.
  • Run hermes gateway setup and understand what happens next.
  • Read the table and take only the row that applies to you.
  • Set QQBOT_HOME_CHANNEL in the right place.
Identifiers you will meet

Exactly as they appear in Hermes.

Commands
  • hermes gateway setup
Environment variables
  • QQBOT_HOME_CHANNEL
Page map

Jump to the part you need.

  1. 01Overview
  2. 02Prerequisites
  3. 03Configuration
  4. 04Environment Variables
  5. 05Advanced Configuration
  6. 06Voice Messages (STT)
  7. 07Troubleshooting
The full official page

Nothing summarised away.

The documentation body below is reproduced from the official source so commands and identifiers stay exact. Each section carries a short note describing what it contains.

Connect Hermes to QQ via the Official QQ Bot API (v2) — supporting private (C2C), group @-mentions, guild, and direct messages with voice transcription.

Overview

Explains the idea itself. Read it slowly; the later sections build on it.

The QQ Bot adapter uses the Official QQ Bot API ↗ to:

  • Receive messages via a persistent WebSocket connection to the QQ Gateway
  • Send text and markdown replies via the REST API
  • Download and process images, voice messages, and file attachments
  • Transcribe voice messages using Tencent's built-in ASR or a configurable STT provider

Prerequisites

Explains the idea itself. Read it slowly; the later sections build on it.

  1. QQ Bot Application — Register at q.qq.com ↗:
  2. Create a new application and note your App ID and App Secret
  3. Enable the required intents: C2C messages, Group @-messages, Guild messages
  4. Configure your bot in sandbox mode for testing, or publish for production
  1. Dependencies — The adapter requires aiohttp and httpx:
Shell1 line
   pip install aiohttp httpx

Configuration

Commands you type in a terminal. Understand what one does before copying it. Commands here: hermes gateway setup.

Interactive setup

Shell1 line
hermes gateway setup

Select QQ Bot from the platform list and follow the prompts.

Manual configuration

Set the required environment variables in ~/.hermes/.env:

Shell2 lines
QQ_APP_ID=your-app-id
QQ_CLIENT_SECRET=your-app-secret

Environment Variables

A lookup table. Do not read it all; find the row that applies to you.

VariableDescriptionDefault
QQ_APP_IDQQ Bot App ID (required)—
QQ_CLIENT_SECRETQQ Bot App Secret (required)—
QQBOT_HOME_CHANNELOpenID for cron/notification delivery—
QQBOT_HOME_CHANNEL_NAMEDisplay name for home channelHome
QQ_ALLOWED_USERSComma-separated user OpenIDs for DM accessopen (all users)
QQ_GROUP_ALLOWED_USERSComma-separated group OpenIDs for group access—
QQ_ALLOW_ALL_USERSSet to true to allow all DMsfalse
QQ_PORTAL_HOSTOverride the QQ portal host (set to sandbox.q.qq.com for sandbox routing)q.qq.com
QQ_STT_API_KEYAPI key for voice-to-text provider—
QQ_STT_BASE_URL(Not read directly — set platforms.qqbot.extra.stt.baseUrl in config.yaml instead)n/a
QQ_STT_MODELSTT model nameglm-asr

Advanced Configuration

Settings you configure once. Change one at a time so you can see what each does.

For fine-grained control, add platform settings to ~/.hermes/config.yaml:

YAML18 lines
platforms:
  qqbot:
    enabled: true
    extra:
      app_id: "your-app-id"
      client_secret: "your-secret"
      markdown_support: true       # enable QQ markdown (msg_type 2). Config-only; no env-var equivalent.
      dm_policy: "open"          # open | allowlist | disabled
      allow_from:
        - "user_openid_1"
      group_policy: "open"       # open | allowlist | disabled
      group_allow_from:
        - "group_openid_1"
      stt:
        provider: "zai"          # zai (GLM-ASR), openai (Whisper), etc.
        baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4"
        apiKey: "your-stt-key"
        model: "glm-asr"

Voice Messages (STT)

Explains the idea itself. Read it slowly; the later sections build on it.

Voice transcription works in two stages:

  1. QQ built-in ASR (free, always tried first) — QQ provides asr_refer_text in voice message attachments, which uses Tencent's own speech recognition
  2. Configured STT provider (fallback) — If QQ's ASR doesn't return text, the adapter calls an OpenAI-compatible STT API:
  • Zhipu/GLM (zai): Default provider, uses glm-asr model
  • OpenAI Whisper: Set QQ_STT_BASE_URL and QQ_STT_MODEL
  • Any OpenAI-compatible STT endpoint

Troubleshooting

A troubleshooting section. Find the symptom that matches yours rather than reading it end to end.

Bot disconnects immediately (quick disconnect)

This usually means:

  • Invalid App ID / Secret — Double-check your credentials at q.qq.com
  • Missing permissions — Ensure the bot has the required intents enabled
  • Sandbox-only bot — If the bot is in sandbox mode, it can only receive messages from QQ's sandbox test channel

Voice messages not transcribed

  1. Check if QQ's built-in asr_refer_text is present in the attachment data
  2. If using a custom STT provider, verify QQ_STT_API_KEY is set correctly
  3. Check gateway logs for STT error messages

Messages not delivered

  • Verify the bot's intents are enabled at q.qq.com
  • Check QQ_ALLOWED_USERS if DM access is restricted
  • For group messages, ensure the bot is @mentioned (group policy may require allowlisting)
  • Check QQBOT_HOME_CHANNEL for cron/notification delivery

Connection errors

  • Ensure aiohttp and httpx are installed: pip install aiohttp httpx
  • Check network connectivity to api.sgroup.qq.com and the WebSocket gateway
  • Review gateway logs for detailed error messages and reconnect behavior
Knowledge check

4 questions answered by this page alone.

Every option is a real identifier from the Hermes documentation. The wrong ones are real too, just from other pages.

1. In this lesson's table, what is the “Description” for “QQSTTBASEURL”?
2. Which of these environment variables actually appears in this lesson?
3. Which of these headings does not appear in this lesson?
4. Which configuration key appears in this lesson's examples?