SMART-CLIENT-RESPONSE is a Python application designed to deliver intelligent client responses by leveraging OpenAI or Gemini APIs. The application also integrates with Google Sheets to trigger responses via email upon form submissions.
#📜 Overview
SMART-CLIENT-RESPONSE is a powerful tool to enhance client interactions through AI-driven responses. It utilizes the OpenAI API or Gemini API for natural language processing and advanced generative capabilities.
-
User Submission:
- A client submits a Google Form.
-
Google Sheets:
- The data is added to a connected Google Sheet.
-
App Script Trigger:
- Automatically sends the form data to the Flask app via the configured webhook.
-
SMART-CLIENT-RESPONSE:
- Processes the data, generates a response using OpenAI/Gemini APIs, and sends an email back to client.
- AI-powered responses using OpenAI or Gemini APIs.
- Automatic email notifications triggered by Google Form submissions.
- Seamless integration with Google Sheets and Google Cloud APIs.
Before starting, ensure you have the following:
-
API Keys:
- OpenAI API Key: Required to use OpenAI models.
- Gemini API Key: For enhanced AI capabilities. Example configuration:
genai.configure(api_key="YOUR_API_KEY") model = genai.GenerativeModel("gemini-1.5-flash")
-
Gmail Credentials:
- A Gmail account to send email responses. Example setup:
my_email = "EXAMPLE@gmail.com" # Your Gmail address password = "abcd abcd abcd abcd" # Your Gmail app-specific password
- A Gmail account to send email responses. Example setup:
-
Google Cloud Setup:
- Enable Google Sheets API in the Google Cloud Console.
- Generate a Service Account Key (JSON format) and download it for use.
-
Google Sheets Integration:
- Deploy the
main.pyscript and add the URL of deployment to App Script in Google Sheets to automate response handling.
- Deploy the
git clone https://github.com/your-username/PREETHAM-K-T_SMART-CLIENT-RESPONSE_KVG-COLLEGE-OF-ENGG.git
cd PREETHAM-K-T_SMART-CLIENT-RESPONSE_KVG-COLLEGE-OF-ENGGpython3 -m venv venv
source venv/bin/activate # For Windows: venv\Scripts\activatepip install -r requirements.txtSet up your API keys and email credentials in a .env file:
OPENAI_API_KEY=your-openai-api-key
or
GEMINI_API_KEY=your-gemini-api-key
EMAIL_USER=example@gmail.com
EMAIL_PASS=abcd abcd abcd abcd
service accout.json-
Enable APIs:
- Go to Google Cloud Console.
- Enable the Google Sheets API.
- Download the Service Account Key as a JSON file and place it in your project directory.
-
Deploy the App Script:
- Open Google Sheets > Extensions > App Script.
- Replace the script with the following:
function onFormSubmit(e) { var data = e.values; var url = "https://your-flask-app-url"; // Replace with your Flask app's deployed URL var payload = { "timestamp": data[0], "first_name": data[1], "last_name": data[2], "email": data[3], "country": data[4], "location": data[5], "project_type": data[6], "service_category": data[7], "website": data[8], "additional_info": data[9], "budget": data[10] }; var options = { "method": "post", "contentType": "application/json", "payload": JSON.stringify(payload) }; UrlFetchApp.fetch(url, options); } function createTrigger() { ScriptApp.newTrigger("onFormSubmit") .forSpreadsheet(SpreadsheetApp.getActiveSpreadsheet()) .onFormSubmit() .create(); }
- Deploy the script and set up triggers.
-
Start the Flask server locally:
python app.py
-
Deploy your Flask app to a hosting platform (e.g., AWS, Heroku, or Google Cloud) and update the webhook URL in the App Script.
-
Test the integration by submitting a Google Form response.
- Preetham K T