I often use two gmail labels label1
and label2
, and according to my personal mail management rules, I often change messages categories from label1
to label2
.
As I do this often, I thought I should try to automatize this process a bit by adding custom gmail command.
Here are the specifications of my mini-feature :
1) When a message (according to gmail api, a "thread") labelled label1
is selected in gmail, a button "CHANGE LABEL1 TO LABEL2" should be displayed in my gmail interface
2) When I click this button, selected message's label1
should be removed, while a label2
label would be added
That's it for the features.
Technically, here is what I think is needed :
a) A way to get and set the labels attached to a given message thread (identified by an id)
b) A way to display a button conditionally
c) A way to trigger a script when the button is clicked
d) A way to detect the id of selected message thread
Here are the technical solutions I think are available for each part :
a) ...is possible via a Google Apps Script, using GmailThread::addLabel and GmailThread::removeLabel
b) ...seems possible via a contextual gadget
c) ...is my first concern, since clicking on the button from b) should launch the script from a)
Also, the call to the a) script should pass the message thread id as a parameter.
d) ...is my second concern, maybe is it also possible via a contextual gadget, since those can parse the contents of a message ?
Does it seem possible to implement this mini-feature given the actual technology provided by google for scripting ?
More precisely, is it possible to make Gmail Gadgets and Gmail Apps Scripts interact ?
Or are there some alternatives to implement it ?
Additional information : I tried to investigate other technologies provided by Google to customize its product, but it seems that Gmail Labs API is not open to the public. Also, I don't think I could use a Gmail Sidebar Gadget since they do not seem to be able to know which message is currently selected in the gmail interface.