@vatio-ai/cli 0.129.0 → 0.130.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.
@@ -5,7 +5,7 @@
5
5
  // vatio.ai/workspaces is only for a server too old to send the link, and
6
6
  // redirects to the inbox.
7
7
 
8
- import { deployClient } from "./deploy.mjs";
8
+ import { deployClient, whatsappIssueLines } from "./deploy.mjs";
9
9
  import { messages } from "./messages.mjs";
10
10
  import { withSecondFactor } from "./team.mjs";
11
11
  import { templates } from "./webhooks.mjs";
@@ -55,10 +55,10 @@ export async function whatsapp(config, args = []) {
55
55
  }
56
56
  case "check": {
57
57
  // The number's two-step verification PIN registers it on the Cloud API
58
- // again first: the fix for 133010, not registered.
58
+ // first: the fix for an issue of kind not_registered.
59
59
  const pin = takeValue(args, "--pin");
60
60
  if (args.length) fail(WHATSAPP_USAGE);
61
- if (pin !== null && !/^\d{6}$/.test(pin)) fail("--pin is the number's two-step verification PIN: 6 digits.");
61
+ if (pin !== null && !/^\d{6}$/.test(pin)) fail("--pin is the number's two-step verification PIN: 6 digits. A number with none takes them as its PIN.");
62
62
  const number = await client().checkWhatsapp(pin);
63
63
  printNumber(number, { json, checked: true });
64
64
  // A check that leaves Meta refusing every send did not pass.
@@ -172,7 +172,8 @@ function printNumber(number, { json = false, checked = false } = {}) {
172
172
  if (json) return console.log(JSON.stringify(number, null, 2));
173
173
  const name = number.number ?? "Your number";
174
174
  if (number.issue) {
175
- printIssue(name, number.issue);
175
+ console.log("");
176
+ for (const line of whatsappIssueLines(name, number.issue)) console.log(line);
176
177
  } else {
177
178
  const live = number.live
178
179
  ? paint("green", "live: the agent answers everyone who writes")
@@ -186,12 +187,3 @@ function printNumber(number, { json = false, checked = false } = {}) {
186
187
  if (number.failed_deliveries) console.log(` ${number.failed_deliveries} failed deliveries: vatio whatsapp failed`);
187
188
  }
188
189
 
189
- // Meta refuses every send from the number, and the server API refuses your
190
- // backend's messages with 409 whatsapp_number_unhealthy until a check passes.
191
- function printIssue(name, issue) {
192
- const code = issue.code ? ` (Meta ${issue.code})` : "";
193
- console.log(`\n${name}: ${paint("red", `NOT SENDING since ${issue.since}${code}`)}`);
194
- if (issue.message) console.log(` Meta: ${issue.message}`);
195
- console.log(` Fix: ${issue.fix}`);
196
- console.log(" Until a check passes, POST /messages answers 409 whatsapp_number_unhealthy and the agent's replies do not go out.");
197
- }
@@ -522,10 +522,30 @@ function printPreviewHolds(payload) {
522
522
  function printWhatsappIssue(whatsapp) {
523
523
  const issue = whatsapp?.issue;
524
524
  if (!issue) return;
525
+ for (const line of whatsappIssueLines(`WhatsApp ${whatsapp.number ?? "number"}`, issue)) console.error(line);
526
+ }
527
+
528
+ // The number's issue as `vatio whatsapp` and `vatio status` say it, and as the
529
+ // inbox's WhatsApp page and the MCP's get_whatsapp do. Not registered is also
530
+ // where a number lands the moment it is first connected, so it reads as that
531
+ // step, and its fix already says what Meta said.
532
+ export function whatsappIssueLines(name, issue) {
533
+ const until = "POST /messages answers 409 whatsapp_number_unhealthy and the agent's replies do not go out.";
534
+ if (issue.kind === "not_registered") {
535
+ return [
536
+ `${name}: ${paint("red", "NOT REGISTERED on the WhatsApp Cloud API: register it so it can send")}`,
537
+ ` Fix: ${issue.fix}`,
538
+ " Register it: vatio whatsapp check --pin PIN",
539
+ ` Until then, ${until}`,
540
+ ];
541
+ }
525
542
  const code = issue.code ? ` (Meta ${issue.code})` : "";
526
- console.error(`WhatsApp ${whatsapp.number ?? "number"} is NOT SENDING since ${issue.since}${code}: ${issue.message ?? ""}`);
527
- console.error(` Fix: ${issue.fix}`);
528
- console.error(" Until a check passes (vatio whatsapp check), POST /messages answers 409 whatsapp_number_unhealthy.");
543
+ return [
544
+ `${name}: ${paint("red", `NOT SENDING since ${issue.since}${code}`)}`,
545
+ ...(issue.message ? [` Meta: ${issue.message}`] : []),
546
+ ` Fix: ${issue.fix}`,
547
+ ` Until a check passes (vatio whatsapp check), ${until}`,
548
+ ];
529
549
  }
530
550
 
531
551
  // What Vatio did for this workspace in the last 30 days, in one line a
package/lib/help.mjs CHANGED
@@ -210,8 +210,9 @@ the two you are in. Commands default as listed.
210
210
  whatsapp live on|off Answer everyone who writes, or nobody
211
211
  whatsapp check [--pin PIN] Check the number with Meta and re-subscribe it;
212
212
  a pass clears its problem. --pin (its 6-digit
213
- two-step verification PIN) registers it on the
214
- Cloud API again first: the fix for 133010
213
+ two-step verification PIN, or the one it takes
214
+ when it has none) registers it on the Cloud API
215
+ first: the fix for a number not registered
215
216
  whatsapp disconnect [--yes]
216
217
  whatsapp invite EMAIL [--code CODE]
217
218
  Ask whoever manages the number to connect it:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatio-ai/cli",
3
- "version": "0.129.0",
3
+ "version": "0.130.0",
4
4
  "description": "Vatio CLI — deploy and manage Vatio agent workspaces",
5
5
  "keywords": [
6
6
  "vatio",