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:
+39
-1
@@ -10,6 +10,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -21,6 +22,7 @@ import (
|
||||
"supermarket/internal/legacy"
|
||||
"supermarket/internal/oauth"
|
||||
"supermarket/internal/secrets"
|
||||
"supermarket/internal/signals"
|
||||
)
|
||||
|
||||
//go:embed templates/*.html
|
||||
@@ -133,6 +135,18 @@ func (s *Server) Handler() (http.Handler, error) {
|
||||
mux.HandleFunc("GET /prospects/suppressed", s.suppressedPage)
|
||||
mux.HandleFunc("POST /prospects/suppressed", s.suppressedAction)
|
||||
mux.HandleFunc("POST /prospects/{kind}/{id}/{action}", s.prospectAction)
|
||||
mux.HandleFunc("GET /signals", s.signalsPage)
|
||||
mux.HandleFunc("GET /signals/new", s.signalPage)
|
||||
mux.HandleFunc("POST /signals/new", s.signalSave)
|
||||
mux.HandleFunc("POST /signals/campaigns", s.signalCampaign)
|
||||
mux.HandleFunc("POST /lead-sources/{source}/import", s.importSource)
|
||||
mux.HandleFunc("GET /signals/{id}", s.signalPage)
|
||||
mux.HandleFunc("POST /signals/{id}", s.signalSave)
|
||||
mux.HandleFunc("POST /signals/{id}/delete", s.signalDelete)
|
||||
mux.HandleFunc("POST /funnel/{id}/delete", s.funnelDelete)
|
||||
mux.HandleFunc("GET /settings/sources", s.sourcesPage)
|
||||
mux.HandleFunc("POST /settings/sources", s.sourcesSave)
|
||||
mux.HandleFunc("POST /settings/sources/test/{source}", s.sourcesTest)
|
||||
mux.HandleFunc("GET /crm", s.crmPage)
|
||||
mux.HandleFunc("GET /crm/reach", s.crmReach)
|
||||
mux.HandleFunc("POST /crm/{action}", s.crmAction)
|
||||
@@ -232,6 +246,10 @@ func (s *Server) loadTemplates() error {
|
||||
return m, nil
|
||||
},
|
||||
"xreserve": twitter.URLReserve,
|
||||
// money shows cents as dollars: $1,234 or $12.50.
|
||||
"money": money,
|
||||
"stage": signals.StageLabel,
|
||||
"channel": signals.ChannelLabel,
|
||||
"truncate": func(n int, s string) string {
|
||||
r := []rune(s)
|
||||
if len(r) <= n {
|
||||
@@ -298,7 +316,7 @@ type module struct {
|
||||
|
||||
var modules = []module{
|
||||
{"content", "Content", "Phase 1", "Draft posts from partner and competitor news and your own products; review and publish to X, LinkedIn and Reddit.", "/content"},
|
||||
{"prospects", "Prospects", "Phase 2", "Find companies and people who fit your targets, and add the ones you approve to EspoCRM through Hermes.", "/prospects"},
|
||||
{"prospects", "Prospects", "Phase 2", "Test buying signals through the whole funnel, from finding prospects to payment; add the people you approve to EspoCRM through Hermes.", "/signals"},
|
||||
{"seo", "SEO", "Phase 3", "Audit your websites and open fixes as pull requests on your Hugo repositories.", ""},
|
||||
{"metrics", "Metrics", "Phase 4", "Pipeline influence, CAC, CLV and NRR from Stripe, EspoCRM and Plausible.", ""},
|
||||
{"sites", "Sites", "Phase 5", "Build pages and sites from a component library and publish them through Gitea.", ""},
|
||||
@@ -355,6 +373,7 @@ var flashes = map[string]string{
|
||||
"suppressed": "Added to the suppression list.",
|
||||
"unsuppressed": "Taken off the suppression list.",
|
||||
"prospect-added": "Added. Review it below.",
|
||||
"outcome": "Outcome recorded.",
|
||||
"rules-refreshed": "Rules refreshed.",
|
||||
"imported": "Imported.",
|
||||
"oauth-expired": "That sign-in took too long or was already used. Try again.",
|
||||
@@ -384,6 +403,25 @@ func (s *Server) serverError(w http.ResponseWriter, err error) {
|
||||
http.Error(w, "Something went wrong: "+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
func money(cents int64) string {
|
||||
neg := cents < 0
|
||||
if neg {
|
||||
cents = -cents
|
||||
}
|
||||
whole := strconv.FormatInt(cents/100, 10)
|
||||
for i := len(whole) - 3; i > 0; i -= 3 {
|
||||
whole = whole[:i] + "," + whole[i:]
|
||||
}
|
||||
out := "$" + whole
|
||||
if c := cents % 100; c != 0 {
|
||||
out += fmt.Sprintf(".%02d", c)
|
||||
}
|
||||
if neg {
|
||||
out = "-" + out
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func ago(t time.Time) string {
|
||||
if t.IsZero() {
|
||||
return "never"
|
||||
|
||||
Reference in New Issue
Block a user