Email scraper/parser -> To Google Sheets + send first email + connect to vbout

Hi there,

I could use some help setting up the following:
-We receive an email with client data

  • The data needs to be scraped and parsed to Google Sheets, as well as Vbout
  • And a first response needs to be activated.

I’ve set up part of the flow, but I could use a bright mind to help me.
Who could help me out?

These are example text inputs:
Name: Sjaak Henk
Email: Sjaak@henk.com
Phone: 0031505050505
Company: Henk.com
Industry: Architecture
State/Province: Utrecht
Country: NL

Activation Date: 10-15-10
Activation End Date: 17-15-10

All the best wishes!

Hi Maarten,

Assuming you are Dutch, so am I. Maybe I can help you out. I send you a DM.

KR Bram

Hey @Maarten,

Not sure if you still need help, but I’m posting a solution here for future reference.

This is the general flow you’ll need:

I’m assuming most steps are pretty straightforward, but if you need help with this, let me know.

The code step is used to parse data from the email.

Change the emailContent variable to match your email’s content. You may need to tweak the code to fit your exact email content, but this example should guide you.

Here’s the code I used:

exports.code = async function code(inputs) {
    const emailContent = inputs.emailContent;

    const extractInformation = (key, content) => {
        const regex = new RegExp(`${key}:\\s*(.*?)\\s*(?=\\n|$)`, 's');
        const match = content.match(regex);
        return match ? match[1].trim() : null;
    };

    return {
        name: extractInformation('Name', emailContent),
        email: extractInformation('Email', emailContent),
        phone: extractInformation('Phone', emailContent),
        company: extractInformation('Company', emailContent),
        industry: extractInformation('Industry', emailContent),
        stateProvince: extractInformation('State/Province', emailContent),
        country: extractInformation('Country', emailContent),
        activationDate: extractInformation('Activation Date', emailContent),
        activationEndDate: extractInformation('Activation End Date', emailContent)
    };
};

This script will output a JSON object like this, which can be used in subsequent steps:

{
  "name": "Sjaak Henk",
  "email": "Sjaak@henk.com",
  "phone": "0031505050505",
  "company": "Henk.com",
  "industry": "Architecture",
  "stateProvince": "Utrecht",
  "country": "NL",
  "activationDate": "10-15-10",
  "activationEndDate": "17-15-10"
}
2 Likes

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