I'm looking to find / write a script to archive Google Chat messaged (hangouts). I thought that this would work, but it doesn't seem to do anything. Can anyone point out why its not working or what I've done wrong?
OR - If anyone else has a solution for what Im trying to do, that would be great too!
function ArchiveChats() {
var threads = GmailApp.getChatThreads(0, 100);
GmailApp.moveThreadsToInbox(threads);
GmailApp.moveThreadsToArchive(threads);
}
The problem with your code is that it gets the first 100 chat threads from anywhere in your mailbox rather than from your inbox.
Here's a function that will archive all chat threads that are not already archived: