diff --git a/gmail-sentiment-analysis/Samples.gs b/gmail-sentiment-analysis/Samples.gs new file mode 100644 index 000000000..ea58302f0 --- /dev/null +++ b/gmail-sentiment-analysis/Samples.gs @@ -0,0 +1,89 @@ +/* +Copyright 2025 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/** + * Create sample emails + */ +function generateSampleEmails() { + // Get active user's email + const userEmail = Session.getActiveUser().getEmail(); + + // Send emails + GmailApp.sendEmail( + userEmail, + "Thank you for amazing service!", + "Hi, I really enjoyed working with you. Thank you again!", + { + name: 'Customer A', + }, + ); + + GmailApp.sendEmail( + userEmail, + "Request for information", + "Hello, I need more information on your recent product launch. Thank you.", + { + name: 'Customer B', + }, + ); + + GmailApp.sendEmail( + userEmail, + "Complaint!", + "Hello, You are late in delivery, again. Please contact me ASAP before I cancel our subscription.", + { + name: 'Customer C', + }, + ); + + console.log("Sample email generation completed.") +} + * Create sample emails + */ +function generateSampleEmails() { + // Get active user's email + var userEmail = Session.getActiveUser().getEmail(); + + // Send emails + GmailApp.sendEmail( + userEmail, + "Thank you for amazing service!", + "Hi, I really enjoyed working with you. Thank you again!", + { + name: 'Customer A', + }, + ); + + GmailApp.sendEmail( + userEmail, + "Request for information", + "Hello, I need more information on your recent product launch. Thank you.", + { + name: 'Customer B', + }, + ); + + GmailApp.sendEmail( + userEmail, + "Complaint!", + "Hello, You are late in delivery, again. Please contact me ASAP before I cancel our subscription.", + { + name: 'Customer C', + }, + ); + + console.log("Sample email generation completed.") +} diff --git a/gmail-sentiment-analysis/appsscript.json b/gmail-sentiment-analysis/appsscript.json index 9b2be96ac..0a888d217 100644 --- a/gmail-sentiment-analysis/appsscript.json +++ b/gmail-sentiment-analysis/appsscript.json @@ -4,6 +4,7 @@ "https://www.googleapis.com/auth/script.external_request", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/script.locale", + "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/gmail.addons.execute", "https://www.googleapis.com/auth/gmail.labels", "https://www.googleapis.com/auth/gmail.modify"