OneBot icon

OneBot

Consume OneBot API

Overview

This node integrates with the OneBot API to perform various operations related to bots, friends, groups, messages, and miscellaneous functions. Specifically for the resource "好友" (Friend) and operation "获取陌生人信息" (Get Stranger Info), it retrieves information about a stranger user by their username or QQ ID. This is useful when you want to fetch details about users who are not in your friend list but whose information is accessible via the bot.

Common scenarios include:

  • Looking up profile information of unknown users before interacting.
  • Verifying user details for moderation or logging purposes.
  • Enriching data workflows that involve user identification.

Example: You can input a QQ number or nickname to get detailed info about that stranger user, such as their nickname, gender, age, or other metadata provided by the OneBot API.

Properties

Name Meaning
User Name or ID Select a friend by entering a nickname or QQ number to search, or directly input a QQ number.

The "User Name or ID" property supports selecting from a dynamically loaded friend list or manual input, and is required for operations like sending private messages, getting stranger info, or sending likes.

Output

The node outputs JSON data representing the response from the OneBot API for the requested operation. For "获取陌生人信息" (Get Stranger Info), the output JSON contains the stranger's user information fields as returned by the API, such as user ID, nickname, and other profile details.

If an error occurs during execution, the output JSON will contain an error field with the error message and a success flag set to false.

No binary data output is involved in this operation.

Dependencies

  • Requires connection to a OneBot-compatible API endpoint.
  • Needs an API key credential configured in n8n for authentication.
  • The node uses internal helper methods to call the OneBot API endpoints such as get_stranger_info.
  • Dynamic loading of friend lists depends on successful API calls to retrieve current friends.

Troubleshooting

  • Missing or invalid user ID: If the "User Name or ID" is not provided or invalid, the node may throw errors or fail to retrieve data.
  • API request failures: Network issues or incorrect API credentials can cause request failures. Check the API key and endpoint configuration.
  • Permission errors: Some group-related operations require the bot to have admin or owner permissions; otherwise, errors will be thrown.
  • Error messages: Errors during execution are logged and returned in the output JSON under the error field. Common messages include missing parameters or permission denials.
  • To resolve errors, verify all required inputs, ensure valid credentials, and confirm the bot has necessary permissions.

Links and References

Discussion