Customer support
Show email verification in the Help Scout sidebar
Show each customer's email verification status beside Help Scout conversations with a dynamic custom app: a signed request, a cached check, an HTML answer.
Updated 2026-11-26
This recipe adds a panel to the Help Scout sidebar that shows, beside each conversation, whether the customer's email address can receive mail, whether it is a disposable inbox, and a probable correction when the domain looks like a typo. Agents see it before they reply, so a reply to a dead address is not left to bounce unnoticed. There is no native Qelka app for Help Scout: this is a dynamic custom app, where Help Scout posts the conversation's data to a small handler of yours and renders the HTML it returns.
What you need
- A Help Scout account where you can create custom apps, as an administrator or account owner. Custom apps may depend on your plan, as far as we know: check yours.
- A secret key for the app: a random string of 40 characters or fewer, which you generate. Help Scout uses it to sign every request.
- A Qelka API key. A
sk_test_key returns simulated results and never spends credits: see Test mode. A restricted key limited toemailis enough. - A place to run the handler that receives a web
Requestover HTTPS: Cloudflare Workers or Vercel below, or any server through a framework such as Hono.
Steps
1. The handler
Save as helpscout-app.js:
const encoder = new TextEncoder()
const keepDays = 30
const memory = new Map()
function safeEqual(a, b) {
if (a.length !== b.length) return false
let difference = 0
for (let index = 0; index < a.length; index += 1) difference |= a.charCodeAt(index) ^ b.charCodeAt(index)
return difference === 0
}
async function signatureIsValid(env, rawBody, signature) {
const key = await crypto.subtle.importKey('raw', encoder.encode(env.HELPSCOUT_SECRET), { name: 'HMAC', hash: 'SHA-1' }, false, ['sign'])
const digest = new Uint8Array(await crypto.subtle.sign('HMAC', key, encoder.encode(rawBody)))
return safeEqual(btoa(String.fromCharCode(...digest)), signature)
}
const escapeHtml = (text) =>
String(text).replace(/[&<>"']/g, (character) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[character])
async function recall(env, email) {
if (env.RESULTS) return env.RESULTS.get(`email:${email}`, 'json')
const entry = memory.get(email)
return entry && entry.expires > Date.now() ? entry.result : null
}
async function remember(env, email, result) {
if (env.RESULTS) return env.RESULTS.put(`email:${email}`, JSON.stringify(result), { expirationTtl: keepDays * 86400 })
memory.set(email, { result, expires: Date.now() + keepDays * 86400 * 1000 })
}
async function verify(env, email) {
try {
const response = await fetch('https://api.qelka.com/v1/email', {
method: 'POST',
headers: { Authorization: `Bearer ${env.QELKA_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ email, mode: 'fast' }),
signal: AbortSignal.timeout(5000),
})
if (response.ok) return response.json()
const failure = await response.json().catch(() => ({}))
console.warn(`check skipped: ${failure.error?.type ?? response.status} request ${response.headers.get('X-Request-Id')}`)
} catch (error) {
console.warn(`check skipped: unreachable (${error.name})`)
}
return null
}
const labels = {
deliverable: 'Deliverable',
undeliverable: 'Undeliverable: replies will bounce',
risky: 'Risky',
unknown: 'Not conclusive',
}
function render(email, result) {
if (!result) return `<p class="muted">${escapeHtml(email)}: not checked right now.</p>`
const lines = [`<h4>${escapeHtml(labels[result.status] ?? result.status)}</h4>`, `<p class="muted">${escapeHtml(email)}</p>`, '<ul>']
if (result.reason === 'disposable') lines.push('<li>Disposable inbox</li>')
if (result.reason === 'catch_all') lines.push('<li>The domain accepts every address</li>')
if (result.checks?.role) lines.push('<li>Role address, not a person</li>')
if (result.did_you_mean) lines.push(`<li>Did the customer mean ${escapeHtml(result.did_you_mean)}?</li>`)
lines.push(`<li>Reason: ${escapeHtml(result.reason)}</li>`, '</ul>')
return lines.join('')
}
export async function handle(request, env) {
if (request.method !== 'POST') return new Response(null, { status: 405 })
const rawBody = await request.text()
if (!(await signatureIsValid(env, rawBody, request.headers.get('X-HelpScout-Signature') ?? ''))) {
return new Response(null, { status: 401 })
}
const { customer } = JSON.parse(rawBody)
const email = (customer?.email ?? customer?.emails?.find((value) => typeof value === 'string'))?.trim().toLowerCase()
if (!email) return Response.json({ html: '<p class="muted">No email address for this customer.</p>' })
let result = await recall(env, email)
if (!result) {
result = await verify(env, email)
if (result) await remember(env, email, { status: result.status, reason: result.reason, did_you_mean: result.did_you_mean, checks: { role: result.checks.role } })
}
return Response.json({ html: render(email, result) })
}
Help Scout posts a JSON body with ticket, customer, user and mailbox when an agent opens a conversation, and signs it like its webhooks: an HMAC-SHA1 of the raw body with your secret key, base64-encoded in the X-HelpScout-Signature header. The handler checks it before parsing. The answer must be valid JSON with an html key; every value from the request or the API is escaped before it goes into the HTML.
The agent is waiting for the panel, so the call uses mode: 'fast' with a 5-second timeout: it runs the syntax, DNS, disposable and role checks and skips the mailbox check, which depends on a mail server you do not control. Fast mode never answers deliverable; when everything passes, the status is unknown with the reason smtp_not_checked, shown here as "Not conclusive". See the email reference.
The cache matters: Help Scout calls the app every time the conversation is opened, and the API bills a cached answer like a fresh one. With a Workers KV namespace bound as RESULTS, each address is checked once per 30 days across all instances; without it, the in-memory map only lasts as long as the instance. Failed checks are not cached, so the next view tries again.
2. Deploy it with its secrets
import { handle } from './helpscout-app.js'
export default {
fetch: (request, env) => handle(request, env),
}
import { handle } from '../helpscout-app.js'
export default {
fetch: (request) => handle(request, process.env),
}
On Vercel the entry file is api/helpscout.js, with "type": "module" in package.json. Store QELKA_API_KEY and HELPSCOUT_SECRET as secrets (wrangler secret put or vercel env add). On Cloudflare, create a KV namespace and bind it as RESULTS in your Wrangler configuration. On other hosts, replace recall and remember with your database or cache.
3. Create the custom app
Open the page that creates legacy custom apps, linked from Help Scout's Legacy Dynamic Apps documentation. Choose dynamic content, then enter the handler's HTTPS URL as the callback URL, your secret key, and the inboxes where the panel should appear. Help Scout does not follow server redirects outside debug mode, so use the final URL of the handler.
4. Test it
With a sk_test_ key, open a conversation in one of the app's inboxes whose customer has the email disposable@example.com, for example one you start from Help Scout for that address. The panel shows "Risky" and "Disposable inbox". In fast mode, nomx@example.com shows "Undeliverable" and other well-formed addresses "Not conclusive". Then swap in a live key.
5. Read the panel
| Panel | Meaning | What the agent does |
|---|---|---|
| Undeliverable | Bad syntax, no domain or no mail server | Check the suggested correction, or reach the customer another way before replying |
| Risky, disposable inbox | The address belongs to a disposable email service | Follow your policy for refunds, trials or account changes |
| Risky, the domain accepts every address | A catch-all domain: the mailbox cannot be confirmed | Reply normally |
| Not conclusive | Fast mode passed every check, or no conclusion | Reply normally |
| Not checked right now | The API was unreachable or refused the call | Reply normally; the next view tries again |
An unknown email is not a bad email, and the panel never blocks anything: it informs the agent. See Block disposable email signups for why disposable addresses matter where accounts and refunds are involved.
Handle errors and rate limits
Every failure renders "not checked right now" and is logged with the error type and the X-Request-Id. The handler does not retry, because the agent is waiting; the next view checks again. No error is billed. 401 and 403 mean a wrong or restricted key and 402 an empty balance: watch the logs for them. A key allows 200 requests per 10 seconds, and the cache keeps repeated views of the same customer from counting. Each email check costs 1 credit. See Errors, Rate limits and Caching.
A 401 from the handler means the secret key in Help Scout and HELPSCOUT_SECRET differ.
Related
Frequently asked questions
Does every conversation view cost a credit?
Dynamic custom apps are marked legacy. Should I still use one?
Why only the email and not the phone number?
More in Customer support
All integrationsPut this check in your product
Get an API key in under a minute. 100 free credits every month, no card required.
- 100 free credits a month
- No card
- Test keys spend nothing
- Cancel any time