OneBot icon

OneBot

Consume OneBot API

Overview

This node integrates with the OneBot API to send and manage messages, among other bot-related operations. Specifically, for the Send Private Message operation under the Message resource, it allows sending text messages directly to a specified user by their username or ID.

Common scenarios where this node is useful include:

  • Automating direct communication with users in chatbots.
  • Sending notifications or alerts privately to individual users.
  • Forwarding multiple messages as a single forwarded message bundle.

For example, you can configure the node to send a personalized greeting to a user when they join a group or trigger an event.

Properties

Name Meaning
User Name or ID Select a user from a dynamically loaded friend list or specify a user ID via expression to send the message to.
Message The text content of the private message to be sent.
Forward Mode Boolean option to enable forwarding mode: if enabled and multiple input items exist, messages are sent as a forwarded message bundle instead of individually.

Output

The node outputs JSON data representing the response from the OneBot API after sending the message(s). The structure typically includes confirmation details such as message IDs, status, or error information returned by the API.

If multiple messages are forwarded (when Forward Mode is enabled), the output corresponds to the result of the forwarded message request.

No binary data output is produced by this operation.

Dependencies

  • Requires connection to a OneBot API endpoint.
  • Needs an API authentication credential configured in n8n to authorize requests.
  • Utilizes internal helper functions to load friend lists dynamically for user selection.

Troubleshooting

  • Issue: No message sent or empty response.

    • Cause: Incorrect or missing user ID; ensure the user exists in the friend list or provide a valid ID.
    • Resolution: Verify the user ID or use the dynamic friend list selector.
  • Issue: Error when forwarding messages.

    • Cause: Forward Mode enabled but input data format incorrect or API does not support forwarding for given operation.
    • Resolution: Disable Forward Mode or ensure input items are correctly structured.
  • Issue: Authentication errors.

    • Cause: Missing or invalid API credentials.
    • Resolution: Check that the API key or token is properly set up in n8n credentials.
  • Error Messages: Typically reflect API response errors such as "user not found" or "permission denied." Review API documentation and ensure correct parameters.

Links and References

Discussion