OneBot-api icon

OneBot-api

Consume OneBot API

Overview

This node integrates with the OneBot API to perform various operations related to groups, friends, bots, messages, and members in a chat platform. Specifically for the "群组" (Group) resource and the "获取群信息" (Get Group Info) operation, it retrieves detailed information about a specified group by its name or ID.

Common scenarios where this node is beneficial include:

  • Automating group management tasks such as fetching group details for monitoring or reporting.
  • Integrating group data into workflows that require group metadata.
  • Building chatbots or automation tools that respond based on group information.

Practical example:

  • A workflow that triggers when a new message arrives and uses this node to fetch the group's info to decide how to respond or log the event.

Properties

Name Meaning
Group Name or ID Select a group from the dropdown list or specify a group ID using an expression. This identifies the target group for the operation.

Output

The node outputs JSON data containing the requested group information retrieved from the OneBot API. The structure typically includes fields describing the group's attributes such as group ID, group name, member count, role of the bot in the group, and other metadata provided by the API.

If the node supports binary data output (not explicitly shown for this operation), it would represent any media or files associated with the group info, but for "获取群信息" the output is purely JSON.

Dependencies

  • Requires an API key credential for authenticating with the OneBot API.
  • The node depends on the OneBot API being accessible and properly configured.
  • The node uses internal helper functions to load options dynamically (e.g., group list) and to make API requests.
  • No additional external services are required beyond the OneBot API.

Troubleshooting

  • Common issues:

    • Failure to retrieve group list or group info due to invalid or expired API credentials.
    • Network connectivity problems preventing access to the OneBot API.
    • Specifying an invalid or non-existent group ID may result in errors or empty responses.
  • Error messages:

    • Errors during execution will be caught and returned in the output JSON under an error field with a descriptive message.
    • If the node cannot load the group list for the dropdown, it may show an error like "Failed to get group list".
    • If the login info cannot be retrieved, errors such as "Failed to get login info" will appear.
  • Resolutions:

    • Verify that the API key credential is valid and has necessary permissions.
    • Ensure network connectivity to the OneBot API endpoint.
    • Confirm the group ID or name exists and is accessible by the bot.

Links and References

  • n8n Expressions Documentation
  • OneBot API official documentation (refer to your OneBot API provider for exact URL)
  • n8n documentation on creating custom nodes and using credentials

Discussion