Gmail to Google calendar using GPT 3.5

I’ve been tasked by a relative who’s been losing her mind running her business with automating incoming orders. All orders are made at least 24 hours prior, so there’s no need for real-time solutions.

For context: A taxi company gets ride orders, cancellations and changes through cca 15 vendors, with all of them getting mirrored in email form (some in body of email, some in attached pdf). I’ve come up with an automation where the body of an email gets ran through GPT 3.5, with the outcome being all the data needed (name, address, date, notes etc.) (fine-tuning coming soon).

The expected result is to create google calendar events from incoming emails, and then update them if any changes/cancellations come through, and have this whole system running automatically (the volume is 200 emails a day, can scale up to a thousand).

My question is as follows: How can I transform this output (essentially a string of text) into separate entities, so they can be spread over a Coda Table? What format should the output ideally be in? I’ve switched to Coda from Notion due to their lack of options when it comes to formulas. I believe Coda will allow me to both move this information around and sync Coda’s calendar with a google one (I’ve seen some interesting bits about two-way sync, already got the Gmail and Google calendar packs installed).

Would you have some insight for solving this conundrum? I’m open to any options you might feel would provide a better solution. I’ve seen some things about ParseJSON(), and I suppose it’s better if the info gets pushed from one cell (a column in the Gmail table, named “GPT output”) into the new table (the one that’s synced with a calendar), rather than ~15 cells from that 2nd table each making a pull request for their individual piece of information from the GPT output cell.

Welcome to the Coda Community! I’ve moved this to the Ask the Community topic, since the Developers Central topic is more related to using APIs, etc.

I think asking GPT to output JSON and then parsing it with ParseJSON() sounds reasonable to me. How to structure the tables really depends on your use case, but in general it’s easier to add columns to an existing row then it is to move data between tables.

1 Like

Hey Eric,
I’ve been expressly told by Jasmine from the support email to check out the dev central forum, but anything goes as long as I can make this work. I will be using OpenAI’s API anyway.

Gotcha, it’s a borderline question for sure. It just sounds like the core issue is how to make a good Coda doc vs how to write code, so the broader audience may be better.

1 Like

hi @Artur_Dobryashkin ,

interesting work you do. You wrote::

with the outcome being all the data needed (name, address, date, notes etc.) (fine-tuning coming soon).

you can create one prompt that generates the content of the email as body text, besides that you need a prompt to extract the email and one for the subject like ‘your ride at Oct 27: 10h00 from AirPort’

That means you have your ‘blob’ in one (canvas-) column, the second one with all the email body etc.

in case you want to store details like client name, address etc in Coda, you need a column for each of them and here I see two ways:

  • you create per column a prompt to extract the data
  • you create a canvas column with a structure (based on a prompt) and you use a button to take out the details and put them in the proper column via modifyRows(), that is in terms of AI consumption maybe less expensive. This is a bit of trial and error based on what you need to output.

all together, it is an interesting usage of AI to run through email body texts and attachments to extract data as a foundation for scheduling.

cheers, Christiaan

1 Like

The Gmail pack already outputs the metadata like sender email or subject into a table by default - all that’s needed is to get what we need from the email body into multiple columns. Is there a two-way sync between coda and google’s calendar, or would we need to make like 3 separate buttons to create/update/delete events and automate those?

hi @Artur_Dobryashkin ,

Thanks for your most friendly reply.

Coda is the owner of the Gmail Pack, maybe @Eric_Koleda knows if they plan to integrate 2WS in these packs.
Until then, I suggest you follow up on your own ideas, create 3 separate buttons and automate those.

Cheers, Christiaan

1 Like

We haven’t yet implemented two-way sync for the Google Calendar Pack, but it’s something we are working on.

5 Likes

Could you share an ETA on something like this? Sounds like 1/2 of my work would be cut out for me with an amazing integration of this caliber.

We don’t have an ETA as of yet, as it’s pending some infrastructure changes.

2 Likes

+1 for 2-way sync with GCal