Gmail – How to implement a custom filter for Gmail

gmailimap

I need to implement a Gmail filter that automatically moves a mail to another folder (not the inbox) if the Priority Inbox decided that it's not important. I saw there is an API for developing gadgets (interface elements), and IMAP. Could IMAP be used for this? If not, is there a chance to implement this functionality?

Edit:
Let me clarify a bit. The client has Priority Inbox enabled and when using the web interface there is no problem. But when he accesses the mail from his iPhone using the built-in app all messages are treated the same, as if there was no Priority Inbox. He wants something that automatically moves all mails that are not in the Priority Inbox to another folder, so that in the inbox remains only important mail (think of it as an emulation of PI for apps that don't support it).

Best Answer

There is a "not marked as important" condition: in:inbox -is:important

With minus you get the opposite results.
Create a custom filter with in:inbox -is:important in the filed Has the words and skip the inbox and create a new label "not important".