How to automate gmail response, different first and second response

by transformer   Last Updated August 10, 2018 02:03 AM

I am seeking help to automate the gmail response to new community members in an apt complex.

  1. First, new members send/email us a new membership including name, i.e. request as a new resident.

    How can we check this in a spreadsheet and then send them welcome letter (welcome to community apts..).

  2. Second, if they want pool pass, they respond/email/re send us another form... or text saying requested pool pass

    We then send them gmail auto respond here with their pool pass number (from spreadsheet or text file)

Question: I need help/script to 1) check/compare both subject/body for keyword/names in a spreadsheet or text file (without re: , so we know its new members). And then, 2) follow-up if its a response/Re/thread so we can send them pool safety rules/pass.

after searching I found this sample and modified it ..

function autoReply() {
  var interval = 300;    //  if the script runs every 5 hrs/300mins; 
  var date = new Date();
  var day = date.getDay();
  var hour = date.getHours();

    // #1 how to check text/names here?? and new message
    var threads = GmailApp.search('is:inbox subject:' + ....); 
    for (var i = 0; i < threads.length; i++) {
      threads[i].reply("Welcome new guests, please respond with request for pool pass.");

   // #2 how to check if the pool pass is requested in the response??
  for (var i = 0; i < threads.length; i++) {
       //if (is:unread AND body:"guest name" AND body:"pool pass requested" )
      if (subject == response?? && bodycontains pool pass requested)  // how to check response
      threads[i].reply("Welcome new guests, you are assigned pool area 1A.");
    }
  }
}

thanks



Related Questions


Gmail Auto-Response, one time only

Updated September 11, 2017 18:03 PM


Gmail auto canned response send to wrong adress

Updated August 30, 2017 12:03 PM