Gmail doesn't natively call webhooks. But it does auto-forward matching emails, and combined with an email-to-API service, that's effectively a webhook — with filtering, retry, and dead-letter handling baked in.

Here's the end-to-end setup.

What you'll need

  • A Gmail account (personal or Workspace) that receives the emails you want to route
  • An email-to-API service that gives you an inbox address and extracts the fields you want. We'll use MailToAPI here — free trial gets you to working in 5 minutes.
  • An API endpoint on your side that accepts a POST with JSON

Step 1 — Create your inbox

Sign up at mailtoapi.app. Create an inbox and describe the JSON fields you want extracted. For a typical lead-intake setup that's something like:

name        string  required
email       string  required
phone       string  optional
company     string  optional
intent      string  optional

Set the destination URL to your own API endpoint (e.g. https://api.yourapp.com/leads) and any auth headers your endpoint needs (e.g. Authorization: Bearer ...).

You'll get a forwarding address like [email protected]. Keep it handy for step 3.

Step 2 — Set up Gmail auto-forwarding

Gmail requires you to verify the destination address before forwarding can be enabled.

  1. In Gmail, click the gear icon → See all settingsForwarding and POP/IMAP.
  2. Click Add a forwarding address. Paste the address from step 1 ([email protected]).
  3. Gmail sends a verification email to that address. Open MailToAPI, find the run with the verification code, and either click the verification link or paste the code back into Gmail.
  4. Once verified, the address shows up under "Forward a copy of incoming mail to". Leave the default forwarding rule disabled if you only want to forward specific emails — we'll use filters in step 3.

Step 3 — Filter which emails get forwarded

You almost never want to forward every email. Use Gmail filters to forward only the ones you care about (lead form notifications, invoices from specific vendors, support emails to a specific alias, etc.).

  1. In Gmail, click the search bar's filter icon to open the filter builder.
  2. Define the filter — typical examples:
    • By sender: from:[email protected] for Webflow form submissions
    • By recipient alias: to:[email protected] for emails to a specific alias
    • By subject: subject:"New lead from" for form-tool notifications with consistent subjects
    • By keyword: "invoice" in the body
  3. Click Create filter.
  4. Check Forward it to and pick your MailToAPI address.
  5. Optionally also check Skip the Inbox (Archive it) if you don't want a copy in your inbox.
  6. Click Create filter.

Step 4 — Send a test

Send (or have someone send) an email that matches your filter. Within ~30 seconds, you should see a new run in MailToAPI with the extracted JSON delivered to your destination. If your endpoint returns 2xx, you'll see delivered; otherwise delivery_failed with the response captured so you can debug.

Step 5 — Receive the JSON in your API

On your side, just accept a POST with JSON. Express:

import express from 'express';

const app = express();
app.use(express.json());

app.post('/leads', (req, res) => {
  const lead = req.body; // { name, email, phone, company, intent }
  // save to DB, post to Slack, kick off your workflow
  res.status(200).json({ ok: true });
});

app.listen(3000);

Notes and gotchas

  • Verification email: Gmail sends a verification email to the forwarding address. You confirm it inside MailToAPI's run inspector.
  • Reply-to vs From: when Gmail forwards an email, the "From" Gmail sees is your Gmail address, not the original sender. The original sender is in the headers. MailToAPI handles that — your extracted JSON reflects the real sender's details if they're in the body.
  • Multiple filters → one address: you can forward all matching emails from many filters into the same MailToAPI inbox, and the LLM extracts what it can from each. Use separate inboxes if you want different JSON shapes per email type.
  • Volume: Gmail has soft limits on forwarding (~few thousand/day for personal accounts; Workspace is higher). If you're routing high volume, set up a dedicated alias upstream and route MX directly to MailToAPI instead.
  • What about Outlook / iCloud / etc.: same idea. They all support auto-forwarding rules. The MailToAPI side doesn't care which provider the forwarded email comes from.

That's the entire pipeline. The Gmail filter is the one piece you maintain; everything past the forward — parsing, retries, deliverability — is handled.