I am working on one project for a client, and I need to add contacts to Google Contacts
with Google Contacts API
. The code:
function createContact(data) {
var contact = ContactsApp.createContact(data.firstName, data.lastName, data.email);
contact.addAddress(data.address);
}
runs on the trigger and I am getting this error: Exception: You do not have permission to perform that action.
(the same happens when I run the function from the Editor). I added permissions to the project (Permissions screenshot) and scope to the appsscript.json
file:
"oauthScopes": [
"https://www.google.com/m8/feeds"
]
Additional question: If I have got this project in my Google Account, how I can access to Google Contacts and add contacts to the client's Google account?