Phase 2 part 3: buying signals, the funnel and the scorecard
Schema 7 adds signals (hypothesis, how to spot it, angle, status, utm slug), funnel_events (stage, channel, subject, campaign, source, deduped by external ID) and outside_campaigns. Prospects -> Signals is the scorecard: each signal's funnel from found to paid, people once per stage, with revenue and outside spend, by period and channel. Each signal's page shows its funnel by channel, its campaigns and its latest steps. Prospects carry a signal (filter, change, "found" recorded) and outcomes can be recorded by hand. Settings -> Lead sources holds origami.chat and explee.com API keys. Every 6 hours (or Import now) Supermarket reads their campaigns, numbers and spend, contacted people, replies and hot leads, read-only: interested people and repliers become prospects, unsubscribes are suppressed, and each campaign is assigned to a signal. The explee.com client follows its OpenAPI schema; origami.chat's responses are undocumented, so its client reads fields loosely and its Test shows the real response. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -220,6 +220,60 @@ CREATE TABLE suppressions (
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
||||
PRIMARY KEY (kind, value)
|
||||
);
|
||||
`,
|
||||
// 7: buying signals and the funnel. A signal is a hypothesis about why a
|
||||
// company buys now; everything Supermarket and the outside tools do is
|
||||
// tagged with one, and every step through the funnel is an event.
|
||||
`
|
||||
CREATE TABLE signals (
|
||||
id INTEGER PRIMARY KEY,
|
||||
slug TEXT NOT NULL UNIQUE, -- used as utm_campaign
|
||||
name TEXT NOT NULL,
|
||||
hypothesis TEXT NOT NULL DEFAULT '',
|
||||
spot TEXT NOT NULL DEFAULT '', -- how to find it: queries, keywords, one per line
|
||||
angle TEXT NOT NULL DEFAULT '', -- the pain and promise for messages and content
|
||||
status TEXT NOT NULL DEFAULT 'idea', -- idea, testing, proven, retired
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
|
||||
);
|
||||
|
||||
ALTER TABLE prospect_companies ADD COLUMN signal_id INTEGER REFERENCES signals (id) ON DELETE SET NULL;
|
||||
ALTER TABLE prospect_contacts ADD COLUMN signal_id INTEGER REFERENCES signals (id) ON DELETE SET NULL;
|
||||
|
||||
-- Campaigns in outside tools (origami.chat, explee.com), each assigned to a
|
||||
-- signal by the user.
|
||||
CREATE TABLE outside_campaigns (
|
||||
source TEXT NOT NULL, -- origami, explee
|
||||
id TEXT NOT NULL,
|
||||
name TEXT NOT NULL DEFAULT '',
|
||||
status TEXT NOT NULL DEFAULT '',
|
||||
signal_id INTEGER REFERENCES signals (id) ON DELETE SET NULL,
|
||||
spend_cents INTEGER NOT NULL DEFAULT 0, -- lifetime, as the tool reports it
|
||||
stats TEXT NOT NULL DEFAULT '{}', -- JSON: the tool's own numbers
|
||||
synced_at TEXT NOT NULL,
|
||||
PRIMARY KEY (source, id)
|
||||
);
|
||||
|
||||
-- One row per step someone (or a group, for counts) took through the funnel.
|
||||
CREATE TABLE funnel_events (
|
||||
id INTEGER PRIMARY KEY,
|
||||
signal_id INTEGER REFERENCES signals (id) ON DELETE SET NULL,
|
||||
stage TEXT NOT NULL, -- found, contacted, replied, interested, booked, visited, signed_up, paid
|
||||
channel TEXT NOT NULL, -- email, linkedin, social, blog, website, origami, explee, other
|
||||
subject TEXT NOT NULL DEFAULT '', -- who: contact:12, company:3, explee:<person>…
|
||||
email TEXT NOT NULL DEFAULT '' COLLATE NOCASE, -- to tie it to the CRM and Stripe later
|
||||
campaign TEXT NOT NULL DEFAULT '', -- origami:<id>, explee:<id>; its signal is set there
|
||||
source TEXT NOT NULL, -- supermarket, manual, origami, explee
|
||||
external_id TEXT NOT NULL DEFAULT '', -- dedupes imports
|
||||
count INTEGER NOT NULL DEFAULT 1, -- for aggregate numbers (visits)
|
||||
value_cents INTEGER NOT NULL DEFAULT 0, -- for paid
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
at TEXT NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX funnel_events_external ON funnel_events (source, external_id) WHERE external_id != '';
|
||||
CREATE INDEX funnel_events_by_signal ON funnel_events (signal_id, stage, at);
|
||||
CREATE INDEX funnel_events_by_subject ON funnel_events (subject);
|
||||
CREATE INDEX funnel_events_by_campaign ON funnel_events (campaign);
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user