Phase 2 part 1: the CRM bridge to EspoCRM through Hermes
Supermarket queues CRM work in crm_actions and never writes to EspoCRM itself. A Hermes cron job (supermarket-crm, set up by `supermarket hermes`) runs every 15 minutes behind a monitor script that prints Supermarket's crm-state file, so unchanged state skips the AI run. Hermes calls the new MCP tools crm_pending_actions, crm_report_result and crm_ingest, creating each record through the Core's MCP hub unless a match exists, and copying Leads, Accounts and Contacts back every 6 hours for duplicate checks. Schema 5 adds crm_actions and crm_records. Prospects -> CRM queue shows the queue, a test Lead, sync, Retry and Cancel. When an action fails with a connection error, the page checks EspoCRM from this computer and says whether the CRM is down or the hub can't reach it, with a note to send to the Core's maintainer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -127,6 +127,11 @@ func (s *Server) Handler() (http.Handler, error) {
|
||||
mux.HandleFunc("POST /drafts/{id}/{action}", s.draftAction)
|
||||
mux.HandleFunc("POST /reddit/rules/{name}", s.refreshRules)
|
||||
|
||||
mux.HandleFunc("GET /crm", s.crmPage)
|
||||
mux.HandleFunc("GET /crm/reach", s.crmReach)
|
||||
mux.HandleFunc("POST /crm/{action}", s.crmAction)
|
||||
mux.HandleFunc("POST /crm/{id}/{action}", s.crmAction)
|
||||
|
||||
mux.HandleFunc("GET /settings/core", s.corePage)
|
||||
mux.HandleFunc("GET /settings/core/checks", s.coreChecks)
|
||||
|
||||
@@ -267,6 +272,8 @@ func (p page) Section() string {
|
||||
return ""
|
||||
case strings.HasPrefix(p.Nav, "content"):
|
||||
return "Content"
|
||||
case strings.HasPrefix(p.Nav, "prospects"):
|
||||
return "Prospects"
|
||||
case strings.HasPrefix(p.Nav, "settings"):
|
||||
return "Settings"
|
||||
case p.Nav == "inventory":
|
||||
@@ -283,7 +290,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", "Phase 2", "Find companies and people who fit your targets, and add the ones you approve to EspoCRM through Hermes.", "/crm"},
|
||||
{"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.", ""},
|
||||
@@ -331,6 +338,8 @@ var flashes = map[string]string{
|
||||
"x-connected": "X is connected.",
|
||||
"li-connected": "LinkedIn is connected.",
|
||||
"reddit-connected": "Reddit is connected.",
|
||||
"crm-test": "Test Lead queued. Hermes creates it on its next run; or run it now (below).",
|
||||
"crm-sync": "Sync requested: Hermes copies CRM records on its next run.",
|
||||
"rules-refreshed": "Rules refreshed.",
|
||||
"imported": "Imported.",
|
||||
"oauth-expired": "That sign-in took too long or was already used. Try again.",
|
||||
|
||||
Reference in New Issue
Block a user