Automation

Lead forwarding

A forwarding rule POSTs each new lead to an https endpoint you choose: your API, Zapier, Make or a CRM webhook. Create rules in the dashboard, with npx @1db/cli forwarding add, or through the agent API and MCP (routing scope).

Destination profiles

A profile decides the shape of the payload a rule sends.

  • generic: 1DB's own lead shape (below). Values are sent as captured, with light clean-up of email, phone and name casing. Use it for anything you build or configure yourself.
  • repackify: translates the lead into Repackify's lead API. Use it only when the endpoint is Repackify's.

When you create a rule without a profile, 1DB picks one by the endpoint's host: repackify.com gets repackify, everything else gets generic. Rules created before profiles existed count as repackify, since that is what they always sent. Change it any time with --profile generic|repackify (CLI) or the profile field.

bash
npx @1db/cli forwarding add --name "Our API" --endpoint https://api.acme.com/leads \
  --auth-token ... --profile generic --enable
npx @1db/cli forwarding            # lists rules with their profile

The generic payload

Empty values are left out. New fields may be added; existing ones are not renamed.

generic-payload.json
{
  "externalId": "...", "source": "1db", "submittedAt": "2026-03-11T12:34:56.000Z",
  "email": "jane@acme.com", "phone": "...", "firstName": "Jane", "lastName": "Doe",
  "company": "Acme", "message": "...",
  "leadType": "buy", "productType": "pallets", "quantity": "40",
  "location": { "city": "", "state": "", "postalCode": "", "country": "" },
  "page": { "path": "", "landingPage": "", "referrer": "" },
  "attribution": {
    "utmSource": "", "utmMedium": "", "utmCampaign": "", "utmTerm": "", "utmContent": "",
    "gclid": "", "fbclid": "", "msclkid": ""
  },
  "visitor": { "ip": "", "userAgent": "" },
  "website": { "domain": "acme.com", "slug": "acme" },
  "form": { "slug": "acme-quote-request", "name": "Quote request" },
  "fields": { "...every submitted field, as submitted": "" }
}

leadType and productType use the lead's own value, else the form's default, else (product type only) the website's default. location is what the visitor typed, else GeoIP, never a mix. source is the rule's source identifier (default 1db).

Form templates

Start a form from a template instead of listing fields. The name defaults to the template's name; explicit fields or defaults override it.

TemplateForDefault lead type
quote-requestContact details, company, product, quantity, location, messagebuy
pickup-requestContact details, what you need, product, quantity, condition, location, messagesell
contactContact details, what you need, messagenone
bash
npx @1db/cli form acme.com --template quote-request --product-type pallets
# or: POST /v1/agent/forms { "website": "acme.com", "template": "quote-request" }

The product_type field comes back as a select listing the website's product types, so visitors pick from what the site offers.

Form defaults

A form can carry a default lead type and a default product type for leads that arrive without one (a fixed-purpose form that has no picker, for example).

bash
npx @1db/cli form-edit acme-quote-request --product-type pallets --lead-type buy
npx @1db/cli form-edit acme-quote-request --lead-type ""   # clear a default

The value used for a lead, first match wins:

  1. The visitor's own value.
  2. The form's default.
  3. The website's default product type (1db site acme.com --product-type pallets); lead type has no website-level default.

GET /v1/agent/forwarding (and 1db forwarding) warns about forms whose leads would arrive without a product type, but only while a repackify-profile rule is enabled, since that destination requires one.

Destination product lists

A destination that publishes the product types it accepts is read once a day, so nobody keeps a copy by hand. Today that is the repackify profile, which reads Repackify's /api/leads/schema. The list is only used to decide what to send and to warn: 1db forwarding reports website products the destination doesn't accept (those leads go out as the default product type), and a list that couldn't be read.

New organizations start with no product types of their own. Add the ones you sell, or copy a destination's list into your organization once:

bash
npx @1db/cli product-types add "Plastic pallets"
npx @1db/cli product-types import <forwarding rule id>   # adds the ones you don't have yet