Use OpenAI with Zapier to parse an email (or other data)

  • 5 April 2023
  • 3 replies
  • 983 views
Use OpenAI with Zapier to parse an email (or other data)
Userlevel 7
Badge +11

If the following situation sounds familiar to you, then this article is for you.

You have a webform that can send you notification emails that contain all of the details of the form, in a format like this:

First name: Fred
Last name: Flinstone
Email: fred@flinstones.com
Phone: 206-555-1212
Company: Rock U
Website: rubble.com
Comments: "Please get back to me as soon as you can, I really want to make some money!!!!"

But what you need is to get each piece of info from that email into its own field in your app of choice (CRM, eCommerce, etc).

Before OpenAI

Prior to this technology, we likely would have recommended one of the following:

  • An email parser app (like Email Parser by Zapier, Mailparser, etc)
  • A code step to process the data from your email
  • Multiple Formatter steps to extract what you need (maybe RegEx?)

None of these options are anywhere as simple as what I’m about to show you. One of our Zapier Experts, Troy Tessalone, alluded to this method in this post, but I’m going to expand upon it a bit.

Using OpenAI to Parse Data

NOTE: You will need a paid OpenAI account in order to use the app in a Zap.

You don’t necessarily need to understand how Zapier’s Named Variables work, but if you’re curious here’s a great article about this lesser-known feature.

Credit also goes to one of my Zapier teammates, Kirk, for this specific inspiration.

The prompt I’ll be using.

Parse the contact details from the text after Content:

Return as formatted text that has the format below, with a field header followed by the field value enclosed in parentheses.

The output should look like this: FieldName(fieldvalue)

Content:

First name: Fred

Last name: Flintstone

Email: fred@flintstones.com

Phone: 206-555-1212

Company: Rock U

Website: rubble.com

Comments: "Please get back to me as soon as you can, I really want to make some money!!!!"

 

Check Out The Example

In this example, you would replace my typed fields with the email message that your web form sends you.

 

Here’s what I get in return:

 

I can then map each of these fields into my next step(s):

What About Using ChatGPT with Zapier?

In my admittedly limited testing, I couldn’t get the ChatGPT integration to provide the first name as a separate field. I’m sure it’s possible with some prompt tweaking, but I decided to use OpenAI for this article.

Beyond Email Parsing

There are other use cases for this type of workflow, like:

  • form apps that provide all of the form data in a single field
  • apps that have search steps that return data in one field or a format that’s unusable
  • parsing Slack messages to pull out separate fields
  • etc, etc, etc.

If you come up with something clever, we’d love to hear about it!


3 replies

Userlevel 7
Badge +8

Such an amazing use case ! Would definitely try it out soon ;) 

This is awesome, is there an example of how to use this with what looks to be an updated Ui in Zapier with additional info being requested? Should the URL be the the openai endpoint we are attempting to hit, for example, 

https://api.openai.com/v1/completions?

 

Userlevel 4
Badge +1

Sharing here that I have also seen users utilizing the new Extract Structured Data in ChatGPT action for parsing:

b3558e07a913ba3852393622016ad0fe.png

(Click here to view larger)

In testing, this gives even better results, although the setup is slightly more complex.

Happy Zapping ⚡️

Reply