Zombie build translators
Skill Zombie-Brains/zombie-brains/skills/zombie-build-translators
Build webhook + inbound-events translators that turn arbitrary upstream payloads into Zombie Brains' canonical ingest shape. Use when wiring up a third-party data source — Fathom webhooks, Mailgun inbound, GitHub PR events, a custom HTTP endpoint, Slack reactions, anything that POSTs to ZB — and you need to author the V8/Pyodide translator function. Also use when picking between an MCP relay (upstream tooling), a webhook connector (event-driven push), or a legacy inbound-events route. Covers translator_code shape, env.* surface, signature schemes, the test_translator workflow, and event_timestamp threading.From its SKILL.md
npx -y skills add Zombie-Brains/zombie-brains --skill zombie-build-translatorsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
17.2 KB, as published. Nobody here has run it
Zombie Build Translators — Inbound Payload to Canonical Documents
A translator is a tiny V8 (or Pyodide) function ZB runs every time an external system POSTs an event to it. Its job: read the upstream payload, decide whether to ingest, and return {documents: [...]} (or {drop: true}). That's it. ZB does the rest — signature check, ingest, dedup, routing, alerts.
Three connector types — pick before you write code
Don't conflate these. They look similar from a distance but solve different problems:
-
MCP relay —
manage(register_mcp_relay). Wraps an upstream MCP server (Apify, Fathom MCP, HubSpot MCP) so YOUR agents can call ITS tools asenv.mcp.<slug>.<tool>(args). This is for outbound tooling: you reach out and pull. There is no translator. There is no inbound HTTP endpoint. Use this when the upstream has an MCP server and you want agents to drive it. -
Webhook connector —
manage(create_webhook_connector). Mints a public URL athttps://mcp.zombie.codes/v1/webhook/<slug>(the actual base comes fromPUBLIC_BASE_URL/MCP_BASE_URL; the create response returns the fullingest_urlfield — copy that, don't construct it manually). The upstream POSTs to it. Your translator runs against the payload and emits documents. Use this for event-driven push: Fathom recording.completed, GitHub PR opened, Slack reaction added, a CRM contact created. This is what you almost always want for inbound data. -
Inbound event source (legacy) —
manage(register_inbound_event_source)+manage(create_inbound_event_route). Older path; the source owns receiving identity (a generated email address or HTTP endpoint), routes own translation + destination. Still in use for email-ingest patterns where multiple routes fan out from one address. For new work prefer webhook connectors — they're the actively maintained surface. The translator shape is similar but route configs carrydestination_kind/destination_refand the action set is parallel-but-different.
If the user just said "I want to ingest Fathom transcripts," they want a webhook connector. That's the rest of this doc unless explicitly noted.
The translator shape
The runtime executes a V8 sandbox (translator_runtime: 'v8', ~30ms cold) or a Pyodide sandbox ('python', ~1.5s cold). Default to v8 — pick python only if you genuinely need a Python library.
// translator_code (v8)
async (args, env) => {
// args = { body, raw_body, headers, query }
// body = parsed JSON, or null if upstream sent non-JSON
// env.* = dataset, datastore, tool, mcp, zombie, helpers (see below)
if (!args.body) return { drop: true, drop_reason: "non-JSON payload" };
return {
documents: [{
content: "...the memory body...",
source_id: "fathom:recording:abc123", // dedup key
source_channel: "Sales Calls", // optional attribution
source_user: args.body.host?.email, // optional attribution
metadata: { duration_min: args.body.duration_minutes, ... },
event_timestamp: args.body.started_at, // LOAD-BEARING — see below
// target_brain_id: "..." // optional hard route override
// type: "transcript" // matches output route filters
// tags: ["sales"] // matches output route filters
}]
};
};
# translator_code (python)
def main(args, env):
if not args.get("body"):
return {"drop": True, "drop_reason": "non-JSON payload"}
return {"documents": [{
"content": "...",
"source_id": "...",
"event_timestamp": args["body"]["started_at"],
}]}
Return {drop: true, drop_reason: "..."} to silently skip — no document, no ingest, no error. Useful for filtering out recording.started when you only care about recording.completed.
Document shape — per-document field reference
Every entry in documents[] ingests into memories. Fields:
- content (required, non-empty string) — the memory body. This is what
search_memoryreturns and what agents read. - source_id — dedup key. ZB upserts on
(connector_id, source_id)so re-deliveries don't double-ingest. Always set this when the upstream has any stable identifier (recording id, message id, PR number). - source_channel / source_user — attribution strings shown in the UI and queryable in search filters.
- metadata — arbitrary JSON. Use freely for upstream IDs, durations, link URLs, anything you'll want to filter on later.
- event_timestamp — see next section. Set this whenever possible.
- target_brain_id — hard route override. Skip the default brain for this specific document. Useful when one webhook handles events for many brains (e.g. multi-tenant SaaS).
- type + tags — used by output route filters. One source can fan out:
type="contact"→ HubSpot Contacts destination,type="company"→ HubSpot Companies destination, etc.
event_timestamp — the field people forget that breaks everything
event_timestamp tells ZB when the event actually happened in the upstream system — the recording started, the email was sent, the message was posted, the calendar block began. It becomes memories.created_at.
Without it, threading reads the wrong order, Sherlock's pull cursor advances incorrectly, and "what happened recently" queries are wrong by minutes to days. ZB will fall back through a chain of canonical metadata keys:
event_timestamp
→ metadata.event_timestamp
→ metadata.meeting_date
→ metadata.internalDate
→ metadata.event_time
→ metadata.occurred_at
→ metadata.sent_at
→ metadata.finishedAt
→ metadata.start.dateTime
→ metadata.date
→ metadata.recorded_at
→ ingestion time (last resort)
The fallbacks help when you forget. Don't rely on them — set event_timestamp explicitly at the top level whenever the upstream gives you a usable timestamp. Accepts ISO-8601 string ("2026-05-07T14:32:11Z") or ms-epoch number (1714000000000). Seconds-epoch also tolerated (auto-disambiguated at the 1e12 boundary). Out-of-bounds values (pre-2000 or more than 24h in the future) are rejected as parse errors.
env.* surface inside translators
After PR #202 (webhook) and PR #204 (inbound-events), translators get the same env. surface as serverless tools*:
env.dataset.<slug>.<table>.<op>(args)— workspace-scoped datasets. Use this for dedup-against-existing-tables, lookups, enrichments. Seezombie-build-datasets.env.datastore.<name>.<op>(args)— brain-scoped data, Phase 1 (still works, shim resolves to dataset).env.tool.<sibling>(args)— invoke another serverless tool the owner has access to.env.mcp.<slug>.<tool>(args)— third-party MCP relay. Gated bytranslator_mcp_dependencies(see below).env.zombie.<native_tool>(args)— platform-native tools (search_memory,brain_overview, etc.). Gated by the connector owner'stool_permissions.env.helpers— shared utility belt for translator authors.
All env.* resolves against the connector owner's identity — not a per-event caller. There's no agent context inside a translator. If the owner doesn't have access to a brain, dataset, or MCP relay, neither does the translator. See zombie-build-tools for the full V8 sandbox semantics.
translator_mcp_dependencies — env.mcp opt-in
env.mcp defaults to empty. To use it from a translator, declare which MCP relays you need:
translator_mcp_dependencies: ["fathom", "hubspot"]
Same canonical-strip resolver as agent_tools.mcp_dependencies: dep "fathom" satisfies a connector slug like "fathom_nt5pyn". The connector owner must already have access to each listed relay (via role_connectors or direct ownership), or the binding setup rejects the run.
Use this when the translator needs to call out (e.g. enrich a webhook payload by calling the HubSpot MCP to look up contact details). Most translators don't need it — keep the dependency list empty and let downstream output routes or routines do enrichment.
Signature schemes
Three options on signature_scheme:
none— no signature check. The URL itself is the secret. NOT recommended for production — anyone who guesses the slug can post events.hmac_sha256— generic HMAC-SHA256 of the raw body, hex-encoded inX-Signature(orX-Hub-Signature-256: sha256=<hex>GitHub-style). Most "roll your own" webhook senders use this.standard_webhooks— the standardwebhooks.com scheme:webhook-id/webhook-timestamp/webhook-signatureheaders + 5-minute replay window. Fathom, Resend, Svix, and Stripe-via-Svix all use this. If the upstream's docs mention "Standard Webhooks" or you seewhsec_<base64>secrets, this is the scheme.
Pass the secret as webhook_secret (plaintext, encrypted at rest server-side) or webhook_secret_var (variable name → ZB generates an inline secure link the user opens to paste the secret — preferred when the secret isn't yours to know). Don't pass both.
Webhook connector lifecycle
create_webhook_connector → draft (logs payloads, no translation/ingest)
↓
get_webhook_samples (read real shapes that came in during draft)
↓
write translator
↓
update_webhook_config (translator_code, ...)
↓
add_webhook_test_fixture (capture a real sample)
↓
test_webhook_translator (dry-run; must pass)
↓
activate_webhook_connector → active (signature check + translate + ingest)
↓ (later, if needed)
pause_webhook_connector → paused (rejects with 503)
↓
activate_webhook_connector → active again
Hard rules enforced by activate_webhook_connector preflight:
translator_codenon-emptysignature_scheme != 'none'⇒ secret must be set- Default brain set
- At least one fixture must have passed test_webhook_translator since the last config change. Edit the translator? You re-test. No exceptions.
Capturing samples + test fixtures
Don't guess the upstream payload shape. Capture real samples first.
create_webhook_connector(name, brain_id, signature_scheme, webhook_secret_var?)→ connector is in draft. Give theingest_urlto the user, tell them to wire it into the upstream and trigger a real event.manage(list_webhook_events, {webhook_connector_id, webhook_event_filter: "draft"})to see what came in.manage(get_webhook_samples, {webhook_connector_id, limit: 5})returns distinct payload shapes (deduped by content hash) — so you see the variety without wading through 500 identicalrecording.completedevents.- Look at the shapes. Write the translator.
manage(update_webhook_config, {webhook_connector_id, translator_code: "..."}).manage(add_webhook_test_fixture, {webhook_connector_id, fixture_name: "fathom-recording-completed", fixture_raw_body: "...", fixture_expected_outcome: "ingest"}).manage(test_webhook_translator, {fixture_id})— dry-runs the translator against the captured payload. Returns pass/fail + first-document preview.- Iterate
update_webhook_config↔test_webhook_translatoruntil pass. Add fixtures for edge cases (event you want dropped, malformed body, etc.). manage(activate_webhook_connector)once you have a fresh pass against every fixture.
You are not done at activation. Tell the user to trigger a real upstream event and confirm it reached the brain end-to-end. Without that round-trip you have no proof the signature scheme, payload shape, or routing actually work in production.
Common gotchas
- The translator runs synchronously per inbound HTTP request. Upstream is blocked on your response. Keep it fast — under 1s ideally. Heavy enrichment (LLM calls, multi-step API hops) belongs in a routine or output route, not in the translator.
- Webhook translator timeout: 20s. Inbound-events translator timeout: 30s. Beyond that the run is killed and the event marks as
translator_status='error'. args.bodyisnullwhen upstream sends non-JSON. Always check. Otherwiseargs.body.foothrows and the whole event errors.event_timestampis load-bearing. Forget it and threading degrades. See the section above.webhook_translator_variablesis NOT encrypted. It's stored as plain JSON. Use it for non-secrets (default brain UUIDs, sender allowlists, feature flags). Use thevariablestable (with a permission set) for actual credentials.- Don't include credentials in
translator_codeeither. Translator code is stored as plain text inconnectors.translator_code. Anyone with read access on the connector sees it. - The inbound-events path is separate plumbing. env.* parity exists but action names differ and route configs carry
destination_kind/destination_ref. Don't mix them with webhook connector actions. - Translators have no
accept-step. They can't async-pause and resume. If you need that pattern (capture, ask user to confirm, then ingest), use a webhook connector that ingests the raw payload to a holding brain + a routine that promotes after approval.
Examples
1) Simple Fathom recording translator
async (args, env) => {
const body = args.body;
if (!body || body.event !== "recording.completed") {
return { drop: true, drop_reason: `event=${body?.event}` };
}
const rec = body.data;
const transcript = (rec.transcript || []).map(t => `${t.speaker}: ${t.text}`).join("\n");
return {
documents: [{
content: `# ${rec.title}\n\n${transcript}`,
source_id: `fathom:recording:${rec.id}`,
source_channel: rec.calendar_event?.title || "Fathom call",
source_user: rec.host?.email,
metadata: {
recording_url: rec.share_url,
duration_min: rec.duration_minutes,
participants: (rec.invitees || []).map(i => i.email),
},
event_timestamp: rec.started_at, // critical
tags: ["fathom", "call"],
}],
};
};
2) Drop everything except finished GitHub PRs
async (args, env) => {
const body = args.body;
if (!body) return { drop: true, drop_reason: "non-JSON" };
// Header tells us the GitHub event type
const ghEvent = args.headers["x-github-event"];
if (ghEvent !== "pull_request") {
return { drop: true, drop_reason: `x-github-event=${ghEvent}` };
}
if (body.action !== "closed" || !body.pull_request.merged) {
return { drop: true, drop_reason: `action=${body.action} merged=${body.pull_request?.merged}` };
}
const pr = body.pull_request;
return {
documents: [{
content: `PR #${pr.number}: ${pr.title}\n\n${pr.body || ""}\n\n${pr.html_url}`,
source_id: `github:pr:${body.repository.full_name}:${pr.number}`,
source_channel: body.repository.full_name,
source_user: pr.user.login,
metadata: { additions: pr.additions, deletions: pr.deletions, labels: pr.labels.map(l => l.name) },
event_timestamp: pr.merged_at,
tags: ["github", "pr-merged"],
}],
};
};
3) Dedup against an existing dataset before emitting
async (args, env) => {
const body = args.body;
if (!body?.contact?.email) return { drop: true, drop_reason: "no email" };
// Check the crm.contacts dataset — already seen this email?
const existing = await env.dataset.crm.contacts.get(body.contact.email.toLowerCase());
if (existing) {
return { drop: true, drop_reason: `already in crm.contacts: ${existing.id}` };
}
// Insert into the dataset for future dedup, then emit the memory.
await env.dataset.crm.contacts.insert([{
id: body.contact.email.toLowerCase(),
name: body.contact.name,
source: "webhook",
inserted_at: new Date().toISOString(),
}]);
return {
documents: [{
content: `New contact: ${body.contact.name} <${body.contact.email}>\n\nCompany: ${body.contact.company || "?"}`,
source_id: `contact:${body.contact.email.toLowerCase()}`,
source_channel: "Contact intake",
source_user: body.contact.email,
metadata: { company: body.contact.company, source_form: body.form_name },
event_timestamp: body.submitted_at,
type: "contact", // routes can fan this to a CRM-sync destination
}],
};
};
Cross-references
zombie-build-tools— full V8 sandbox surface (env.dataset / env.datastore / env.tool / env.mcp / env.zombie / env.helpers). Translators get the same surface; everything documented there applies insidetranslator_code.zombie-build-datasets— the dataset/datastore API translators can use for dedup, lookups, enrichment.zombie-build-routines— for post-ingest processing (heavy enrichment, multi-step workflows, scheduled summaries). If the translator can't finish in <1s, the work belongs in a routine triggered by the resulting memory, not in the translator itself.