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:
@@ -12,6 +12,7 @@ import (
|
||||
"supermarket/internal/api/twitter"
|
||||
"supermarket/internal/inventory"
|
||||
"supermarket/internal/profile"
|
||||
"supermarket/internal/signals"
|
||||
)
|
||||
|
||||
// Request is what a set of drafts is written from.
|
||||
@@ -24,6 +25,15 @@ type Request struct {
|
||||
// if its rules couldn't be read).
|
||||
Subreddit string
|
||||
SubredditInfo *reddit.Subreddit
|
||||
// Signal, if set, is the buying signal the posts are written for.
|
||||
Signal *signals.Signal
|
||||
}
|
||||
|
||||
func (r *Request) signalID() int64 {
|
||||
if r.Signal == nil {
|
||||
return 0
|
||||
}
|
||||
return r.Signal.ID
|
||||
}
|
||||
|
||||
// SourceURL is the link the drafts carry: the first item's.
|
||||
@@ -122,7 +132,7 @@ func Generate(ctx context.Context, client ai.Client, req Request) ([]Draft, erro
|
||||
if r := []rune(title); len(r) > RedditTitleLimit {
|
||||
title = string(r[:RedditTitleLimit-1]) + "…"
|
||||
}
|
||||
drafts = append(drafts, Draft{InventoryName: name, Kind: req.Entry.Relationship, Channel: ch,
|
||||
drafts = append(drafts, Draft{InventoryName: name, Kind: req.Entry.Relationship, Channel: ch, SignalID: req.signalID(),
|
||||
Title: title, Target: reddit.CleanName(req.Subreddit), Content: strings.TrimSpace(rp.Body),
|
||||
SourceURL: src, ItemIDs: ids, Status: StatusDraft})
|
||||
continue
|
||||
@@ -144,6 +154,7 @@ func Generate(ctx context.Context, client ai.Client, req Request) ([]Draft, erro
|
||||
InventoryName: name,
|
||||
Kind: req.Entry.Relationship,
|
||||
Channel: ch,
|
||||
SignalID: req.signalID(),
|
||||
Content: text,
|
||||
SourceURL: src,
|
||||
ItemIDs: ids,
|
||||
@@ -264,6 +275,17 @@ func userPrompt(req Request, src string) string {
|
||||
fmt.Fprintf(&b, "%s\n</item>\n", strings.TrimSpace(it.Body))
|
||||
}
|
||||
|
||||
if sig := req.Signal; sig != nil {
|
||||
fmt.Fprintf(&b, "\nWrite it for readers in this situation (a buying signal we're testing): %s.\n", sig.Name)
|
||||
if sig.Hypothesis != "" {
|
||||
fmt.Fprintf(&b, "Why they may buy now: %s\n", oneLine(sig.Hypothesis))
|
||||
}
|
||||
if sig.Angle != "" {
|
||||
fmt.Fprintf(&b, "The angle (their pain, and what we promise): %s\n", oneLine(sig.Angle))
|
||||
}
|
||||
b.WriteString("Connect the source material to that situation where it honestly fits; don't force it.\n")
|
||||
}
|
||||
|
||||
b.WriteString("\nWrite one post for each channel below. Reply with JSON whose keys are the channel IDs.\n")
|
||||
for _, ch := range req.Channels {
|
||||
limit := limitFor(ch, src)
|
||||
|
||||
Reference in New Issue
Block a user