Welcome to the step-by-step guide on how to use the Gmail Organization Invitation API Template. This template allows you to send personalized invitation emails to potential members of your organization. The email is sent through a Gmail account with 2FA enabled, and the API accepts various inputs to generate the invitation. Let's get started with how to set up and use this template effectively.
To begin using this template, click on the "Start with this Template" button. This will initialize the template within the Lazy platform, allowing you to customize it according to your needs.
Before you can send out invitations, you need to set up your Gmail account details as environment secrets. This is crucial for the API to access your Gmail account and send emails. Here's how to set them up:
Remember, these credentials are sensitive, and Lazy will keep them secure as environment secrets.
Once you have set up your environment secrets, you can test the functionality of your app. Click the "Test" button to begin the deployment of the app and launch the Lazy CLI. If the code requires any user input, you will be prompted to provide it through the Lazy CLI.
After testing, if your app uses an API, Lazy will provide you with a dedicated server link to use the API. Since this template uses FastAPI, you will also receive a link to the API documentation, which can be very helpful for understanding the available endpoints and how to interact with them.
To send an invitation using the API, you will make a POST request to the "/send_invitation" endpoint with the required information. Here's a sample request:
POST /send_invitation
Content-Type: application/json
{
"recipient_email": "john.doe@example.com",
"inviter_email": "jane.smith@yourcompany.com",
"organization_name": "Your Organization",
"invitation_link": "https://www.yourorganization.com/invite"
}
Upon a successful request, you will receive a confirmation in the Lazy CLI that the email has been sent. If there is an issue, you will receive an error message detailing what went wrong.
By following these steps, you can easily set up and use the Gmail Organization Invitation API Template to send out personalized invitations to join your organization. Remember to handle your Gmail credentials securely and enjoy the convenience of automating your invitation process.