WeChatAPI Labs

WeCom webhook bot: how to send group messages

From adding a bot to sending text, Markdown, images and files, with Python and cURL examples, alerting integrations and rate limits.

Updated: 2026-11-26

Short answer: A WeCom webhook bot is a "group bot" you add to a WeCom group to get a webhook URL. POST JSON to it and the message appears in the group. It can send, but not receive.

Add a group bot and get the WeCom webhook URL

  1. Open the target group in WeCom on desktop or mobile and go to group settings.
  2. Choose "Group bot" (群机器人), add a new bot and name it.
  3. Copy the webhook URL: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=KEY. The key works like a password, so keep it out of public repos.

Send a text message

Put user IDs in mentioned_list or phone numbers in mentioned_mobile_list; "@all" mentions everyone.

curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"msgtype": "text", "text": {"content": "Production CPU above 90%", "mentioned_mobile_list": ["@all"]}}'
import requests

WEBHOOK = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY"

def send_text(content, mobiles=None):
    r = requests.post(WEBHOOK, json={
        "msgtype": "text",
        "text": {"content": content, "mentioned_mobile_list": mobiles or []},
    }, timeout=5)
    data = r.json()
    if data.get("errcode") != 0:
        raise RuntimeError(data)

send_text("Deployed v1.4.2")

Send Markdown

Markdown messages support headings, bold, links, quotes and three font colors (info green, comment grey, warning orange-red), which suits alert cards.

{
  "msgtype": "markdown",
  "markdown": {
    "content": "### Alert: order service\n> Status: <font color=\"warning\">degraded</font>\n> Error rate: 12%\n[Open dashboard](https://grafana.example.com)"
  }
}

Images, news cards and files

  • Image: msgtype: "image" with the Base64 data and MD5; up to 2 MB, JPG or PNG.
  • News: msgtype: "news"; each item in articles has a title, description, URL and image URL.
  • File: upload via /cgi-bin/webhook/upload_media?key=KEY&type=file, then send the returned media_id with msgtype: "file".

Alerting and CI integrations

  • Prometheus Alertmanager: its webhook format differs from WeCom's, so put a small relay in between that converts alerts to Markdown messages.
  • GitHub Actions / Jenkins: add a final step that calls the webhook with curl, keeping the key in repository secrets or the credential store.

WeCom webhook limits and common errors

  • Each bot can send at most 20 messages per minute; beyond that you get 45009 (rate limit exceeded). Batch alerts when volume is high.
  • A non-zero errcode comes with an errmsg. If the key is wrong or the bot was removed, the URL stops working and the bot must be re-added.
  • Group bots can't receive messages: when someone @mentions the bot, your server isn't notified, and the bot can't hold conversations in external groups with customers.
Need to receive customer messages and auto-reply in external groups? That's beyond the official group bot. See WeCom API: external groups and customer management.

FAQ

Can a WeCom group bot receive messages?

No. Webhook group bots can only push messages; they don't receive messages from group members.

How many messages can a group bot send per minute?

Up to 20 per bot per minute; beyond that the API returns 45009.

Can I add a group bot to an external group?

Official group bots are meant for pushing to internal groups. Two-way conversations in external groups with customers need a third-party external group API.

Official APIs can't do what you need? See the personal WeChat and WeCom API.

Related: WeChat API overview: Official Accounts, Mini Programs, Pay, Open Platform and WeCom · Is there a personal WeChat API? Limits and options