Actions13
Overview
This node integrates with the OneBot API to manage and interact with group chats on a messaging platform. Specifically, the "获取群列表" (Get Group List) operation retrieves a list of groups that the bot is aware of or has access to. This is useful for scenarios where you want to display available groups, select a group for further operations (like sending messages or managing members), or automate workflows based on group membership.
Practical examples:
- Automatically fetching all groups the bot belongs to in order to send announcements.
- Listing groups for user selection in a workflow before performing group-specific actions.
- Monitoring group lists to trigger events when new groups are added.
Properties
| Name | Meaning |
|---|---|
| Group Name or ID | Select a group by its name or ID. The list is dynamically loaded from the current groups accessible to the bot. Required for operations involving specific groups such as getting group info or sending group messages. |
Output
The output is a JSON array representing the response from the OneBot API for the requested operation. For the "获取群列表" operation, this typically includes an array of group objects, each containing details like group ID, group name, and possibly the role of the bot within the group (e.g., owner, admin).
Example structure of one item in the output JSON array might be:
{
"group_id": 123456,
"group_name": "Example Group",
"role": "owner"
}
If the node encounters errors during execution, it outputs an object with an error field describing the issue and a success flag set to false.
Dependencies
- Requires an API key credential for authenticating with the OneBot API.
- The node depends on the OneBot API being accessible and the bot having appropriate permissions to retrieve group information.
- No additional external services are required beyond the OneBot API.
Troubleshooting
Common issues:
- Missing or invalid API credentials will prevent the node from connecting to the OneBot API.
- If the bot is not part of any groups or lacks permission to view groups, the returned list may be empty.
- Network connectivity problems can cause request failures.
Error messages:
"执行操作 get_group_list 时出错: <message>"indicates failure during the group list retrieval. Check API credentials and network connection.- Errors about missing or invalid
group_idindicate that the required group identifier was not provided or could not be resolved. - Permission-related errors occur if the bot does not have sufficient rights to perform certain group operations.
Resolution tips:
- Verify that the API key credential is correctly configured and valid.
- Ensure the bot account is a member of groups you expect to manage.
- Confirm network access to the OneBot API endpoint.
- For permission errors, check the bot's role in the group (owner/admin) and adjust accordingly.
Links and References
- OneBot API Documentation (general reference for API endpoints and parameters)
- n8n documentation on creating custom nodes for further customization guidance