@erdoai/cli 0.148.3 → 0.149.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.
Files changed (2) hide show
  1. package/dist/index.js +45 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -691,6 +691,16 @@ var ErdoClient = class {
691
691
  `/v1/voice/phone-numbers/${encodeURIComponent(number)}/sms`
692
692
  );
693
693
  }
694
+ // Registering a number for WhatsApp, or with sharedWith ("managed_organizations"
695
+ // or "none") changing only who else may send from an approved WhatsApp
696
+ // sender. Either files the same approval card the gateway files.
697
+ provisionVoicePhoneNumberWhatsApp(number, sharedWith) {
698
+ const qs = sharedWith ? `?shared_with=${encodeURIComponent(sharedWith)}` : "";
699
+ return this.request(
700
+ "POST",
701
+ `/v1/voice/phone-numbers/${encodeURIComponent(number)}/whatsapp${qs}`
702
+ );
703
+ }
694
704
  // The organization's caller name and what each number shows when it calls.
695
705
  // Read from Erdo's own record; nothing here reaches the provider.
696
706
  getVoiceCallerName() {
@@ -6901,6 +6911,41 @@ voiceNumbersCmd.command("provision-sms <number>").description("Ask for A2P SMS r
6901
6911
  fail(e);
6902
6912
  }
6903
6913
  });
6914
+ voiceNumbersCmd.command("provision-whatsapp <number>").description(
6915
+ "Ask for one of the organization's numbers to answer on WhatsApp, or with --share change who else may send from a number that is already a WhatsApp sender"
6916
+ ).option(
6917
+ "--share <who>",
6918
+ "managed_organizations: let every organization this one manages fall back to this approved WhatsApp sender; none: stop. Changes only the sharing, never the registration or name"
6919
+ ).option("--json", "print the raw JSON result instead of a summary").action(async (number, opts) => {
6920
+ try {
6921
+ const share = opts.share?.trim();
6922
+ if (share !== void 0 && share !== "managed_organizations" && share !== "none") {
6923
+ throw new Error('--share must be "managed_organizations" or "none"');
6924
+ }
6925
+ const res = await new ErdoClient().provisionVoicePhoneNumberWhatsApp(number, share);
6926
+ if (opts.json) {
6927
+ print(res);
6928
+ return;
6929
+ }
6930
+ if (res.status === "pending_approval") {
6931
+ console.log(
6932
+ share ? "Sharing has not changed yet \u2014 an approval card was filed and awaits a decision." : "Nothing has been registered yet \u2014 an approval card was filed and awaits a decision."
6933
+ );
6934
+ if (res.action_display) console.log(`action: ${res.action_display}`);
6935
+ if (res.approval_request_id) {
6936
+ console.log(`approval request: ${res.approval_request_id}`);
6937
+ console.log(` erdo approvals decide ${res.approval_request_id} --approve`);
6938
+ }
6939
+ } else if (res.status === "declined") {
6940
+ console.log("Nothing was filed: a person declined this same change recently.");
6941
+ } else {
6942
+ console.log(share ? `Sharing ${res.status}.` : `Registration ${res.status}.`);
6943
+ if (res.registration) print(res.registration);
6944
+ }
6945
+ } catch (e) {
6946
+ fail(e);
6947
+ }
6948
+ });
6904
6949
  function printCallAttestationNote(attestation) {
6905
6950
  if (!attestation || attestation.status === "approved") return;
6906
6951
  console.log("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.148.3",
3
+ "version": "0.149.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {