I am just starting to try to create a new Gmail add-in and am running the following error message:
"You do not have permission to call fetch"
This happens when testing addin in the script editor, as well as when deploying inside my Gmail. Here is a sample code:
function getContextualAddOn(e) {
var API_KEY = 'TESTKEY';
var URL = 'https://[REDACTED]';
var options = {
'method' : 'post',
'contentType': 'application/json',
'headers': {
'x-api-key': API_KEY
},
'payload' : JSON.stringify({ 'foo': 'bar' })
};
var response = UrlFetchApp.fetch(URL, options);
[more code that builds a card]
}
As you can see, this is a fairly simple use of UrlFetchApp.fetch. I'm new to AppsScript, so maybe I missed the declaration or permission area in my manifest. I tried an even simpler example using UrlFetchApp.getRequest, but that also failed: "You do not have permission to call getRequest."
the manifest for the addon is the same as in the examples:
{
"timeZone": "America/New_York",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": [
"https://www.googleapis.com/auth/gmail.addons.execute","https://www.googleapis.com/auth/gmail.addons.current.message.readonly", "https://www.googleapis.com/auth/userinfo.email"
],
"urlFetchWhitelist": [
"https://[REDACTED]"
],
"gmail": {
"name": "Test Add-On",
"logoUrl": "https://www.gstatic.com/images/icons/material/system/1x/receipt_black_24dp.png",
"primaryColor": "#4285F4",
"secondaryColor": "#4285F4",
"contextualTriggers": [{
"unconditional": {},
"onTriggerFunction": "getContextualAddOn"
}],
"version": "TRUSTED_TESTER_V2"
}
}
, UrlFetchApp Gmail Add-On, ? - - script?