Appwrite icon

Appwrite

Interact with Appwrite API

Actions181

Teams → Create Membership

AI-generated

Overview

This node operation creates a membership in a specified team within the Appwrite platform. It allows inviting a user to join a team either by their email or user ID, assigning specific roles to the user, and optionally providing a URL to redirect the user after they accept the invitation. This operation is useful for managing team memberships programmatically, such as adding new contributors or members to a project team.

Use Case Examples

  1. Inviting a new user to a team by email with the role of 'member'.
  2. Adding an existing user to a team by their user ID and assigning multiple roles like 'member' and 'contributor'.
  3. Sending an invitation with a custom redirect URL after acceptance.

Properties

Name Meaning
Team ID The unique identifier of the team where the membership will be created.
Email The email address of the user to invite to the team. If left empty, the User ID will be used instead.
User ID The unique identifier of the user to add to the team. If left empty, the Email will be used instead.
Roles A comma-separated list of roles assigned to the user within the team membership.
URL A URL to redirect the user to after they accept the team invitation.

Output

JSON

  • membershipId - The unique identifier of the created team membership.
  • teamId - The ID of the team to which the membership belongs.
  • userId - The ID of the user who was added to the team.
  • email - The email of the invited user, if used for invitation.
  • roles - The roles assigned to the user in the team membership.
  • invitationUrl - The URL provided for redirecting the user after accepting the invitation.

Dependencies

  • Appwrite API key credential for authentication

Troubleshooting

  • Ensure that either Email or User ID is provided; both cannot be empty.
  • Verify that the Team ID is correct and that the authenticated user has permission to add members to the team.
  • Check that the roles provided are valid and recognized by the Appwrite team management system.
  • If the invitation URL is provided, ensure it is a valid and reachable URL to avoid redirect issues.

Links

Discussion