OneBot-api icon

OneBot-api

Consume OneBot API

Overview

This node integrates with the OneBot API to manage various aspects of a bot, including members, friends, groups, messages, and miscellaneous operations. Specifically for the "成员关系" (Member Relationship) resource and the "删除好友" (Delete Friend) operation, it allows users to delete a friend from their friend list by specifying the friend's user name or ID.

Common scenarios where this node is beneficial include:

  • Automating friend management tasks such as removing unwanted contacts.
  • Integrating friend deletion into larger workflows that manage social interactions.
  • Maintaining an updated friend list by programmatically deleting friends based on certain criteria.

Practical example:

  • A workflow that periodically checks for inactive friends and deletes them automatically using this node's delete friend operation.

Properties

Name Meaning
User Name or ID Select a friend from the dynamically loaded friend list or specify a friend ID via expression. This identifies which friend to delete.

Output

The node outputs JSON data representing the result of the executed operation. For the "删除好友" (Delete Friend) operation, the output typically includes success status and any error messages if the deletion fails.

The structure of the json output field generally contains:

  • success: Boolean indicating whether the friend was successfully deleted.
  • error: If applicable, a string describing the error encountered during the operation.

No binary data output is involved in this operation.

Dependencies

  • Requires connection to a OneBot API endpoint.
  • Needs an API authentication credential configured in n8n to authorize requests.
  • The node uses dynamic loading methods to fetch friend lists (getFriendList) for property options.

Troubleshooting

  • Common issues:

    • Failure to delete a friend due to invalid or missing user ID.
    • API request failures caused by incorrect or expired credentials.
    • Network connectivity problems preventing communication with the OneBot API.
  • Error messages and resolutions:

    • "Failed to get login info": Indicates inability to retrieve bot login information; check API credentials and connectivity.
    • "Failed to get friend list": Occurs if the friend list cannot be fetched; verify API permissions and ensure the bot has access to friend data.
    • Errors during execution will appear in the output JSON under the error field; review these messages to identify specific issues.

Ensure that the user ID specified exists in the friend list and that the API key used has sufficient permissions to perform friend deletions.

Links and References

Discussion