@vatio-ai/cli 0.136.0 → 0.138.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/lib/api-client.mjs +8 -0
- package/lib/commands/channels.mjs +26 -2
- package/lib/commands/team.mjs +3 -1
- package/lib/help.mjs +4 -2
- package/lib/telemetry.mjs +1 -0
- package/package.json +1 -1
package/lib/api-client.mjs
CHANGED
|
@@ -58,6 +58,14 @@ export class ApiClient extends HttpClient {
|
|
|
58
58
|
return this.get("/whatsapp/team");
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
// --- instagram ------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
// A link that connects the account with no Vatio session, to send whoever
|
|
64
|
+
// holds it: { url, expires_at }.
|
|
65
|
+
instagramConnectLink() {
|
|
66
|
+
return this.post("/instagram/link", {});
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
syncTemplates() {
|
|
62
70
|
return this.post("/templates/sync", {});
|
|
63
71
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// whatsapp / instagram -- connecting your own number or account needs Meta's
|
|
2
|
-
// consent screen, so `connect` prints where in the inbox
|
|
2
|
+
// consent screen, so `connect` prints where in the inbox (and `instagram link`
|
|
3
|
+
// a page for whoever holds the account), and that depends on
|
|
3
4
|
// whether the workspace has published: before, "Try the agent"; after, the
|
|
4
5
|
// channel's own page. Everything else on the WhatsApp page is here too.
|
|
5
6
|
// vatio.ai/workspaces is only for a server too old to send the link, and
|
|
@@ -101,7 +102,30 @@ const INSTAGRAM = {
|
|
|
101
102
|
draft: "Test Instagram with Try the agent in the inbox: verify your account there and talk to your agent."
|
|
102
103
|
};
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
const INSTAGRAM_USAGE = "Usage: vatio instagram [connect] | link [--json]";
|
|
106
|
+
|
|
107
|
+
// `link` is the page that connects the account with no Vatio session, for
|
|
108
|
+
// whoever holds it -- often a client, sent the link by WhatsApp.
|
|
109
|
+
export async function instagram(config, args = []) {
|
|
110
|
+
const json = takeFlag(args, "--json");
|
|
111
|
+
const sub = args.shift();
|
|
112
|
+
if (args.length) fail(INSTAGRAM_USAGE);
|
|
113
|
+
switch (sub) {
|
|
114
|
+
case undefined:
|
|
115
|
+
case "connect":
|
|
116
|
+
return inInbox(config, INSTAGRAM);
|
|
117
|
+
case "link": {
|
|
118
|
+
const link = await deployClient(config, config.resolveWorkspaceRequired()).instagramConnectLink();
|
|
119
|
+
if (json) return console.log(JSON.stringify(link, null, 2));
|
|
120
|
+
console.log("Share this link with whoever holds the Instagram account. They connect it from Instagram, with no Vatio");
|
|
121
|
+
console.log(`account, and works until ${link.expires_at}:`);
|
|
122
|
+
console.log(` ${link.url}`);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
default:
|
|
126
|
+
return fail(INSTAGRAM_USAGE);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
105
129
|
|
|
106
130
|
async function inInbox(config, channel) {
|
|
107
131
|
const status = await deployClient(config, config.resolveWorkspaceRequired()).deployStatus();
|
package/lib/commands/team.mjs
CHANGED
|
@@ -16,7 +16,9 @@ function explain(error) {
|
|
|
16
16
|
throw error;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// supervisor: the business's team; business: the business itself; developer: the
|
|
20
|
+
// agency. viewer is no longer offered (WorkspaceMembership::INVITABLE_ROLES).
|
|
21
|
+
const ROLES = ["supervisor", "business", "developer"];
|
|
20
22
|
const USAGE = `Usage: vatio team [list] [--json]\n` +
|
|
21
23
|
` vatio team invite EMAIL --role ${ROLES.join("|")} [--code CODE | --recovery-code CODE] [--json]\n` +
|
|
22
24
|
` vatio team role EMAIL ${ROLES.join("|")} [--code CODE | --recovery-code CODE] [--json]\n` +
|
package/lib/help.mjs
CHANGED
|
@@ -170,10 +170,10 @@ it made obsolete, moves it on. \`vatio rollback\` undoes the last change.
|
|
|
170
170
|
|
|
171
171
|
Team (the owner's; the same roles as the inbox's Team page):
|
|
172
172
|
team [list] [--json] The owner and everyone invited, and who has not signed in yet
|
|
173
|
-
team invite EMAIL --role
|
|
173
|
+
team invite EMAIL --role supervisor|business|developer [--code CODE]
|
|
174
174
|
Invite them and email them. Needs a second factor on your
|
|
175
175
|
account: --code is your authenticator app's code
|
|
176
|
-
team role EMAIL
|
|
176
|
+
team role EMAIL supervisor|business|developer [--code CODE]
|
|
177
177
|
Change what they reach; the same second factor
|
|
178
178
|
team rm EMAIL Take their access away
|
|
179
179
|
team resend EMAIL Email the invitation again
|
|
@@ -272,6 +272,8 @@ it made obsolete, moves it on. \`vatio rollback\` undoes the last change.
|
|
|
272
272
|
|
|
273
273
|
Channels:
|
|
274
274
|
instagram The same, for Instagram
|
|
275
|
+
instagram link [--json] The link to share with whoever holds the account:
|
|
276
|
+
they connect it with no Vatio account (7 days)
|
|
275
277
|
|
|
276
278
|
Everything else:
|
|
277
279
|
config show|get KEY|set KEY VALUE|unset KEY
|
package/lib/telemetry.mjs
CHANGED
|
@@ -39,6 +39,7 @@ const SUBCOMMANDS = {
|
|
|
39
39
|
webhooks: ["list", "create", "test", "deliveries", "enable", "rm"],
|
|
40
40
|
contacts: ["export", "delete"],
|
|
41
41
|
whatsapp: ["status", "connect", "live", "check", "disconnect", "invite", "team", "templates", "failed"],
|
|
42
|
+
instagram: ["connect", "link"],
|
|
42
43
|
config: ["show", "get", "set", "unset"],
|
|
43
44
|
"share-session": ["--should-ask", "--never"],
|
|
44
45
|
test: ["add", "list", "rm"],
|