Skip to main content

Hey All,

I’ve been running into this issue for months now and just can’t seem to fix it, it keeps popping up. It’s very frustrating because it makes the output of my zaps unreliable.

I use ChatGPT to extract information from a webpage. By formatting the “Output” like this, it will create two output blocks. Whenever I try to split outputs from a ChatGPT Conversation block, it works very well like shown below -except- when the output has parentheses. Due to the parentheses, the output will cut off.

 

The actual output of the subheadline should say this:

  1. Trip planning made easy and (almost) as fun as travelling itself!

However, due to the parenthesis this becomes the output:

  1. Trip planning made easy and (almost

 

Anyone got an idea how to fix this?

Hi @DaanisAan 

One approach would be to use this Zap action: AI by Zapier - Analyze and Return Data

You can use your ChatGPT API Key.

 


@DaanisAan 

Otherwise, I recommend defining a JSON template for ChatGPT to output that can then be reliably parsed using a Code step.

 

EXAMPLE for email parsing...

Action: ChatGPT - Conversation

Prompt ChatGPT to parse the email and returned the data as structured JSON to then be used in the following JavaScript Code step.

  • You only need to configure the field: User Message
  • Adjust the prompt instructions. (first line)
  • Define your JSON template. (fields you want returned from the parsed data)
  • Map the variable that contains the data to be parsed. (e.g. Email Body)
  • Other fields can be left with their default values.

 

 

CONFIG

 

PROMPT

Parse the contact details from the lead.

Return as fully structured JSON object like this:
{
"NameFirst": "",
"NameLast": "",
"Email": "",
"PhoneNumber": "",
"Company": "",
"Website": "",
"Comments": ""
}

Content: {{CONTENT}}

 

RESULTS

 

Action: Code - Run JavaScript

This Zap step will take the returned JSON from ChatGPT, and convert the JSON into individual data point variables that can be mapped to following Zap steps.

 

Map the Assistant Response Message variable from the ChatGPT step.

 

REFERENCE

 

 

CONFIG

 

CODE

let Lead = inputData.Lead;

Lead = JSON.parse(Lead);

output = {Lead}];

 

RESULTS

 

 

###


Hey, thanks a LOT! Will definitely test this. 


Reply