How to get structured data from email using OpenAI similar to Zapier

I am new to n8n. I am switching from Zapier and looking to replicate my workflow on n8n. In Zapier, a new email triggers the workflow. The body content is then sent to OpenAI and it extracts these values from the emails. The emails are human written by prospective customers asking for prices. OpenAI extracts product, delivery area and product weight as per requirements mentioned in the email, looks up value of each of these in google sheets, calculates a formula for the price using these 3 variables and then a step feeds all these variables plus a template with set of instructions to write an email. The email generated by OpenAI is then created as a draft with original sender as recipient for human verification.

I am not very much experienced with n8n. Zapier made it very easy with its UX. n8n is equally or more powerful as I understand and cost-effective. I am trying to learn my way with n8n by replicating the same workflow.

My worflow is as below. I am not able to send the complete message body to OpenAI. Please guide me by sharing tutorials or blog posts how do I go about in achieving the same results with n8n. Thanks in advance.

Hi @Muhammad_Omair_Haroo :wave: Welcome to the community and to n8n :tada:

Could you share an example of the data you’re trying to send over to OpenAI? A sample message or JSON data (with no sensitive data included, of course!) would be really helpful in us pointing you in the right direction :slight_smile:

Hi,

Thankyou for replying.

These are usually emails with no particular format. Leads send us email asking us to provide prices for their requirements.

They usually mention their name, company name, email, the product they require, the packing they require, quantity and the place of delivery. In zapier, I have written a prompt that standardizes the answers. Which I then look up a google sheet and calculate values.

Hi @Muhammad_Omair_Haroo :wave: Thanks for getting back to me!

Would you be able to share the following:

  • Some example data, otherwise I’ll just use this as an example based on what you’ve mentioned to try to create some :sweat_smile:
[
{
"quantity": 
3,
"email": 
"[email protected]",
"name": 
"John Smith",
"company": 
"My Awesome Company",
"packing": 
"Standard",
"place_of_delivery": 
"Ireland"
}
]
  • You mentioned you have a prompt that standardises the answers. Can you explain what you mean here and how you’re doing this?
  • What kinds of values are you calculating on the Google sheet? Can you share an example sheet with us that uses dummy data instead of real data that we can use for an example?
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.