Dilip Tharuka
Dilip Tharuka

Reputation: 117

Unable to fetch bccRecipients, ccRecipients and toRecipients via gmail event object

I am creating a Gmail add-on, basically I want to get bcc, cc and to emails once the user clicks on an email.

I have defended onTriggerFunction in the manifest for that, also added metadata scope. But bccRecipients, ccRecipients and toRecipients attributes are null in gmail event object.

Manifest

"gmail": {
  "contextualTriggers": [{
    "unconditional": {
    },
    "onTriggerFunction": "onGmailMessage"
  }]
}

Scope

https://www.googleapis.com/auth/gmail.addons.current.message.metadata

Upvotes: 0

Views: 101

Answers (1)

ziganotschka
ziganotschka

Reputation: 26836

The Gmail event object contains the following information:

  • gmail.accessToken string

  • gmail.bccRecipients[] list of strings

  • gmail.ccRecipients[] list of strings

  • gmail.messageId string

  • gmail.threadId string

  • gmail.toRecipients[] list of strings

bccRecipients, ccRecipients and toRecipients are arrays.

To access the elements contained in those arrays you need to loop through them.

E.g. e.gmail.bccRecipients.forEach(function(recipient){Logger.log(recipient)});

Upvotes: 1

Related Questions