Skip to main content

Invitation

These APIs handle user invitations and sign-ups for the platform. It includes functionality for creating and sending email invitations using Nodemailer, hashing passwords with node-forge, and also processes invitation acceptance, verifying details, and inserting new users and their wallets into the database.

Invite Team Member

1. Create Invitation

POST /create-invitation

Description

Creates an invitation for a new member to join a workspace. The invitation is sent via email and allows the member to join the workspace

Request Body

{
"email": "string",
"password": "string",
"area": "string",
"status": "string",
"encrypted_wallet": "string",
"wallet_address": "string",
"company_id": "string",
"operator_id": "string",
"index": "number"
}

Response

StatusDescription
200 OKInvitation sent successfully
400 Bad RequestMissing required fields or invalid data.
403 ForbiddenMember limit exceeded; cannot create more invitations.
500 Internal Server ErrorFailed to create the invitation due to internal errors.

Response Object

{
"message": "Invitation sent successfully"
}

2. Accept Invitation

POST /accept-invitation

Description

Handles the acceptance of an invitation. The invitation is verified, and if valid, the user, wallet, and workspace membership are created.

Parameter Required

  • invitationId: string - The ID of the invitation to accept.

Example Request

{
"invitationId": "invitationId123"
}

Response

StatusDescription
200 OKInvitation accepted successfully, and the user is added to the workspace.
400 Bad RequestThe invitation is invalid or has expired.
500 Internal Server ErrorFailed to accept the invitation due to internal errors.

Example Response

{
"message": "Invitation accepted successfully"
}