Actions2
- 消息相关 (Message) Actions
Overview
This node integrates with the NapCat QQ Bot API to send private messages to specific users. It supports sending text or image messages directly to a target user by their user ID. This functionality is useful for automating personal communications, such as sending notifications, alerts, or personalized content via QQ private chat.
Practical examples include:
- Sending a text alert to a user when a certain event occurs.
- Delivering an image (e.g., a chart or photo) privately to a user.
- Automating customer support responses through private messaging.
Properties
| Name | Meaning |
|---|---|
| User ID | The target user's unique identifier to whom the private message will be sent. |
| Message Type | The type of message to send. Options: Text, Image. |
| Message Content | The textual content of the message (used only if Message Type is Text). |
| Image URL | The URL or base64 data of the image to send (used only if Message Type is Image). |
Output
The node outputs a JSON object containing the response from the NapCat API after attempting to send the private message. This typically includes status information about the message delivery.
If an error occurs and "Continue On Fail" is enabled, the output JSON will contain an error field with the error message.
No binary data output is produced by this operation.
Dependencies
- Requires an API key credential configured in n8n to authenticate requests to the NapCat QQ Bot API.
- The node sends HTTP POST requests to the NapCat API endpoints, so network access to the API server is necessary.
- The base URL for the API is taken from the configured credentials.
Troubleshooting
- Invalid User ID: If the provided user ID does not exist or is incorrect, the API may return an error indicating the user was not found. Verify the user ID is correct.
- Authentication Errors: Ensure that the API key credential is valid and has the necessary permissions.
- Message Content Missing: When sending a text message, ensure the "Message Content" property is not empty.
- Image URL Issues: For image messages, verify that the "Image URL" is accessible and correctly formatted (URL or base64).
- API Rate Limits: Frequent message sending might hit rate limits imposed by the API; consider adding delays or handling rate limit errors gracefully.
Common error messages are returned from the API and surfaced in the node's output under the error field if "Continue On Fail" is enabled.
Links and References
- NapCat QQ Bot API Documentation (official API docs, in Chinese)
- n8n documentation on HTTP Request Authentication (for setting up API credentials)