Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Gmail draft created in Gmail API in browser window

Per this SO thread I should be able to go directly to a Gmail draft message, created using the Gmail REST API, using a hyperlink formatted like:

https://mail.google.com/mail/#drafts?compose={ThreadId}

However, it's not working. The thread ID I get as a response to my Gmail API call does not open the draft message created. What's really strange is when I open the draft from Gmail (that I created using the API) the thread ID DOES match for a split second in the URL then changes.

How does one open directly to a draft message utilizing the message.threadId? I'd like it to be a pop out message as well and should be possible per this thread but getting the draft to show at all is my first priority.

Gmail id hyperlink to draft

like image 216
michaelf Avatar asked Sep 27 '22 15:09

michaelf


2 Answers

The thread id/message id of a draft are not stable. That is, they change everytime the draft is edited/saved. The only thing that is stable is the draft id, however, this is not available in the gmail ui.

like image 187
aloo Avatar answered Oct 18 '22 12:10

aloo


The Users.drafts.create API call returns a User.drafts resource containing the draft ID. The draft ID is not the same thing as a message or thread ID, but you can then call Users.drafts.get or Users.drafts.list, both of which will let you correlate the draft ID to a thread ID and message ID.

like image 36
metamatt Avatar answered Oct 18 '22 12:10

metamatt