ZAppwrite icon

ZAppwrite

Use Appwrite's API from inside N8N, updated by @ZachHandley

Overview

The node integrates with the Appwrite API to manage user-related operations. Specifically, for the Users resource and the List User Sessions operation, it retrieves all active sessions associated with a specified user ID. This is useful in scenarios where you want to monitor or audit user activity, manage user sessions, or implement security measures such as session invalidation.

Practical example:
You have an application where users can log in from multiple devices. Using this node, you can list all sessions of a particular user to see from which devices or locations they are currently logged in. This helps in detecting suspicious activity or managing session lifecycles.

Properties

Name Meaning
User ID The unique identifier of the user whose sessions you want to list. This is a required string input.

Output

  • The output is a JSON array containing the list of user sessions retrieved from Appwrite for the specified user.
  • Each item in the array represents a session object with details about that session (e.g., session ID, creation time, expiration, device info). The exact structure depends on the Appwrite API response.
  • No binary data output is involved in this operation.

Dependencies

  • Requires an API key credential for Appwrite configured in n8n under the node's credentials.
  • Needs the Appwrite project URL and project ID as part of the credential configuration.
  • Uses the official Appwrite SDK (node-appwrite) internally to communicate with the Appwrite server.

Troubleshooting

  • Common issues:

    • Invalid or missing User ID parameter will cause the operation to fail.
    • Incorrect or expired API key credential may result in authentication errors.
    • Network connectivity issues between n8n and the Appwrite server can cause request failures.
    • If the user ID does not exist, the API may return an error or empty session list.
  • Error messages:

    • Authentication errors typically indicate problems with the API key or project configuration.
    • "Resource not found" errors may occur if the user ID is invalid or the user does not exist.
    • Timeout or network errors suggest connectivity problems; verify the Appwrite endpoint URL and network access.
  • Resolution tips:

    • Double-check the User ID input for correctness.
    • Verify the API key and project settings in the node credentials.
    • Ensure the Appwrite server is reachable from the n8n instance.
    • Use the continue-on-fail option to handle errors gracefully in workflows.

Links and References

Discussion