Sorry, i'm not a programmer,
I'm using this gmail app script (CLEANINBOX) and it works great in roder to keep my inbox clean. As I need to use INBOX app (mobile) and GMAIL app (desktop) at the same time I need to implement this script in order to avoid that PINNED messages in INBOX get archieved.
I inserted a condition in the IF sequence and it does not work After struggling a bit I realized (correct me if I'm wrong) that the following code is not working becouse !thread.getLabels()=='PINNED') IS NOT BOOLEAN
Can anybody point me to the correct code?
function cleanInbox() {
var threads = GmailApp.getInboxThreads();
for (var i = 0; i < threads.length; i++) {
var thread=threads[i];
if (!thread.hasStarredMessages() && !thread.isUnread() && !thread.getLabels()=='PINNED') {
GmailApp.moveThreadToArchive(threads[i]);
}
}
}