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:
2026-11-21 18:06:58 -07:00
co-authored by Claude Opus 5.5
parent ee579ec9f4
commit b025a97e4a
27 changed files with 3031 additions and 53 deletions
+3 -1
View File
@@ -40,6 +40,7 @@
{{end}}
{{if eq .ID "prospects"}}
<div class="subnav">
<a href="/signals" {{if eq $nav "prospects/signals"}}aria-current="page"{{end}}>Signals</a>
<a href="/prospects" {{if eq $nav "prospects/review"}}aria-current="page"{{end}}>Review{{with $.NewProspects}} <span class="count-badge" title="{{.}} waiting for review">{{.}}</span>{{end}}</a>
<a href="/prospects/suppressed" {{if eq $nav "prospects/suppressed"}}aria-current="page"{{end}}>Suppression list</a>
<a href="/crm" {{if eq $nav "prospects/crm"}}aria-current="page"{{end}}>CRM queue</a>
@@ -81,7 +82,7 @@
{{define "settings-start"}}
<div class="page-head">
<h1>Settings</h1>
<p class="lede">Your company, the accounts Supermarket posts with, the AI it writes with, and your Federated Core.</p>
<p class="lede">Your company, the accounts Supermarket posts with, the prospecting tools it reads, the AI it writes with, and your Federated Core.</p>
</div>
<div class="settings">
<nav class="settings-nav" aria-label="Settings sections">
@@ -90,6 +91,7 @@
<div class="nav-label">Connections</div>
<a href="/settings/accounts" {{if eq .Nav "settings/accounts"}}aria-current="page"{{end}}>{{template "icon" "accounts"}}Social accounts</a>
<a href="/settings/core" {{if eq .Nav "settings/core"}}aria-current="page"{{end}}>{{template "icon" "core"}}Core &amp; Hermes</a>
<a href="/settings/sources" {{if eq .Nav "settings/sources"}}aria-current="page"{{end}}>{{template "icon" "prospects"}}Lead sources</a>
<div class="nav-label">AI</div>
<a href="/settings/ai" {{if eq .Nav "settings/ai"}}aria-current="page"{{end}}>{{template "icon" "ai"}}AI</a>
</nav>
+9
View File
@@ -25,6 +25,15 @@
<label>Phone <input name="phone" value="{{.Contact.Phone}}"></label>
<label>LinkedIn profile <input name="linkedin" value="{{.Contact.LinkedIn}}" placeholder="https://www.linkedin.com/in/…"></label>
</div>
{{if .Signals}}{{$cur := .Company.SignalID}}
<label>Buying signal
<select name="signal">
<option value="0">none</option>
{{range .Signals}}<option value="{{.ID}}" {{if eq .ID $cur}}selected{{end}}>{{.Name}}</option>{{end}}
</select>
<span class="help">The signal you found them through{{if $.Data.For}}. Leave it at none to use the company's{{end}}.</span>
</label>
{{end}}
<label>Where you found them <input name="source_detail" value="{{.Contact.SourceDetail}}" placeholder="A link, an event, a referral…">
<span class="help">Kept with the prospect and written into the CRM record, so you can always say where a contact came from.</span></label>
<div class="actions">
+70 -18
View File
@@ -1,14 +1,27 @@
{{define "content"}}{{with .Data}}{{$tab := .Tab}}{{$matches := .Matches}}
{{define "content"}}{{with .Data}}{{$tab := .Tab}}{{$matches := .Matches}}{{$d := .}}
<div class="heading">
<h1>Review prospects</h1>
<div class="buttons">
<a class="button" href="/prospects/new">Add a prospect</a>
<a class="button" href="/prospects/new{{if .Signal}}?signal={{.Signal}}{{end}}">Add a prospect</a>
</div>
</div>
<p class="lede">Companies and people who may fit your targets. Nothing goes to your CRM until you accept it: accepting a company adds an Account, accepting a person adds a Lead, through <a href="/crm">the CRM queue</a>. Each one keeps where and when it was found.</p>
{{if .Signals}}
<form method="get" action="/prospects" class="filters">
<input type="hidden" name="status" value="{{$tab}}">
<label class="small">Signal
<select name="signal" data-autosubmit>
<option value="0">All signals</option>
{{range .Signals}}<option value="{{.ID}}" {{if eq .ID $d.Signal}}selected{{end}}>{{.Name}}</option>{{end}}
</select>
</label>
<noscript><button type="submit" class="secondary small">Show</button></noscript>
</form>
{{end}}
<nav class="tabs">
{{range .Statuses}}<a href="/prospects?status={{.}}" {{if eq $tab .}}aria-current="page"{{end}}>{{if eq . "new"}}New{{else if eq . "accepted"}}Accepted{{else}}Set aside{{end}}{{with index $.Data.Counts .}} <span class="muted">{{.}}</span>{{end}}</a>{{end}}
{{range .Statuses}}<a href="/prospects?status={{.}}{{if $d.Signal}}&amp;signal={{$d.Signal}}{{end}}" {{if eq $tab .}}aria-current="page"{{end}}>{{if eq . "new"}}New{{else if eq . "accepted"}}Accepted{{else}}Set aside{{end}}{{with index $.Data.Counts .}} <span class="muted">{{.}}</span>{{end}}</a>{{end}}
</nav>
{{if and (eq $tab "new") (or .Companies .Loose)}}
@@ -29,25 +42,26 @@
{{if eq .Status $tab}}
<div class="row-actions">
{{if eq $tab "new"}}
{{if .Contacts}}<form method="post" action="/prospects/company/{{.ID}}/accept-all"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="small">Accept with {{len .Contacts}} {{if eq (len .Contacts) 1}}person{{else}}people{{end}}</button></form>{{end}}
<form method="post" action="/prospects/company/{{.ID}}/accept"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="small {{if .Contacts}}secondary{{end}}">Accept {{if .Contacts}}company only{{else}}company{{end}}</button></form>
<form method="post" action="/prospects/company/{{.ID}}/reject"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Set aside</button></form>
{{if .Domain}}<form method="post" action="/prospects/company/{{.ID}}/suppress" data-confirm="Never add anyone at {{.Domain}}? This puts the domain on your suppression list."><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Suppress {{.Domain}}</button></form>{{end}}
{{if .Contacts}}<form method="post" action="/prospects/company/{{.ID}}/accept-all"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="small">Accept with {{len .Contacts}} {{if eq (len .Contacts) 1}}person{{else}}people{{end}}</button></form>{{end}}
<form method="post" action="/prospects/company/{{.ID}}/accept"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="small {{if .Contacts}}secondary{{end}}">Accept {{if .Contacts}}company only{{else}}company{{end}}</button></form>
<form method="post" action="/prospects/company/{{.ID}}/reject"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="secondary small">Set aside</button></form>
{{if .Domain}}<form method="post" action="/prospects/company/{{.ID}}/suppress" data-confirm="Never add anyone at {{.Domain}}? This puts the domain on your suppression list."><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="secondary small">Suppress {{.Domain}}</button></form>{{end}}
{{else if eq $tab "accepted"}}
{{template "crm-state" dict "CRM" .CRM "Kind" "company" "ID" .ID "Tab" $tab}}
{{template "crm-state" dict "CRM" .CRM "Kind" "company" "ID" .ID "Tab" $tab "Filter" $d.Signal}}
{{else}}
<form method="post" action="/prospects/company/{{.ID}}/reconsider"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Reconsider</button></form>
<form method="post" action="/prospects/company/{{.ID}}/reconsider"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="secondary small">Reconsider</button></form>
{{end}}
</div>
{{end}}
</div>
{{with .Why}}<p class="why">{{.}}</p>{{end}}
<p class="meta">{{template "provenance" .}}</p>
{{template "signal-tag" dict "Kind" "company" "ID" .ID "SignalID" .SignalID "D" $d}}
{{with index $matches (printf "company:%d" .ID)}}{{template "crm-matches" .}}{{end}}
{{if .Contacts}}
<ul class="items people">
{{range .Contacts}}{{template "contact" dict "P" . "Tab" $tab "Matches" $matches}}{{end}}
{{range .Contacts}}{{template "contact" dict "P" . "Tab" $tab "Matches" $matches "D" $d}}{{end}}
</ul>
{{end}}
{{if eq $tab "new"}}<p class="small"><a href="/prospects/new?company={{.ID}}">Add a person at {{.Name}}</a></p>{{end}}
@@ -58,7 +72,7 @@
<section class="card prospect">
<h2>People without a company</h2>
<ul class="items people">
{{range .Loose}}{{template "contact" dict "P" . "Tab" $tab "Matches" $matches}}{{end}}
{{range .Loose}}{{template "contact" dict "P" . "Tab" $tab "Matches" $matches "D" $d}}{{end}}
</ul>
</section>
{{end}}
@@ -72,7 +86,7 @@
{{end}}
{{end}}{{end}}
{{define "contact"}}{{$p := .P}}{{$tab := .Tab}}
{{define "contact"}}{{$p := .P}}{{$tab := .Tab}}{{$d := .D}}
<li class="item">
<div class="prospect-head">
<div>
@@ -83,18 +97,20 @@
{{with $p.LinkedIn}} · <a href="{{.}}" target="_blank" rel="noopener noreferrer">LinkedIn</a>{{end}}
</div>
<div class="meta">{{template "provenance" $p}}</div>
{{if not $p.CompanyID}}{{template "signal-tag" dict "Kind" "contact" "ID" $p.ID "SignalID" $p.SignalID "D" $d}}{{end}}
{{with index .Matches (printf "contact:%d" $p.ID)}}{{template "crm-matches" .}}{{end}}
{{template "outcomes" dict "Kind" "contact" "ID" $p.ID "Tab" $tab "D" $d}}
</div>
{{if eq $p.Status $tab}}
<div class="row-actions">
{{if eq $tab "new"}}
<form method="post" action="/prospects/contact/{{$p.ID}}/accept"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="small">Accept</button></form>
<form method="post" action="/prospects/contact/{{$p.ID}}/reject"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Set aside</button></form>
{{if $p.Email}}<form method="post" action="/prospects/contact/{{$p.ID}}/suppress" data-confirm="Never add {{$p.Email}}? This puts the address on your suppression list."><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Suppress</button></form>{{end}}
<form method="post" action="/prospects/contact/{{$p.ID}}/accept"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="small">Accept</button></form>
<form method="post" action="/prospects/contact/{{$p.ID}}/reject"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="secondary small">Set aside</button></form>
{{if $p.Email}}<form method="post" action="/prospects/contact/{{$p.ID}}/suppress" data-confirm="Never add {{$p.Email}}? This puts the address on your suppression list."><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="secondary small">Suppress</button></form>{{end}}
{{else if eq $tab "accepted"}}
{{template "crm-state" dict "CRM" $p.CRM "Kind" "contact" "ID" $p.ID "Tab" $tab}}
{{template "crm-state" dict "CRM" $p.CRM "Kind" "contact" "ID" $p.ID "Tab" $tab "Filter" $d.Signal}}
{{else}}
<form method="post" action="/prospects/contact/{{$p.ID}}/reconsider"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Reconsider</button></form>
<form method="post" action="/prospects/contact/{{$p.ID}}/reconsider"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="secondary small">Reconsider</button></form>
{{end}}
</div>
{{end}}
@@ -114,8 +130,44 @@
{{if eq .CRM.Status "done"}}<span class="badge published">{{if eq .CRM.Outcome "existing"}}already in the CRM{{else}}in the CRM{{end}}</span>
{{else if eq .CRM.Status "failed"}}<span class="badge failed">failed</span> <a class="small" href="/crm">CRM queue</a>
{{else if eq .CRM.Status "cancelled"}}<span class="badge">cancelled</span>
<form method="post" action="/prospects/{{.Kind}}/{{.ID}}/accept"><input type="hidden" name="tab" value="{{.Tab}}"><button type="submit" class="secondary small">Queue again</button></form>
<form method="post" action="/prospects/{{.Kind}}/{{.ID}}/accept"><input type="hidden" name="tab" value="{{.Tab}}"><input type="hidden" name="filter" value="{{.Filter}}"><button type="submit" class="secondary small">Queue again</button></form>
{{else if eq .CRM.Status "claimed"}}<span class="badge scheduled">with Hermes</span>
{{else if .CRM.Status}}<span class="badge draft">waiting for Hermes</span>
{{else}}<span class="badge">accepted</span>{{end}}
{{end}}
{{define "signal-tag"}}{{$d := .D}}{{$cur := .SignalID}}
{{if $d.Signals}}
<form method="post" action="/prospects/{{.Kind}}/{{.ID}}/signal" class="signal-tag">
<input type="hidden" name="tab" value="{{$d.Tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}">
<label class="small">Signal
<select name="signal" data-autosubmit>
<option value="0">none</option>
{{range $d.Signals}}<option value="{{.ID}}" {{if eq .ID $cur}}selected{{end}}>{{.Name}}</option>{{end}}
</select>
</label>
<noscript><button type="submit" class="secondary small">Save</button></noscript>
</form>
{{end}}
{{end}}
{{define "outcomes"}}{{$d := .D}}{{$subject := printf "%s:%d" .Kind .ID}}
{{with index $d.Events $subject}}
<ol class="steps-done">
{{range .}}<li><span class="badge {{if eq .Stage "paid"}}published{{else}}draft{{end}}">{{stage .Stage}}</span> {{channel .Channel}} · {{ago .At}}{{if .ValueCents}} · {{money .ValueCents}}{{end}}{{with .Note}} · {{truncate 100 .}}{{end}}
{{if eq .Source "manual"}}<form method="post" action="/funnel/{{.ID}}/delete" class="inline" data-confirm="Remove this step?"><input type="hidden" name="back" value="{{$d.Back}}"><input type="hidden" name="tab" value="{{$d.Tab}}"><button type="submit" class="link small">remove</button></form>{{end}}</li>{{end}}
</ol>
{{end}}
<details class="outcome">
<summary class="small">Record an outcome</summary>
<form method="post" action="/prospects/{{.Kind}}/{{.ID}}/outcome" class="row wrap">
<input type="hidden" name="tab" value="{{.Tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}">
<label class="small">Step <select name="stage">{{range $d.Stages}}<option value="{{.ID}}">{{.Label}}</option>{{end}}</select></label>
<label class="small">Channel <select name="channel">{{range $d.Channels}}<option value="{{.ID}}">{{.Label}}</option>{{end}}</select></label>
<label class="small">Date <input type="date" name="date" value="{{$d.Today}}"></label>
<label class="small">Amount <input name="amount" inputmode="decimal" placeholder="for Paid, e.g. 70" size="8"></label>
<label class="small grow">Note <input name="note" placeholder="optional"></label>
<button type="submit" class="secondary small">Record</button>
</form>
</details>
{{end}}
+69
View File
@@ -0,0 +1,69 @@
{{define "content"}}{{with .Data}}{{$s := .S}}
<div class="heading">
<h1>{{if $s.ID}}{{$s.Name}} <span class="badge {{$s.Status}}">{{$s.Status}}</span>{{else}}New signal{{end}}</h1>
{{if $s.ID}}<div class="buttons">
<a class="button secondary" href="/prospects?status=new&amp;signal={{$s.ID}}">Its prospects{{if .Prospects}} ({{.Prospects}} new){{end}}</a>
<a class="button secondary" href="/prospects/new?signal={{$s.ID}}">Add a prospect for it</a>
</div>{{end}}
</div>
<p class="lede">A guess about why a company buys now, written so it can be tested: what you'll see, and what you expect them to do.</p>
{{if $s.ID}}
{{with .Total}}
<section class="card">
<h2>Funnel</h2>
<div class="funnel">
{{range .Cells}}<div class="step"><span class="label">{{stage .Stage}}</span><strong>{{.Count}}</strong>{{with .Rate}}<span class="rate">{{.}} of contacted</span>{{end}}</div>{{end}}
</div>
<p class="small">{{if .RevenueCents}}Revenue <strong>{{money .RevenueCents}}</strong>. {{end}}{{if .SpendCents}}Spend in outside tools <strong>{{money .SpendCents}}</strong>.{{end}}</p>
{{if $.Data.ByChannel}}
<table class="list scorecard">
<thead><tr><th>Channel</th>{{range $.Data.Stages}}<th class="num">{{.Label}}</th>{{end}}</tr></thead>
<tbody>{{range $.Data.ByChannel}}<tr><td>{{channel .Channel}}</td>{{range .Row.Cells}}<td class="num">{{if .Count}}{{.Count}}{{with .Rate}}<span class="rate">{{.}}</span>{{end}}{{else}}<span class="muted">·</span>{{end}}</td>{{end}}</tr>{{end}}</tbody>
</table>
{{else}}<p class="help">Nothing recorded for it yet: tag prospects with it, give it an origami.chat or explee.com campaign, or record outcomes in Review.</p>{{end}}
</section>
{{end}}
{{end}}
<form method="post" action="{{if $s.ID}}/signals/{{$s.ID}}{{else}}/signals/new{{end}}" class="card">
<div class="cols">
<label>Name <input name="name" value="{{$s.Name}}" required placeholder="Leaving Microsoft 365"></label>
<label>Status
<select name="status">{{range .Statuses}}<option value="{{.}}" {{if eq . $s.Status}}selected{{end}}>{{.}}</option>{{end}}</select>
<span class="help">Idea, testing, proven or retired. Retired signals stay on the scorecard for comparison.</span>
</label>
</div>
<label>Hypothesis <textarea name="hypothesis" rows="2" placeholder="Teams complaining about the Microsoft 365 price rise switch within a quarter.">{{$s.Hypothesis}}</textarea></label>
<label>How to spot it <textarea name="spot" rows="4" placeholder="One per line: search queries, keywords, origami.chat or explee.com criteria">{{$s.Spot}}</textarea>
<span class="help">Discovery (next) runs these as searches, so write them the way you'd search for the companies.</span></label>
<label>Angle <textarea name="angle" rows="3" placeholder="The pain, and what we promise about it">{{$s.Angle}}</textarea>
<span class="help">What emails, LinkedIn messages and content for this signal should say.</span></label>
<label>Campaign tag <input name="slug" value="{{$s.Slug}}" placeholder="made from the name">
<span class="help">Used as <code>utm_campaign</code> on links for this signal, so visits and sign-ups are counted against it. Change it before using it, not after.</span></label>
<div class="actions">
<button type="submit">Save</button>
<a href="/signals">Back to signals</a>
</div>
</form>
{{if $s.ID}}
{{if .Campaigns}}
<h2>Campaigns testing it</h2>
<ul class="items">{{range .Campaigns}}<li class="item"><strong>{{.Name}}</strong> <span class="muted small">{{if eq .Source "origami"}}origami.chat{{else}}explee.com{{end}}{{with .Status}} · {{.}}{{end}}</span>
<div class="small">{{range $k, $v := .Stats}}{{if $v}}<span class="stat">{{$k}}: <strong>{{$v}}</strong></span> {{end}}{{end}}</div></li>{{end}}</ul>
{{end}}
{{if .Events}}
<h2>Latest steps</h2>
<table class="list">
<thead><tr><th>When</th><th>Step</th><th>Channel</th><th>Who</th><th>Note</th></tr></thead>
<tbody>{{range .Events}}<tr><td>{{ago .At}}</td><td>{{stage .Stage}}{{if .ValueCents}} · {{money .ValueCents}}{{end}}{{if gt .Count 1}} · {{.Count}}{{end}}</td><td>{{channel .Channel}}</td><td class="small">{{or .Email .Subject}}</td><td class="small">{{truncate 120 .Note}}</td></tr>{{end}}</tbody>
</table>
{{end}}
<form method="post" action="/signals/{{$s.ID}}/delete" data-confirm="Delete “{{$s.Name}}”? Its prospects, campaigns and results stay, without a signal." class="danger-zone">
<button type="submit" class="secondary small">Delete this signal</button>
</form>
{{end}}
{{end}}{{end}}
+81
View File
@@ -0,0 +1,81 @@
{{define "content"}}{{with .Data}}{{$d := .}}
<div class="heading">
<h1>Signals</h1>
<div class="buttons"><a class="button" href="/signals/new">New signal</a></div>
</div>
<p class="lede">A buying signal is a guess about why a company buys now. Each one is tested through what's done for it, directly (email, LinkedIn) and indirectly (posts, pages), and in origami.chat and explee.com. Every step anyone takes through the funnel is counted here, so you can see which signals turn into replies, bookings, sign-ups and payments.</p>
<form method="get" action="/signals" class="filters">
<label class="small">Period
<select name="period" data-autosubmit>{{range .Periods}}<option value="{{.ID}}" {{if eq .ID $d.Period}}selected{{end}}>{{.Label}}</option>{{end}}</select>
</label>
<label class="small">Channel
<select name="channel" data-autosubmit><option value="">All channels</option>{{range .Channels}}<option value="{{.ID}}" {{if eq .ID $d.Channel}}selected{{end}}>{{.Label}}</option>{{end}}</select>
</label>
<noscript><button type="submit" class="secondary small">Show</button></noscript>
</form>
{{if .Rows}}
<div class="table-wrap">
<table class="list scorecard">
<thead><tr><th>Signal</th>{{range .Stages}}<th class="num">{{.Label}}</th>{{end}}<th class="num">Revenue</th><th class="num">Spend</th></tr></thead>
<tbody>
{{range .Rows}}
<tr>
<td>{{with .Signal}}<a href="/signals/{{.ID}}">{{.Name}}</a> <span class="badge {{.Status}}">{{.Status}}</span>{{else}}<span class="muted">No signal</span>{{end}}</td>
{{range .Cells}}<td class="num">{{if .Count}}{{.Count}}{{with .Rate}}<span class="rate">{{.}}</span>{{end}}{{else}}<span class="muted">·</span>{{end}}</td>{{end}}
<td class="num">{{if .RevenueCents}}{{money .RevenueCents}}{{else}}<span class="muted">·</span>{{end}}</td>
<td class="num">{{if .SpendCents}}{{money .SpendCents}}{{else}}<span class="muted">·</span>{{end}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<p class="help">People count once per stage, however many times they replied. Percentages are of those contacted. Visits are counted in total, not per person. Spend is what origami.chat and explee.com report for each signal's campaigns, all time. A signal moves to <em>proven</em> when you say so.</p>
{{else}}
<section class="card empty"><p>No signals yet. <a href="/signals/new">Write down the first one</a>: for example, “Teams complaining about the Microsoft 365 price rise switch within a quarter.”</p></section>
{{end}}
<h2 id="campaigns">Campaigns in origami.chat and explee.com</h2>
<p class="lede">Supermarket reads your campaigns, who they contacted, who replied, who was interested and who unsubscribed, every 6 hours. Give each campaign the signal it tests; its results count towards that signal. Interested people and people who replied show up in <a href="/prospects">Review</a>, and anyone who unsubscribed goes on the <a href="/prospects/suppressed">suppression list</a>.</p>
<div class="grid">
{{range .Sources}}
<section class="card">
<h3>{{.Name}}</h3>
{{if .Set}}
{{with .Last}}<p class="small">{{if .Error}}<span class="warn-text">Last import failed {{ago .At}}: {{.Error}}</span>{{else}}Imported {{ago .At}}: {{.Campaigns}} campaigns, {{.Events}} new steps, {{.Prospects}} new people to review, {{.Suppressed}} unsubscribed.{{end}}</p>
{{if .Warnings}}<details class="small"><summary>{{len .Warnings}} warnings</summary><ul>{{range .Warnings}}<li>{{.}}</li>{{end}}</ul></details>{{end}}
{{else}}<p class="small">Not imported yet.</p>{{end}}
<form method="post" action="/lead-sources/{{.ID}}/import" data-busy="Importing…"><button type="submit" class="secondary small">Import now</button></form>
{{else}}<p class="small">Not connected. Save its API key under <a href="/settings/sources">Settings → Lead sources</a>.</p>{{end}}
</section>
{{end}}
</div>
{{if .Campaigns}}
<table class="list">
<thead><tr><th>Campaign</th><th>Numbers</th><th class="num">Spend</th><th>Signal</th></tr></thead>
<tbody>
{{range .Campaigns}}
<tr>
<td><strong>{{.Name}}</strong><br><span class="muted small">{{if eq .Source "origami"}}origami.chat{{else}}explee.com{{end}}{{with .Status}} · {{.}}{{end}} · read {{ago .SyncedAt}}</span></td>
<td class="small">{{range $k, $v := .Stats}}{{if $v}}<span class="stat">{{$k}}: <strong>{{$v}}</strong></span> {{end}}{{end}}</td>
<td class="num">{{if .SpendCents}}{{money .SpendCents}}{{end}}</td>
<td>
<form method="post" action="/signals/campaigns" class="row">
<input type="hidden" name="source" value="{{.Source}}"><input type="hidden" name="id" value="{{.ID}}">
{{$cur := .SignalID}}
<select name="signal" data-autosubmit aria-label="Signal for {{.Name}}">
<option value="0">No signal yet</option>
{{range $d.Signals}}<option value="{{.ID}}" {{if eq .ID $cur}}selected{{end}}>{{.Name}}</option>{{end}}
</select>
<noscript><button type="submit" class="secondary small">Save</button></noscript>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
{{end}}
{{end}}{{end}}
+31
View File
@@ -0,0 +1,31 @@
{{define "content"}}{{template "settings-start" .}}{{with .Data}}
<h2>Lead sources</h2>
<p class="lede">The prospecting tools you test buying signals in. Supermarket only reads from them: campaigns and their numbers, who was contacted, who replied, who was interested and who unsubscribed. It never starts, changes or sends anything there. Results appear on <a href="/signals">Signals</a>.</p>
<form method="post" action="/settings/sources" autocomplete="off">
{{range .Sources}}
<section class="card">
<h3>{{.Name}}</h3>
{{template "key-field" (dict "F" .Key "Set" .Set)}}
{{if eq .ID "origami"}}
<label>Project <span class="muted small">(optional)</span> <input name="origami_project" value="{{$.Data.Project}}" placeholder="a project ID, to read only that project">
<span class="help">If your organization has projects, the ID of the one to read. Leave empty to read the whole organization.</span></label>
{{end}}
{{if .Set}}
<button type="button" class="secondary small" hx-post="/settings/sources/test/{{.ID}}" hx-target="#test-{{.ID}}" hx-indicator="#testing-{{.ID}}">Test</button>
<span id="testing-{{.ID}}" class="htmx-indicator">Checking…</span>
<div id="test-{{.ID}}"></div>
{{end}}
</section>
{{end}}
<div class="actions"><button type="submit">Save</button></div>
</form>
{{end}}{{template "settings-end"}}{{end}}
{{define "test-result"}}
{{with .Error}}<p class="error">{{.}}</p>{{end}}
{{with .OK}}<p class="ok">{{.}}</p>{{end}}
{{with .Sample}}<details><summary>What the API sends</summary>
<p class="help">origami.chat doesn't document its responses, so Supermarket looks fields up by the names its docs use. If an import misses replies or contacts, this shows the real names.</p>
<pre class="sample">{{.}}</pre></details>{{end}}
{{end}}