@erdoai/cli 0.175.0 → 0.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +51 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1595,6 +1595,18 @@ var ErdoClient = class {
|
|
|
1595
1595
|
`/v1/datasets/${encodeURIComponent(datasetSlug)}/leads/${encodeURIComponent(lead)}/timeline`
|
|
1596
1596
|
);
|
|
1597
1597
|
}
|
|
1598
|
+
// Whether each lead in a dataset has ever answered, from the follow-up
|
|
1599
|
+
// engine's own reading, a page of the dataset at a time.
|
|
1600
|
+
listLeadReachability(datasetSlug, opts = {}) {
|
|
1601
|
+
const params = new URLSearchParams();
|
|
1602
|
+
if (opts.limit) params.set("limit", String(opts.limit));
|
|
1603
|
+
if (opts.offset) params.set("offset", String(opts.offset));
|
|
1604
|
+
const qs = params.toString();
|
|
1605
|
+
return this.request(
|
|
1606
|
+
"GET",
|
|
1607
|
+
`/v1/datasets/${encodeURIComponent(datasetSlug)}/lead-reachability${qs ? `?${qs}` : ""}`
|
|
1608
|
+
);
|
|
1609
|
+
}
|
|
1598
1610
|
// A dry run: nothing is stored and nothing is sent. body tries a draft
|
|
1599
1611
|
// playbook instead of the saved one.
|
|
1600
1612
|
// agent_id tries the draft as a different concierge; it is read only
|
|
@@ -6953,11 +6965,12 @@ contact: ${parts.join(" \xB7 ")}`);
|
|
|
6953
6965
|
}
|
|
6954
6966
|
console.log("");
|
|
6955
6967
|
printAlignedTable(
|
|
6956
|
-
["at", "direction", "status", "media", "body"],
|
|
6968
|
+
["at", "direction", "status", "delivered", "media", "body"],
|
|
6957
6969
|
messages.map((m) => [
|
|
6958
6970
|
m.created_at,
|
|
6959
6971
|
m.direction,
|
|
6960
6972
|
m.status,
|
|
6973
|
+
m.delivered_at ?? "",
|
|
6961
6974
|
m.num_media > 0 ? m.num_media : "",
|
|
6962
6975
|
m.body
|
|
6963
6976
|
])
|
|
@@ -7074,11 +7087,13 @@ contact: ${parts.join(" \xB7 ")}`);
|
|
|
7074
7087
|
}
|
|
7075
7088
|
console.log("");
|
|
7076
7089
|
printAlignedTable(
|
|
7077
|
-
["at", "direction", "status", "media", "message"],
|
|
7090
|
+
["at", "direction", "status", "delivered", "read", "media", "message"],
|
|
7078
7091
|
messages.map((m) => [
|
|
7079
7092
|
m.created_at,
|
|
7080
7093
|
m.direction,
|
|
7081
7094
|
m.status,
|
|
7095
|
+
m.delivered_at ?? "",
|
|
7096
|
+
m.read_at ?? "",
|
|
7082
7097
|
m.num_media > 0 ? m.num_media : "",
|
|
7083
7098
|
whatsAppMessageText(m)
|
|
7084
7099
|
])
|
|
@@ -8978,6 +8993,40 @@ unavailable: ${source} \u2014 ${reason}`);
|
|
|
8978
8993
|
fail(e);
|
|
8979
8994
|
}
|
|
8980
8995
|
});
|
|
8996
|
+
leadsCmd.command("reachability <dataset>").description(
|
|
8997
|
+
"List whether each lead in a dataset has ever answered us, from the follow-up engine's own reading: confirmed once the lead replied, called in, picked up a call and talked, texted, wrote on WhatsApp, chatted on the website or booked, and unconfirmed until then. An out-of-office reply and a STOP do not count. The same reading `leads timeline` shows for one lead under timing."
|
|
8998
|
+
).option("--limit <n>", "leads per page, in canonical_lead_id order (default 500, max 5000)").option("--offset <n>", "leads to skip").option("--json", "print the raw JSON result instead of a table").action(async (dataset, opts) => {
|
|
8999
|
+
try {
|
|
9000
|
+
const limit = opts.limit === void 0 ? void 0 : parseInt(opts.limit, 10);
|
|
9001
|
+
const offset = opts.offset === void 0 ? void 0 : parseInt(opts.offset, 10);
|
|
9002
|
+
if (limit !== void 0 && (!Number.isFinite(limit) || limit <= 0) || offset !== void 0 && (!Number.isFinite(offset) || offset < 0)) {
|
|
9003
|
+
fail(new Error("--limit must be a positive number and --offset zero or more"));
|
|
9004
|
+
return;
|
|
9005
|
+
}
|
|
9006
|
+
const res = await new ErdoClient().listLeadReachability(dataset, { limit, offset });
|
|
9007
|
+
if (opts.json) {
|
|
9008
|
+
print(res);
|
|
9009
|
+
return;
|
|
9010
|
+
}
|
|
9011
|
+
if (res.leads.length === 0) {
|
|
9012
|
+
console.log(`No leads at offset ${res.offset} of ${res.total}.`);
|
|
9013
|
+
} else {
|
|
9014
|
+
printAlignedTable(
|
|
9015
|
+
["lead", "reference", "reachability", "via", "reached at"],
|
|
9016
|
+
res.leads.map((l) => [l.canonical_lead_id, l.lead_reference, l.reachability, l.reached_via ?? "", l.reached_at ?? ""])
|
|
9017
|
+
);
|
|
9018
|
+
const confirmed = res.leads.filter((l) => l.reachability === "confirmed").length;
|
|
9019
|
+
console.log(`
|
|
9020
|
+
${confirmed} of ${res.leads.length} confirmed; leads ${res.offset + 1}\u2013${res.offset + res.leads.length} of ${res.total}.`);
|
|
9021
|
+
}
|
|
9022
|
+
for (const [source, reason] of Object.entries(res.unavailable ?? {})) {
|
|
9023
|
+
console.log(`
|
|
9024
|
+
unavailable: ${source} \u2014 ${reason}`);
|
|
9025
|
+
}
|
|
9026
|
+
} catch (e) {
|
|
9027
|
+
fail(e);
|
|
9028
|
+
}
|
|
9029
|
+
});
|
|
8981
9030
|
var leadNextActionsCmd = leadsCmd.command("next-actions").description("Read the suggested next action for each lead, hold, close or start a lead, and dry-run the playbook on one lead");
|
|
8982
9031
|
leadNextActionsCmd.command("list").description(
|
|
8983
9032
|
"List each lead's current suggestion, highest priority first. --status pending_approval lists the cards waiting for a person."
|