CLI command
email score
Lead scoring: each CRM contact scored by the operator's weights on signals read from stored rows, every contribution shown as the reason.
Invocation#
echo-cli email score signals
echo-cli email score weight --signal <signal> --weight <n> --by <who>
echo-cli email score unweight --signal <signal>
echo-cli email score leads [--contact <contact-id>]Inputs and output#
signals writes weights (signal, weight, declared_by, declared_at) and signals (signal and meaning, for every signal Echo reads). weight and unweight write the weight. leads writes every contact's score, highest first (or one contact's): contact_id, name, deal_status, score and signals — per weighted signal, value, weight, contribution and unmeasured (why the contact has no value for it, or null).
State effect#
The verbs call Echo Web's authenticated /api/crm/scores with ECHO_INTERNAL_BEARER at ECHO_WEB_BASE_URL; the Lead scores section of the contacts screen and of Echo Desktop's Contact frequency screen do the same, and echo-mcp runs them as echo_lead_score_signals, echo_lead_score_weight, echo_lead_score_unweight and echo_lead_scores. Weights are stored in lead_score_weights, one per signal. The signals are inbound_replies (inbound crm_messages across the contact's conversations), email_clicks (crm_email_clicks through the contact's campaign recipients), interested_reply (1 when the reply classifier's latest reading of the contact is interested), followers (the contact's recorded follower count; unmeasured when none is recorded) and icp_fit (1 when the contact's stored metadata carries every firmographic attribute of an ICP profile of any product at its latest version, not retired, as echo-cli icp contacts matches them; else 0). A score is the sum of each weighted signal's value times its weight; nothing is stored.
Refusals#
- A wrong invocation is refused before anything is sent: "email score takes …; got <word>", "email score <verb> does not take <flag>; …", "<flag> needs a value" and "email score <verb> needs <flag>".
- Echo Web answers a bad request with "signal must be one of inbound_replies, email_clicks, interested_reply, followers, icp_fit; got <value>", "weight must be a number: what one unit of <signal> adds to a score; got <value>", "declared_by is required: an internal caller has no signed-in user, so it names who is acting" or "no lead scoring weight is declared; declare one with echo-cli email score weight first"; and not found with "no weight is declared for <signal>" or "no CRM contact has id <id>". The command prints Echo Web's sentence and exits 1.