Hi! I am pretty new here.
We are a small company (non-profit) that have a number of clients.
I want to build an internal tool that makes it possible to fetch all ingoing/outgoing emails to certain clients (email-addresses). The idea is that everyone on the team should be able to via a dashboard get an “activity feed” with all messages related to each client regardless of who’ve sent/received them from our side.
- I created a service account, and activated Domain-wide delegation with scope
https://mail.google.com/
- I’ve enabled the Gmail API
In n8n (cloud) I’ve created service account google credentials, added the service account email as well as the private key. It says “Connection tested successfully” until I add a user to impersonate. And as I’ve understood it, I need to impersonate an user to be able to fetch its messages.
If “impersonate user” is ON but without email specified, it works. But if I add my own email for example, it says:
Couldn’t connect with these settings
401 - {"error":"unauthorized_client","error_description":"Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested."}
So I am stuck here.
Any ideas on how to troubleshoot this? What could be the error?