Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does a Gmail message Id or ThreadId map to the new Gmail UI?

Edit: addressing the first comment below and for clarity, this isn't a code question. The question is simply:

What do I put into the URI querystring of the new Gmail UI to view a draft message created by the Gmail API?

Despite this not really being a code question, I'm asking on Stack Overflow as it's Google's preferred platform for Gmail API questions.

--

If I view a draft message in the new Gmail UI, the URI is something like this:

https://mail.google.com/mail/u/1/?zx=iij9apqgzdf4#drafts?compose=jrjtXSqXwlFGnSGCQgDCdnHGVFdlpFMgzsCNgpQstQLxdLCMkjKstBmWZkCmjhWTQnpsZCJF

I can't see any way to create such a link from the Id or ThreadId of a message created via the Gmail API.

Previously, one could do this:

https://mail.google.com/mail/u/1/?zx=ov61dxfbrcga#drafts?compose=1631caae9dbb074d

where the value of "compose" is the Id.

How can the same thing be accomplished in the new UI?

like image 524
Chris Wood Avatar asked May 01 '18 21:05

Chris Wood


People also ask

How do I get the new Gmail layout?

If you just can't stand the new Gmail layout, here's how to change it back. Click on the Settings gear icon in the upper right corner of Gmail. In the panel that slides out, under “You're using the new Gmail view” click “Go back to the original view”.

Why is Gmail 2022 different?

The new design is meant to better integrate programs like Meet and Chat and make them more accessible on Gmail's main landing page. Google said it didn't have details to share on when people won't be able to opt out of the new layout anymore.


Video Answer


1 Answers

I've been encountering the same problem and have had some success in this problem, as well as some issues I still can't get past.

Good news: The new compose parameter format is some kind of "base40" encoding. I searched the Gmail source for a restricted alphabet string, and found and deobfuscated the bit of code doing this encoding/decoding: https://gist.github.com/danrouse/52212f0de2fbfe33cfc56583f20ccb74

This code includes an encode and decode function which should work for Gmail-format query parameters.

Bad news: The values that it is encoding to open draft emails do not appear to be available using the Gmail API. Specifically, they look like this: thread-f:NEW_THREAD_ID+msg-a:DRAFT_ID -- while the draft ID is the same as it was before, the Thread ID does not appear to match any of the IDs that the Gmail API returns.

Interestingly, if you inspect the subject row in the Gmail UI, it has dataset attributes including all of both the old format and new format IDs - but it's still unclear how to get the new ones programatically.

like image 162
kremonte Avatar answered Sep 28 '22 01:09

kremonte