Skip to main content
Hello everyone,I want to create a zap allowing me to retrieve the first and last name appearing in the body of an email.I can't figure out why.Here is the body of the email in question:Raw Snippet Interested buyer ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ Interested buyer | Email not displaying correctly? Click here. Octavia Sobczyk is interested in this property €1,160,000 ARCANGUES, 64200I would like to retrieve the first and last name between "click here." and "is interested in this property".Here is the tested code:const bodyText = inputDatae'1. raw snippet'];const startText = "Click here.";const endText = "interested";const startIndex = bodyText.indexOf(startText) + startText.length;const endIndex = bodyText.indexOf(endText);if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {  const extractedText = bodyText.substring(startIndex, endIndex).trim();    output = {    extractedText: extractedText  };} else {  output = {    extractedText: "Extraction Failed"  };}

 

Thank for your helping.

Hi @Marion DEFONTAINE,

Try changing the following:

bodyText = inputData.keyValue;   //where keyValue is the key for your text

endText = “is interested”;

 

Hope this helps!


Hi @Marion DEFONTAINE 

You can try asking ChatGPT to help with your code.

You can also try this Zap action: ChatGPT - Extract Structured Data