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 topush(...), pushImage(...), pushVoice(...), pushVideo(...), pushFile(...), and pushMixed(...).
Selection rules:
- If
optionscontainsaccount_id, use it. - 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.
- If this is cron / fake, use the target IM default account.
- For cross-IM push, use the target IM default account.
- 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
0or throws an adapter-offline error.
Media push
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.