问题
I am trying to retrieve list of canned responses in Gmail with the help of Gmail API in javascript, but it seems there is no API end point to do so.
Is there any other way to achieve it programmatically?
回答1:
You can retrieve the list of canned responses using the Gmail API.
All the canned responses are stored as "draft messages" even if you delete all the draft messages, you can still retrieve the canned responses by listing them.
https://developers.google.com/gmail/api/v1/reference/users/drafts/list
Unfortunately, this will return the full list of the draft messages, including the canned responses. In order to address this you can either:
Add a
<keyword>
and use the paramq
as query to search for this<keyword>
. For example:subject:<keyword>
(Not recommended) Delete the existing draft messages in order to retrieve only the list of canned responses. Note that if you do this, later on you wont be able to have draft messages, otherwise, your script will return these drafts as well.
来源:https://stackoverflow.com/questions/56446142/gmail-api-canned-responses