Skip to content

// crm

Via API

Insightly email verification with pingutil

Insightly leads come from web-to-lead forms and imports, and nothing checks the address before it lands in a mass email or a rep's task list. A workflow on lead creation uses a webhook action to send the lead to a small service, which verifies the email with pingutil and writes the status and email category back through the Insightly API.

Where it connects: Insightly workflow automation on Leads (record added) with a webhook action, and the Insightly API v3.1 to update lead custom fields

What goes wrong without it

  • Web-to-lead forms fill Insightly with addresses that bounce on our first email.
  • We convert leads to contacts and only then find out they used a throwaway inbox.
  • There is no quick way to tell company leads from personal ones in our lead views.

What you can do with Insightly and pingutil

  • Verify leads before conversion

    Write `status` to a custom field so reps check it before converting a lead to a contact and opportunity.

  • Mark junk and throwaway leads

    When `category` is `disposable` or `status` is `invalid`, set a custom field your lead views filter on.

  • Add industry

    For `company` domains, write `company.industry` to the standard Industry field or a custom field.

Set it up

  1. 1

    Create lead custom fields Email Status, Email Category and Company Industry, and note their field names (they end in `__c`).

  2. 2

    Deploy the service below with `INSIGHTLY_POD`, `INSIGHTLY_KEY`, `HOOK_USER`, `HOOK_PASS` and `PINGUTIL_KEY`.

  3. 3

    In System Settings, Workflow Automation, create a workflow on Leads that runs when a record is added.

  4. 4

    Under Actions choose Add New Webhook, enter your service URL and set the Basic auth credentials the service expects.

  5. 5

    Use a request inspector or your service logs to confirm the payload field names once, then publish the workflow.

Receiver for the Insightly workflow webhook
// node >= 18, npm install express
import express from 'express';

const API = 'https://api.' + process.env.INSIGHTLY_POD + '.insightly.com/v3.1';
const ins = {
  authorization: 'Basic ' + Buffer.from(process.env.INSIGHTLY_KEY + ':').toString('base64'),
  'content-type': 'application/json',
};
const expected = 'Basic ' + Buffer.from(process.env.HOOK_USER + ':' + process.env.HOOK_PASS).toString('base64');
const pu = { authorization: 'Bearer ' + process.env.PINGUTIL_KEY, 'content-type': 'application/json' };

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

app.post('/insightly', (req, res) => {
  if (req.headers.authorization !== expected) return res.sendStatus(401);
  res.sendStatus(200);
  const lead = req.body.entity ?? req.body; // field ids and values of the lead
  if (lead?.LEAD_ID && lead?.EMAIL) handleLead(lead.LEAD_ID, lead.EMAIL).catch((e) => console.error(e));
});

async function pingutil(path, body) {
  const r = await fetch('https://pingutil.com' + path, {
    method: 'POST', headers: pu, body: JSON.stringify(body), signal: AbortSignal.timeout(30_000),
  });
  return r.ok ? r.json() : null; // fail open on 429 or errors
}

async function handleLead(id, email) {
  const [v, l] = await Promise.all([pingutil('/v1/verify', { email }), pingutil('/v1/lookup', { input: email })]);
  const CUSTOMFIELDS = [];
  if (v) CUSTOMFIELDS.push({ FIELD_NAME: 'Email_Status__c', FIELD_VALUE: v.status });
  if (l) CUSTOMFIELDS.push({ FIELD_NAME: 'Email_Category__c', FIELD_VALUE: l.category });
  if (l?.company?.industry) CUSTOMFIELDS.push({ FIELD_NAME: 'Company_Industry__c', FIELD_VALUE: l.company.industry });
  if (!CUSTOMFIELDS.length) return;

  await fetch(API + '/Leads', { method: 'PUT', headers: ins, body: JSON.stringify({ LEAD_ID: id, CUSTOMFIELDS }) });
}

app.listen(process.env.PORT ?? 3000);

What to do with each result

pingutil resultAction in Insightly
`status: "valid"`Ready to convert and email.
`status: "invalid"`Mark the lead as junk or not converted; do not email.
`status: "risky"`, `reason: "accept_all"`Convert if otherwise qualified, but email carefully.
`category: "disposable"`Disqualify; the address is from a throwaway provider.
`company.industry`Write to the lead's industry field for views and reports.

Limits to plan for

  • Workflow automation and webhooks are not on every Insightly plan; check your plan before building this.
  • Insightly tries a webhook delivery three times in total and then stops, so a scheduled re-check for leads with an empty Email Status is a good backstop.
  • pingutil allows 300 verified addresses a day (3,000 a month) per account; large imports should be verified in batches of 50 before they are loaded. Those are Free plan limits; Enterprise has custom limits.

Insightly documentation

Insightly is a trademark of its owner. This integration uses Insightly's documented extension points; it is not an official Insightly app.

Common questions

Why not let the webhook call pingutil directly?
Insightly's webhook action posts the record's fields to a URL with Basic authentication, while pingutil expects a Bearer key and a specific JSON body, and its answer has to be written back to the lead. A small service handles both.
Does a PUT overwrite the rest of the lead?
Insightly's API documentation says PUT requests do not require all fields, so sending the lead id and the custom fields updates only those values.

Stop bad addresses in Insightly today

Sign in with your email, create an API key and paste it into the step above. Test on a few real addresses first: the live demo shows exactly what your Insightly setup will receive.