Jai Prak
Jai Prak

Reputation: 3410

get current thread id in gmail using google app script

I am building a Gmail Add-On. I want to get the thread Id of current open email thread using Google Apps Script. I tried to figure out in Google Developers documentation for GmailApp. But nothing found relevant.

Upvotes: 2

Views: 2372

Answers (1)

Tanaike
Tanaike

Reputation: 201388

You can retrieve messageId of the current message from e.messageMetadata.messageId of buildAddOn(e). Using this, you can retrieve threadId as follows.

var threadId = GmailApp.getMessageById(messageId).getThread().getId();

References :

If this was not what you want, I'm sorry.

Upvotes: 4

Related Questions