Gmail lists fetching

So, I'm trying to build retool app in which I can manage my database, and now I want to get all lists from gmail inbox and then save it to my PostgreSQL database to then show them in the retool table. For now I have like 5 email inboxes which I want to synchronize with retool and update like each minute or five.
The most difficult part for now it's to at least take messages from gmail with gmail api.

I already created in google cloud Oauth client ID and API key, and tried to make resource with that data, but for now it seems to be unclear how I will set up my credentials from other emails into api request.
I tried to do this, but it of course won't work, because I didn't provide any of my real credentials of any of email. I researched a little bit and found that I will need to provide for each email access_token, but is there another way, because it will be really complicated to always refresh them and what will happen if I will want to add more emails later..


2 Likes

Also maybe there is a way to make it with workflow and receive just new notifications from inbox, and then put it in db, it is possible here, or it should be done not in retool?

Hey @dale, welcome to the forum!

So, in terms of connecting to your 5 different inboxes, you will need 5 different resources set up, or as many API resources as inboxes that you want to connect.

You can take the messages using this endpoint

You could create a workflow with this endpoint and make it run frequently, filter the messages that you receive by that given time frame and then update them to your database.

You could ALSO push notifications from google but the process is quite convoluted as you would have to get the message id for each push notification, get the message, identify what kind of update it was and then decide what to do with it.

I hope this helps!

1 Like

Hi, Miguel!
Ok, that makes sense, so I need to authorize 5 different resources in retool manually, and maybe can I do some ui to add them, so user can add more inboxes to track? And maybe you know for how long lasts this session.
Also i tried to put my resource to workflow but it gets unavailable, because I can't authorize in oauth through workflows

1 Like

Hi @dale oauth isn't supported in workflows quite yet :disappointed: Some folks have worked around this with other auth methods such as sharing credentials Running workflow api call backend environment vs individually results in [object Object] - #3 by Kabirdas

1 Like