michaelf
michaelf

Reputation: 499

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

Upvotes: 5

Views: 1867

Answers (2)

metamatt
metamatt

Reputation: 14419

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.

Upvotes: 2

aloo
aloo

Reputation: 5389

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.

Upvotes: 2

Related Questions