Integrating Google Apps Script for Photographers Project
Overview
In this section, we’ll walk through how Google Apps Script and a web form are used to schedule events and interact with Teamob CloudDB. The setup includes a web form for photographers to enter details, and the script securely sends the data to CloudDB using API calls.
1. Google Apps Script (code.gs)
The script handles form submission, encrypts the data, and makes API calls to CloudDB.
1. Web App Initialization
• Purpose: Serves the web form to the user.
• Output: Renders the form interface.
2. API Configuration and Encryption
2.1 Fetches API details (endpoint, URL, key) from script properties. 2.2 Encrypts the API request using HMAC SHA-256 for security.
3. Making the API Call
• Builds the API request, attaches headers, and sends the form data to CloudDB.
• Logs and handles the API response.
4. Handling Form Submission (POST Request)
• Listens for form submissions.
• Validates the data and sends it to the API.
2 Web Form (webapp.html)
The web form is styled to resemble Google Forms, making it user-friendly.
1. Form Structure
• Fields: Name, Number, Type, Package, Customize, Month, Shoot Date.
• Dynamic dropdowns for Type and Package.
• Amount auto-fills based on package selection.
2. Form Submission
• Collects form data, encodes it, and sends it to the Apps Script backend.
• Displays success or failure alerts based on API response.
Final Flow
1. User fills out the form.
2. The form data is sent to Google Apps Script.
3. Apps Script encrypts and sends the data to CloudDB via API.
4. CloudDB stores the data, and a success message is returned.