Commit 975fafcb authored by BH18294's avatar BH18294

Added README.md

parent a9f0b83a
**Component Working: **
Configure Send Grid to create API key for the validation from Cloud function to Send Grid
Configure Sender email in Send Grid and validate it to use it in the Cloud Function
Create Pub/Sub Topic in GCP
Create Cloud Function and configure the trigger to Cloud Pub/Sub to get it triggered every time when a message publishes to previously created Pub/Sub topic.
Choose Runtime Python 3.10 in Cloud Function
Add SendGrid as a requirement package in the Cloud Function Code
Add Python Code in the main.py which contains the code to send email
Deploy the code in the cloud function
Now whenever the message is published on the topic from App Script the Cloud function will execute and as per the Environment (QA,DEV,PERF,PROD) email will be received by the relevant approver.
From the same email the approver can go to the Artifact approval form to get it approved.
# Component Working:
* Configure Send Grid to create API key for the validation from Cloud function to Send Grid
* Configure Sender email in Send Grid and validate it to use it in the Cloud Function
* Create Pub/Sub Topic in GCP
* Create Cloud Function and configure the trigger to Cloud Pub/Sub to get it triggered every time when a message - - - * Publishes to previously created Pub/Sub topic.
* Choose Runtime Python 3.10 in Cloud Function
* Add SendGrid as a requirement package in the Cloud Function Code
* Add Python Code in the main.py which contains the code to send email
* Deploy the code in the cloud function
* Now whenever the message is published on the topic from App Script the Cloud function will execute and as per the Environment (QA,DEV,PERF,PROD) email will be received by the relevant approver.
* From the same email the approver can go to the Artifact approval form to get it approved.
**Pre-Requisites: **
# Pre-Requisites:
Enable SendGrid Email API from Google Marketplace
- Enable SendGrid Email API from Google Marketplace
Service Account needs following permissions
- Service Account needs following permissions
* roles/pubsub.publisher
* roles/pubsub.subscriber
......@@ -32,48 +32,28 @@
* Select the permissions for the key. At a minimum, the key must have Mail send permissions to send email.
* Click Save to create the key.
* SendGrid generates a new key. This is the only copy of the key, so make sure that you copy the key and save it for later.
**Deployment steps: **
Create an API key:
Sign in to SendGrid and go to Settings > API Keys.
Create an API key.
Select the permissions for the key. At a minimum, the key must have Mail send permissions to send email.
Click Save to create the key.
SendGrid generates a new key. This is the only copy of the key, so make sure that you copy the key and save it for later.
- Setting up a Pub/Sub topic:
## Setting up a Pub/Sub topic:
Specify your Google Cloud project in an environment variable.
* Specify your Google Cloud project in an environment variable.
export PROJECT_ID=PROJECT_ID
* Specify your Google Cloud organization in an environment variable.
export ORG_ID=ORG_ID
* Set the project ID for gcloud commands.
gcloud config set project PROJECT_ID
* Create the Pub/Sub topic where notifications are published.
gcloud pubsub topics create trigger-email
* Specify the topic in an environment variable.
export TOPIC=projects/$PROJECT_ID/topics/trigger-email
export TOPIC=projects/$PROJECT_ID/topics/trigger-email
* Create the subscription that notifies Cloud Functions to send an email or chat message when messages are published to the topic.
gcloud pubsub subscriptions create gcf-trigger-email-asia-east2-trigger-email-sub --topic trigger-email
gcloud pubsub subscriptions create gcf-trigger-email-asia-east2-trigger-email-sub --topic trigger-email
## Create SendGrid Email API account
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment