This is a serverless solution that retrieves RSS feeds for new items and sends them to a Google Chat webhook URL for notification.
The application follows an event-driven, serverless architecture. The components are decoupled, with Pub/Sub acting as the message bus between the different processing stages.
- Cloud Scheduler: Triggers the
check-feedsfunction at a regular interval. check-feedsCloud Function: An HTTP-triggered function that fetches all RSS feeds from Firestore, checks for new items, and publishes them to a Pub/Sub topic.chat-appCloud Function: This function has two primary roles:- Subscription Management: Provides a user interface within Google Chat for users to subscribe and unsubscribe from notifications for different products.
- Notification Delivery: Subscribes to the Pub/Sub topic where new items are published. It receives these items, translates them if necessary, and sends them as messages to the subscribed Google Chat spaces.
- Pub/Sub Topic: A single topic (
release-notes-topic) is used to decouple thecheck-feedsfunction from thechat-appfunction. - Firestore: Used to store a record of all processed RSS items to prevent duplicates, and to manage subscriptions.
The entire GCP infrastructure for this application is defined and managed using Terraform.
- Terraform CLI installed.
- Authenticated
gcloudCLI with access to your GCP project.
-
Initialize Terraform:
terraform init
-
Review the Plan: Before applying any changes, you can preview the planned operations. You will need to provide your GCP project ID.
terraform plan -var="project_id=your-gcp-project-id"Replace
your-gcp-project-idwith your actual GCP project ID. -
Apply the Configuration: Deploy the application using the
applycommand.terraform apply -var="project_id=your-gcp-project-id"Replace
your-gcp-project-idwith your actual GCP project ID. Confirm the deployment by typingyeswhen prompted.
This will deploy all the necessary Cloud Functions, Pub/Sub topics, Firestore instances, and Cloud Scheduler jobs.
