I am trying to get the chat log from google chat using google scripts, so far i manage to get all chat messages but its pulling all the data with the following script, what i want is to pull the messages from specific group/space and only from today, even following the documentation, i cant seem to find a way to do this, any ideas?
function getChats() {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange(1, 1).setValue("Date");
sheet.getRange(1, 2).setValue("Subject");
sheet.getRange(1, 3).setValue("Body");
var row = 2;
var chats = GmailApp.getChatThreads();
var chat_count = chats.length;
for (var i = 0; i < chat_count; i++) {
var count = chats[i].getMessageCount();
var messages = chats[i].getMessages();
for (var j = 0; j < count; j++) {
var chat_date = messages[j].getDate();
var subject = messages[j].getSubject();
var body = messages[j].getBody();
sheet.getRange(row, 1).setValue(chat_date);
sheet.getRange(row, 2).setValue(subject);
sheet.getRange(row, 3).setValue(body);
row++;
}
}
Browser.msgBox("All done!");
}