Phase 2 part 7: the end of the funnel

Posts can be written for a buying signal: the prompt gets its hypothesis
and angle, and links carry its campaign tag. Plausible (Stats API v2) is
read once a day for visitors on tagged links, recorded per signal as
Visited. Stripe (restricted key) is read every hour: $0 checkouts are
Signed up, paid invoices and one-time payments are Paid with their value,
tied to a signal by the checkout's utm_campaign metadata or the payer's
email. The Core's Cal.com has no API, so booking emails from Cal.com in
the outreach mailbox count as Booked. New Settings → Website & sales;
the signal page lists its posts and tagged links. Schema 11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 06:42:03 -07:00
co-authored by Claude Opus 5.5
parent 90d73cf907
commit d23d5e2a87
32 changed files with 1775 additions and 26 deletions
+22 -1
View File
@@ -13,10 +13,12 @@ import (
"supermarket/internal/api/reddit"
"supermarket/internal/api/sitemap"
"supermarket/internal/content"
"supermarket/internal/db"
"supermarket/internal/fetcher"
"supermarket/internal/inventory"
"supermarket/internal/models"
"supermarket/internal/profile"
"supermarket/internal/signals"
)
// maxPerItem caps "one post per item", which makes one AI call per item.
@@ -85,6 +87,7 @@ type entryPage struct {
Channels []channelChoice
ProfileSet bool
Subreddits []string // suggestions: the entry's, then the profile's
Signals []signals.Signal
// After a fetch
Fetched bool
NewItems int
@@ -168,7 +171,7 @@ func (s *Server) entryData(e *inventory.Entry, showDismissed bool) (*entryPage,
base, name = "/content/own", ifElse(p.Name != "", p.Name, "Your company")
}
return &entryPage{Own: content.IsOwn(e), Base: base, Name: name, Products: products, Subreddits: subs, Entry: e, Sources: fetcher.Sources(e), Items: items, ShowDismissed: showDismissed,
LastChecked: last, Since: since, Channels: chans, ProfileSet: p.IsSet()}, nil
LastChecked: last, Since: since, Channels: chans, ProfileSet: p.IsSet(), Signals: activeSignals(s.DB)}, nil
}
func (s *Server) contentEntry(w http.ResponseWriter, r *http.Request) {
@@ -312,6 +315,11 @@ func (s *Server) writeDrafts(r *http.Request, e *inventory.Entry, ids []string)
}
}
req := content.Request{Profile: p, Entry: e}
if id, _ := strconv.ParseInt(r.PostForm.Get("signal"), 10, 64); id != 0 {
if req.Signal, err = signals.Get(s.DB, id); err != nil {
return errors.New("that signal no longer exists")
}
}
for _, ch := range ordered {
if ch == content.ChannelReddit {
req.Subreddit = reddit.CleanName(r.PostForm.Get("subreddit"))
@@ -353,3 +361,16 @@ func (s *Server) writeDrafts(r *http.Request, e *inventory.Entry, ids []string)
}
return nil
}
// activeSignals are the signals content can be written for: all but the
// retired ones.
func activeSignals(d *db.DB) []signals.Signal {
list, _ := signals.List(d)
var out []signals.Signal
for _, sg := range list {
if sg.Status != "retired" {
out = append(out, sg)
}
}
return out
}