Skip to main content
Proactive push does not depend on the reply target of Sender. You need to specify the target IM, group, or user. For group push, pass groupCode; for private push, pass userID.

Function overview

push(imType, groupCode, userID, title, content, options?, timeout?)

string
required
Target IM type, such as qq, weixin, or qx, depending on enabled adapters.
string
required
Group ID / group number. Required for group push; pass an empty string for private chat.
string
required
User ID. Required for private push; group push can pass an empty string.
string
required
Push title or note. In text push, if content is empty, title is used as the text.
string
required
Text content. The runtime also supports text / message fields, but the helper always sends content.
object
Optional extension fields. middleware.js shallow-merges this object into the top-level request body.
string
Target account ID. You can also write accountID or accountId. Explicit values have the highest priority.
number
default:"5000"
Request timeout in milliseconds.

Push account selection

These rules apply to push(...), pushImage(...), pushVoice(...), pushVideo(...), pushFile(...), and pushMixed(...). Selection rules:
  1. If options contains account_id, use it.
  2. If this is a message trigger and the target IM is the same as the current chat IM, use the current chat account by default.
  3. If this is cron / fake, use the target IM default account.
  4. For cross-IM push, use the target IM default account.
  5. If the target IM has no default account, the runtime selects the first online account that can send. If there is no available sending account, it returns 0 or throws an adapter-offline error.
When you know which sending account to use, pass options.account_id explicitly. This is more stable than depending on the current chat account or target IM default account.

Media push

Media push helpers also support options and timeout. Use options.account_id / accountID / accountId to choose the sending account explicitly. Use filename / fileName / file_name and mimeType / mime_type to add media metadata.

Return value

Proactive push functions return a number: the count of targets that the runtime considers successfully sent.
  • 1: usually means the message was submitted to one target.
  • 0: usually means no available adapter, invalid target, or not sent.
  • Adapter request failures may throw Error.

Mixed items

pushMixed(...) items are the same as replyMixed(...): they support text, markdown, image, voice, video, and file.

Next steps

Runtime context

See differences between message, cron, route, and cross-IM contexts.

Media files

See media sources, downloads, and user-uploaded file handling.
Last modified on June 3, 2026