Blog / Integrations

From form to follow-up: automating a lead pipeline with Apps Script, Brevo and Discord

17 November 2026

Most small businesses lose leads in the gap between "someone filled in the form" and "someone followed up". The form works. The follow-up depends on a person noticing an email. Here is the pattern I reach for to close that gap, using three tools most teams already have: Google Apps Script, Brevo and Discord.

What the pipeline does

One form submission triggers three things, in order:

  1. The lead is saved to a Google Sheet, so there is always a record.
  2. The contact is added to a Brevo list, so follow-up emails can start without anyone copying details across.
  3. A message lands in a Discord channel, so the team knows within seconds.

No spreadsheet gets emailed around and nobody has to remember to check an inbox.

The glue: one Apps Script web app

Apps Script can receive the form post directly and call the other two services. This is the whole thing:

const props = PropertiesService.getScriptProperties();

function doPost(e) {
  const d = e.parameter; // form fields arrive here

  // 1. Save the lead
  SpreadsheetApp.getActiveSpreadsheet()
    .getSheetByName('Leads')
    .appendRow([new Date(), d.Name, d.Email, d.Business, d.Message]);

  // 2. Add the contact to Brevo
  UrlFetchApp.fetch('https://api.brevo.com/v3/contacts', {
    method: 'post',
    contentType: 'application/json',
    headers: { 'api-key': props.getProperty('BREVO_KEY') },
    payload: JSON.stringify({
      email: d.Email,
      attributes: { FIRSTNAME: d.Name },
      listIds: [2],
      updateEnabled: true
    })
  });

  // 3. Tell the team on Discord
  UrlFetchApp.fetch(props.getProperty('DISCORD_WEBHOOK'), {
    method: 'post',
    contentType: 'application/json',
    payload: JSON.stringify({ content: 'New lead: ' + d.Name + ' (' + d.Business + ')' })
  });

  return ContentService.createTextOutput('ok');
}

Deploy it as a web app, set it to run as you and be reachable by anyone, and point your form at the deployment URL. Replace the list ID with your own, and create any attributes you send in Brevo first.

Why secrets live in Script Properties

Notice that the Brevo key and the Discord webhook are not in the code. Put them under Project Settings, then Script Properties. That way the script can be shared or copied without leaking credentials, and rotating a key never means editing code.

Make it safe to leave running

A pipeline you do not watch has to fail loudly. Four habits that matter:

  • Add a hidden honeypot field to the form and ignore any submission that fills it in. It stops most bots.
  • Validate the email before calling Brevo, and log bad submissions to a second sheet instead of dropping them.
  • Wrap each external call in its own try and catch, so a Brevo outage does not stop the Discord alert.
  • Write failures to a sheet or post them to a separate Discord channel, so you hear about problems before a client does.

When to reach for n8n instead

Apps Script is perfect for a short, linear flow like this one. When the workflow branches, needs retries, or touches many tools, a visual orchestrator such as n8n is easier to read and maintain. The pattern is the same: one trigger, a few well-named steps, and an alert when something breaks. Only the canvas changes.

The point

Connecting tools is not about clever code. It is about making sure the work moves without a person acting as the glue. If your leads, emails and alerts still depend on someone copying and pasting, that is the first thing I would automate. If you want help with that, get in touch.

Enjoyed this? I also publish on Substack and Medium.

Let's engineer a better way to work.

Start a project