Skip to content

Listening leads, quiz leads, calling hours, dialer call outcomes and an MCP server - #2

Merged
operatoruplift merged 6 commits into
mainfrom
gtmIntegrations
Nov 4, 2026
Merged

operatoruplift merged 6 commits into
mainfrom
gtmIntegrations

Conversation

@operatoruplift

Copy link
Copy Markdown
Owner

Five features that connect COLD to listening, offer's quiz funnel and the dialer, plus an MCP server, one commit each. The branch sits on top of xDmSend (X DMs through X's official API), which goes to main on its own; once it has, this pull request shows only these five commits.

What's in it

  • Leads from listening (2be3a10). OpenMagpie's webhook action delivers the posts its watches match to /api/listen/magpie, proven with Authorization: Bearer <COLD_LISTEN_SECRET>. Each match is kept once however often it's delivered (migration 7, listen_items), and each watch is a prospect source, listen:<watch>, whose trigger line is the post itself. A post on X carries its author's handle for an X DM. Save as a list (Settings) writes a watch's matches to one of your own lists to fill in and research.
  • Quiz leads get called first (556c83b). offer's agencyLeads are a source, twenty:agencyLeads: the person who took the quiz (never the business's decision maker), their answers and UTM tags as variables. Calls lists the last two weeks' qualified leads nobody has called yet at the top, and picking one fills the script in for them. With COLD_NTFY_URL, a push goes out through ntfy within a minute of each new qualified lead, claimed in the database so it runs once across servers, never twice per lead, and never for leads from before it was set up. Also fixes findProspect, which never matched keys such as agencyProspect:<id>, so a dialer prospect picked on a call sheet was never filled in.
  • Calls at their hour (07973bb). Call sheets, in the app and from cold call sheet, show the prospect's local time and whether it's inside calling hours: 8am to 9pm unless cold.yaml's new calls: says otherwise. The zone comes from a timezone column, else from the phone's area code (Google libphonenumber's prefix map, Apache 2.0, pinned and regenerated by bun run data:phoneZones) and the state. An area that spans zones is only called when it's inside hours in all of them, and a number it can't place is said, never guessed.
  • The dialer's calls come back (339d9a8). Every settled agencyCall with an outcome becomes one touch on the business's or lead's timeline (templateId: dialer:<disposition>, the AI score, tone and summary), every ten minutes, from Log calls on Calls, or with cold call log, and never twice. A conversation pauses that prospect's sequences for 90 days like a reply, "do not call" is an opt-out on every channel, and the decision engine reads the calls: an opt-out is always skipped, a recent "not interested" turns reach out now into later, and a wrong or bad number is no longer a way to reach them.
  • Drive COLD from Claude (af005ee). bun run mcp serves sixteen tools over stdio, built on the MCP TypeScript SDK v2 and answered from COLD's own API in-process, so they keep its rules. cold_send_emails and cold_send_x_dm only preview unless called again with confirm=true.

Settings and dependencies

  • New environment variables, all optional: COLD_LISTEN_SECRET, COLD_NTFY_URL, COLD_NTFY_TOKEN (in .env.example and Settings).
  • cold.yaml: an optional calls: section (start, end, days), documented in cold.example.yaml.
  • New dependencies, pinned: @modelcontextprotocol/server 2.3.1 and zod 4.6.7.
  • One database migration (7).

How it was checked

  • bun run check: 387 tests pass, typecheck and the message lint clean.
  • Run in the app against a fake Twenty and a fake ntfy: the Calls page on desktop and phone width, a live push about 52 seconds after a new lead came in, leads outside calling hours, and Log calls. The stdio MCP server was driven end to end, including a real send through a fake mailbox, stopped mid-way.
  • Not checked against the live services: ntfy.sh itself (its docs weren't reachable from the session, so Settings has Send a test alert), a real Twenty with the dialer's calls, and a real OpenMagpie delivery.

Generated by Claude Code

operatoruplift and others added 6 commits November 1, 2026 15:26
- Connect X in Settings: your own X developer app (X_CLIENT_ID,
  X_CLIENT_SECRET), OAuth 2.0 with PKCE and a one-time state. X sends you
  back to /api/x/callback, which is trusted through that state rather than
  the session cookie (a strict cookie doesn't come back from x.com).
- Send on X in a campaign's X queue: the DM you approved, sent from your
  account through X's API, within the daily cap, logged with X's message
  id. Each step is claimed in the database first, so two clicks or two
  servers send it once.
- A follow-up is checked against the conversation first: when they have
  answered, the reply is logged and nothing is sent.
- Check X DMs on the Inbox logs answers to earlier DMs, which stops those
  sequences.
- X sign-ins live in the database, sealed with COLD_SECRET_KEY (required on
  a hosted server). An X sign-in problem answers 409, never 401, so the app
  doesn't sign you out of cold.
- LinkedIn, Instagram and Facebook stay copy and open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TZhsuUQ7RbYzBy4coULGCu
- POST /api/listen/magpie takes OpenMagpie's webhook body (instant or
  digest), proven by Authorization: Bearer <COLD_LISTEN_SECRET>, size and
  item limits checked. Each match is kept once by its key, however often
  OpenMagpie delivers it.
- Each watch is a prospect source, listen:<watch id> (and listen:all): the
  trigger line is the post itself, quoted short, with its link; a post on X
  carries its author's handle, so it can be answered with an X DM; Reddit
  usernames are never used as first names.
- Save as a list (Settings, Listening) writes a watch's matches to one of
  your own lists, prospects-listen-<watch>.csv, to fill in and research;
  saving again keeps your edits and adds only new matches.
- Routes other services call are one table (publicRoutes) the guard lets
  through by name; the prospect sources the app accepts are defined once;
  the CSV writer is shared.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TZhsuUQ7RbYzBy4coULGCu
…t on Calls

- twenty:agencyLeads is a prospect source: the person who took offer's quiz
  (read from the note offer writes: contact lines, quiz answers, offer and
  UTM tags), the business's details when they came through its own funnel
  link, never its decision maker's name, and "Saw you took our quiz on
  Nov 2." as the trigger when the business has none.
- Calls lists the last two weeks' qualified leads nobody has called yet at
  the top, newest first. Picking one (or opening its push) fills the script
  in for them, with a Call button and their answers.
- With COLD_NTFY_URL (ntfy), a push goes out within a minute of each new
  qualified lead; more than five at once come as one. The look is claimed in
  the database, so it runs once a minute across every server, and the newest
  lead seen is kept there: a lead is pushed once, a failed push is retried,
  leads from before alerts were set up are never pushed. The local server's
  timer and the Vercel cron both run it. Settings, Lead alerts sends a test.
- Fix: findProspect lowercased the query but compared it with keys such as
  agencyProspect:<id> exactly, so a dialer prospect picked in a call sheet or
  a research run was never found and the script kept its braces.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TZhsuUQ7RbYzBy4coULGCu
- A call sheet for a prospect (the app and cold call sheet) says what time
  it is where they are and whether it is inside calling hours: 8am to 9pm
  every day unless cold.yaml's new calls: section (start, end, days) says
  otherwise. Outside them it says when hours open, "call from tomorrow
  8:00 AM CST".
- The time zone comes from a timezone column, else from both the phone's
  area code and the state or province: an area code inside the state
  narrows it, one outside it adds its zone, and calls fit every zone they
  may be in. The country is the last resort when it has one zone. Numbers
  are read in E.164, 00, the US and Canadian national forms, and the
  national form of a known country. One it can't place is said, never
  guessed (an unknown US area code is not "every US zone").
- Phone prefix zones come from Google's libphonenumber timezone map
  (Apache 2.0, pinned commit, regenerated with bun run data:phoneZones),
  down to the exchange where an area code is split.
- Quiz leads it is too early or late to call drop below the ones you can
  call now, their Call button waits, and their push says when to call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TZhsuUQ7RbYzBy4coULGCu
…ions

- Every call the dialer logs with an outcome becomes one touch on the
  business's or quiz lead's timeline (agencyProspect, else agencyLead):
  CALLED with the outcome (templateId dialer:<disposition>), the dialer's AI
  score and tone, and its summary; "do not call" is an OPTED_OUT and marks
  the dialer's prospect Do Not Contact. A call is read once it has settled
  (outcome set, call over, AI reading done or 15 minutes passed) and logged
  once, by its id.
- It runs every ten minutes in the background (the local timer and the
  Vercel cron, claimed in the database so one server runs it), from Log
  calls on the Calls page (POST /api/calls/log), or with cold call log
  [--days] [--dry-run].
- Talking with someone (interested, appointment set, call back, not
  interested) pauses their sequences for 90 days, like a reply.
- The decision engine reads the calls in the history. Someone who opted out
  is always skipped; "not interested" on a call in the last 90 days turns
  reach out now into later; a wrong or bad number is no longer a way to
  reach them; skipping someone the dialer logged as interested goes to you
  to check.
- Quiz leads say how their last call went. One helper claims a background
  run for every server (claimRun), shared with the lead watch. Toasts keep
  line breaks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TZhsuUQ7RbYzBy4coULGCu
- bun run mcp serves COLD over stdio (claude mcp add cold -- bun run --cwd
  /path/to/cold mcp). It opens the same files and database as bun run ui and
  answers every tool from COLD's API in-process, so the tools keep the app's
  rules: caps, sending windows, Do Not Contact, one send per step.
- Sixteen tools: status, campaigns, a campaign's plan for today (due with the
  exact message, held, waiting, skipped and why), prospect lists and
  prospects, recent activity, results, call scripts and call sheets with the
  prospect's local time, quiz leads, logging the dialer's calls and DMs sent
  by hand, and following or stopping an email send.
- Sending is two steps: cold_send_emails and cold_send_x_dm only preview,
  and send when called again with confirm=true; the server's instructions
  say to do that only after the owner said yes. Annotations mark what reads,
  what writes and what reaches outside.
- Answers read as Markdown, or COLD's JSON as structuredContent, in pages
  that stay under 25,000 characters. stdout carries only the protocol:
  everything COLD logs goes to stderr. A send started from it carries on at
  the account's pace while the server is open, and after that whenever COLD
  runs.
- @modelcontextprotocol/server 2.3.1 (the SDK's v2) and zod 4.6.7, pinned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TZhsuUQ7RbYzBy4coULGCu
@vercel

vercel Bot commented Nov 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
coldthecompany Ready Ready Preview Nov 4, 2026 4:19am UTC

Request Review

@operatoruplift
operatoruplift merged commit 17a9fac into main Nov 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants