Create a Google Data Studio Community Connector with "key" Auth type
An unofficial Google Data Studio open source Community Connector for visualising global stats of SendGrid user’s email statistics for a given date range.
its been a while that i'd been yearning to create my own open-source community connector but almost every usable data source api that i'd stumbled upon required some kind of auth while the tutorials & explanations available in almost every other blog post typically ended up using "none" 😐
felt like all the more reason for me to share this one.
demo
you could test the connector via the direct link or access the script files to host it yourself.
authentication
authenticate to the sendgrid api by creating an api key in the settings section of the sendgrid ui.
SendGrid recommends API Keys because they are a secure way to talk to the SendGrid API that is separate from your username and password. If your API key gets compromised in any way, it is easy to delete and create a new one and update your environment variables with the new key. An API key permissions can be set to provide access to different functions of your account, without providing full access to your account as a whole.
you will be prompted to enter this key while setting up the connector for the first time.
codebase
you can access the entire script on my github repository here.
architecture
perhaps except for 2, all the functions that have been invoked in this endeavour are mandatory -
the auth collective
gotchas
this app isn't verified
when authorizing the community connector, if you are presented with an "unverified" warning screen see this app isn't verified for details on how to proceed.
start date is too far in the past
sendgrid's stats APIs provide a read-only access to your email statistics that are available only for the last 3 years and so if you stumble upon the following error, please change the date range from the data studio viz.
{
"errors": [
{
"message": "start date is too far in the past",
"field": "start_date"
}
]
}