Welcome to this wonderful repository dedicated to creating cloud functions in Google Cloud Platform (GCP). This repository contains several cloud functions designed to perform various tasks efficiently. Below is a brief overview of the cloud functions available in this repository:
This cloud function is responsible for sending verification emails to users who sign up for your service. It utilizes Mailgun for sending emails and generates unique verification codes for each user.
- Sends a verification email to the user's provided email address.
- Generates a unique verification code for each user.
- Tracks information about the sent verification email in the database.
- Triggers: Pub/Sub message containing user data.
- Input: User data including first name, username, hostname, and verification API.
- Output: Sends a verification email to the provided email address.
This function generates a unique verification code for a given username. It utilizes cryptographic methods to ensure the security of the generated code.
username: The username of the user for whom to generate the code.
- A unique verification code for the given username.
This function tracks information about the sent verification email. It inserts the verification data into the database for further tracking.
verification_link: The verification link sent to the user.username: The username of the user.
This is the main cloud function responsible for sending verification emails to users. It decodes the Pub/Sub message, extracts necessary data, generates a verification code, constructs the email content, and sends the email using Mailgun.
event: Pub/Sub message containing user data.context: Information about the event context.
To deploy and use these cloud functions in your GCP environment, follow these steps:
- Ensure you have set up a GCP project and have necessary permissions.
- Set up Mailgun account and obtain API key and domain.
- Set up a Cloud SQL instance and configure the necessary environment variables for database connection.
- Deploy the cloud functions using the GCP Cloud Functions console or using the gcloud CLI.
- Trigger the
send_verification_emailfunction with Pub/Sub messages containing user data.
Feel free to explore and customize these cloud functions according to your requirements. If you have any questions or need assistance, please don't hesitate to reach out.
Happy coding! 🚀