Created
November 9, 2017 04:06
-
-
Save kir-sf/9d5fb8e89057300fd86e95d5885115fe to your computer and use it in GitHub Desktop.
landing answering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function process() { | |
var threads=GmailApp.search('from:___@____.ru is:unread subject:"Отправка Заявка" OR subject:"Отправка Форма"'); // ищем нужные письма | |
for (var i=0; i<threads.length; i++) { // перебираем их все | |
var messages=threads[i].getMessages(); | |
for (var j=0; j<messages.length; j++) { | |
var info=parseInfo(messages[j].getBody()); // парсим данные | |
var res=sendFirstMail(info.mailTo, info.name, "reg0"); // пишем сообщение контакту | |
// Вызов функции записи в Firebase | |
callFirebase(info.name, info.mailTo.toLowerCase(), info.mobile,'звонок по форме','[трубы]Обращение на форме от Имя: '+info.name+' Емейл: '+info.mailTo.toLowerCase()+' Телефон: '+info.mobile+', заполнить анкету, узнать потенциал', "трубы"); | |
createDelivery(info.mailTo); | |
// помечаем письмо прочитанным | |
messages[j].markRead(); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment