What is This About?
Build an AI assistant using low-code method that provides a voice note summary on standardized measurable KPI's on a regular basis (daily, weekly, etc.), so that the "boss" can listen to them on the go. This AI can also highlight any anomalies and problems that occurred.
This is ideal for workplace productivity scenarios where KPIs are updated repeatedly, such as:
Sales & cost numbers for sales and marketing related enterprises.
Production numbers for manufacturing and production facilities.
Daily incident reporting, such as for construction sites.
Conceptual Description
Who Can Benefit From This and Who Are The Involved Parties?
Business owners / managers / team leaders.
There are 2 parties involved in this workflow:
The above who will automatically receive the updates.
Staff who will key in the data.
The Scenario:
In this simple example, the scenario is: A director of a small manufacturing facility producing a specific engineering product would like to keep tab on the following daily KPIs:
Production quantity (kg)
Sales amount (USD)
Any incidences related to OSHA
General remarks
The generative AI "moment" occurs when the data from the above KPI parameters are submitted to Google Gemini to come up with a standard text summary and also perform a simple productivity performance analysis based on target numbers. Apart from that, this is technically a standard automation workflow triggering preset actions such as sending reminder emails, etc.
The Gemini part can be as simple or as complicated as it can be - the analysis can also initiate further workflows if needed, such as prepare a preliminary report and mail to OSHA team if there was any OSHA incident, or even initiate a meeting if there are any matters that require higher level decision making. However, that's for another day.
Workflow Summary
Data Input: Staff will manually input Key Performance Indicator (KPI) data into a designated Google Sheet on a daily basis.
Scheduled Check (Apps Script): Every day, an Apps Script (acting as the "Secretary Agent") will automatically run at a set time.
Data Validation & Reminder: The script will check if today's KPI data has been entered for specific items. If not, it sends an email reminder to the responsible staff.
KPI Status Update: The script will update a status column in the Sheet (e.g., "Data Submitted," "Data Missing," "Summary Sent").
AI Summary Generation: If data is present (or for all submitted data), the script will take relevant KPI information, send it to a Google AI model via API (in this case Gemini 1.5 Flash is sufficient) with a simple instruction on what to do with the information, and receive a Gemini generated text summary as the output.
AI Voice Note Creation: The text summary will then be sent to the Google Cloud Text-to-Speech API, which will generate an audio voice note (MP3 file).
Final Report Email: The script will send an email to the manager containing the text summary and the AI voice note as an attachment.
Tools Used:
Google Sheets
Gmail
Google Apps Script
Google Cloud Services: Generative Language API & Cloud Text-to-Speech API.
Implementation Steps - Conceptual
Phase 1: Setting Up the Foundations
Prepare Google Sheets: Set up the columns to keep track of the KPIs, each row entry shall represent a new day/entry. The script will look for a new entry that matches today's date. Allow all necessary permissions for the individual (s) who will update the data routinely.
Set Up Google Cloud Project for APIs:
Create a new Google Cloud Project & enable billing.
Go to APIs & Services > Library, enable Generative Language API & Cloud Text-to-Speech API.
Go to APIs & Services > Credentials to Create an API key. Restrict the API key to only the above 2 functions if necessary.
Phase 2: Creating the Apps Script Functions
In order to implement a similar workflow, the following conceptual description can be used as a reference for the workflow logic and functions.
Main Function 1: Checks for today's KPI and sends reminder. This runs daily around 4 PM to check if the KPI data for the current day has been entered into the spreadsheet. If the entire row for today is missing or incomplete data, it sends an email notification asking the staff to create the entry.
Helper Function 1a: Finds today's data & column.
Helper Function 2a: Sends reminder email.
Main Function 2: Gathers the data & creates the voice note. This runs daily at 6pm, and it is configured to run independently from Main Function 1.
Helper Function 2a: Finds today's data
Helper Function 2b: Sends the raw data to Gemini to generate summary/analysis via Generative Language API. Gemini prompting happens here on what to do with the raw data. Then, the data is collected to be sent to Cloud Text-to-Speech API to generate the voice summary.
Helper Function 2c: Sends email to boss.
Phase 3: Test & Set Trigger
Save the project by clicking on the "Save Project" icon in the toolbar.
To test the main functions, select them individually via the toolbar dropdown option beside the "Debug" button.
Then, click the "Run" button to initiate the test run them manually.
The first time you run it, Google will ask for permission for authorization. Click "Review Permission", review and then click "Allow".
Try with test data.
Check the logs for any issues. Common issues: Incorrect Spreadsheet ID/Name, incorrect API key, API not enables, or typos in the column indices.
To set up the daily trigger: In the Apps Script editor, go to Triggers > "+ Add Trigger" button. Select the Main Function 1 to run at a earlier time, i.e. 4pm. Select the Main Function 2 to run at a later time, i.e. 6pm. Click "Save".
Implementation Steps - Detailed (Udemy course)
If you are planning to implement this for your business, but not familiar with the fundamentals and with no coding experience, this is for you. Course includes the following:
Introduction to the concepts, especially on Apps Script and Google Cloud Platform.
Step by step video guide (7 lectures, 2hr 16 min in total) to set up the fundamentals, configure the settings and run the function.
Apps Script code (JavaScript) is provided, which can be copied and pasted to run a similar functions with minimal configuration.
Prompting guide to create variations in the use case, by using this code as the base.
Description on how the entire code was generated via prompting with Gemini, so that you can develop other use cases for yourself too.
I created this function with zero coding language, this course is a great demonstration on how you can build custom solutions using Apps Script for any of your use case by leveraging the power of Gemini AI's coding expertise.
#vibe_coding, #prompt_engineering, #low_code_tools, #citizen_developer
Costing summary & strategy
There are additional costs associated with these API calls (on top of standard Google Workspace subscription), which will be billed to your Google Cloud account. Generally, there are free tiers available, and costs are on per-use basis afterwards. All workflows involving these API calls can be disabled at any time if needed.
Pricing details: Gemini & Text-to-speech. Price vary depending on the type of models used, thus generally for testing can use the lower end models, i.e. for text-to-speech AI, use the "standard" voice type. Google Cloud Pricing Calculator can also be used to calculate the costs based on usage estimates.
For beginners, the recommended method would be to set a overall budget under GCP > Projects > Billing > Cost Management > Budgets/Alerts. This way, the costs can be monitored during the initial testing period to minimize budget overrun risks, and the workflows can be stopped for optimization if needed. This method ensures zero risk for unexpected cost overruns, while giving you and your team sufficient flexibility to test out various solutions.
Alternatively, for a more advanced control, API limits can also be set for each individual models.