OneBot icon

OneBot

Consume OneBot API

Overview

This node integrates with the OneBot API to manage group-related operations on a messaging platform. Specifically, for the "设置群名称" (Set Group Name) operation under the "群组" (Group) resource, it allows users who have administrative or ownership permissions in a group to change the group's name.

Common scenarios where this node is beneficial include:

  • Automating group management tasks such as renaming groups based on events or campaigns.
  • Enabling chatbots or automation workflows to update group names dynamically.
  • Managing multiple groups efficiently by programmatically setting group names without manual intervention.

For example, an administrator could use this node to rename a group to reflect a new project phase or event theme automatically.

Properties

Name Meaning
Group Name or ID Select a group you have management rights for (either as owner or admin).
New Group Name The new name to set for the selected group.

Output

The node outputs JSON data representing the response from the OneBot API after attempting to set the group name. This typically includes success status and any relevant messages or error details returned by the API.

If the operation fails, the output JSON will contain an error field describing the issue and a success field set to false.

No binary data output is involved in this operation.

Dependencies

  • Requires an active connection to the OneBot API via an API key credential configured in n8n.
  • The node depends on the OneBot API endpoints such as get_login_info, get_group_list, and get_group_member_info to verify permissions before performing the rename operation.
  • Proper permissions are required: the bot must be either a group owner or an administrator of the target group to successfully set the group name.

Troubleshooting

  • Permission Errors:
    If the bot is not an administrator or owner of the group, the node will throw an error indicating insufficient permissions. Ensure the bot account has the necessary role in the group.

  • Invalid Group ID:
    If the provided group ID is invalid or missing, the node will raise an error stating that a valid group ID is required.

  • API Request Failures:
    Network issues or incorrect API credentials can cause request failures. Verify the API key and network connectivity.

  • Error Messages:

    • "无法执行操作: 设置群名称 需要管理员权限,当前机器人不是该群的管理员或群主"
      Means the bot lacks admin or owner rights in the group; assign appropriate permissions.
    • "操作需要有效的群ID,但未提供"
      Indicates the group ID parameter was not supplied; provide a valid group ID.

Links and References

Discussion