@velaro/cli 1.4.215 → 1.4.217

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/bin/velaro.js CHANGED
@@ -17,6 +17,7 @@ import { partFinderCommand } from '../lib/commands/part-finder.js';
17
17
  import { knowledgeCommand } from '../lib/commands/knowledge.js';
18
18
  import { productCommand } from '../lib/commands/product.js';
19
19
  import { apiUsageCommand } from '../lib/commands/api-usage.js';
20
+ import { conversationActionCommand } from '../lib/commands/conversation-action.js';
20
21
  import { mcpKeyCommand } from '../lib/commands/mcp-key.js';
21
22
  import { deployStateCommand } from '../lib/commands/deploy-state.js';
22
23
  import { checkCommand } from '../lib/commands/check.js';
@@ -133,6 +134,7 @@ import { usageCommand } from '../lib/commands/usage.js';
133
134
  import { campaignsCommand } from '../lib/commands/campaigns.js';
134
135
  import { senderDomainHealthCommand } from '../lib/commands/sender-domain-health.js';
135
136
  import { contactsCommand } from '../lib/commands/contacts.js';
137
+ import { contactsApiCommand } from '../lib/commands/contacts-rest-extras.js';
136
138
  import { contactListCommand } from '../lib/commands/contact-list.js';
137
139
  import { contactSegmentCommand } from '../lib/commands/contact-segment.js';
138
140
  import { recycleBinCommand, aiUsageCommand, siteInfoCommand, billingReceiptsCommand } from '../lib/commands/endpoint-parity.js';
@@ -189,6 +191,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
189
191
  .command(productCommand)
190
192
  .command(mcpKeyCommand)
191
193
  .command(apiUsageCommand)
194
+ .command(conversationActionCommand)
192
195
  .command(deployStateCommand)
193
196
  .command(checkCommand)
194
197
  .command(siteCommand)
@@ -311,6 +314,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
311
314
  .command(campaignsCommand)
312
315
  .command(senderDomainHealthCommand)
313
316
  .command(contactsCommand)
317
+ .command(contactsApiCommand)
314
318
  .command(contactListCommand)
315
319
  .command(contactSegmentCommand)
316
320
  .command(recycleBinCommand)
@@ -0,0 +1,63 @@
1
+ import { request } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+
4
+ // -- velaro contacts-api ------------------------------------------------------
5
+ // CLI surface for the public REST v1 contact extras and sends
6
+ // (server/Velaro.Admin/Controllers/PublicApiContactsExtrasController.cs).
7
+ // DELETE api/v1/contacts/{id} POST api/v1/contacts/upsert
8
+ // GET api/v1/custom-fields
9
+ // POST api/v1/sms POST api/v1/whatsapp
10
+ // siteId is always taken from the API key / session server-side, never a CLI arg.
11
+
12
+ function show(r) { console.log(JSON.stringify(r, null, 2)); }
13
+
14
+ const contactsApiCommand = {
15
+ command: 'contacts-api <subcommand>',
16
+ describe: 'Public REST v1: delete/upsert contacts, add notes, list custom fields, send SMS/WhatsApp',
17
+ builder: (y) => y
18
+ .command({
19
+ command: 'delete <id>',
20
+ describe: 'Soft-delete a contact (restorable for 30 days)',
21
+ builder: (y2) => y2.positional('id', { type: 'number' }),
22
+ handler: runCommand(async (a) => show(await request('DELETE', `api/v1/contacts/${a.id}`))),
23
+ })
24
+ .command({
25
+ command: 'upsert',
26
+ describe: 'Create or update a contact matched by --unique-id, --email or --phone',
27
+ builder: (y2) => y2
28
+ .option('unique-id', { type: 'string' }).option('email', { type: 'string' }).option('phone', { type: 'string' })
29
+ .option('first-name', { type: 'string' }).option('last-name', { type: 'string' })
30
+ .option('company', { type: 'string' }).option('job-title', { type: 'string' }),
31
+ handler: runCommand(async (a) => show(await request('POST', 'api/v1/contacts/upsert', {
32
+ uniqueId: a.uniqueId, email: a.email, phone: a.phone, firstName: a.firstName,
33
+ lastName: a.lastName, company: a.company, jobTitle: a.jobTitle,
34
+ }))),
35
+ })
36
+ .command({
37
+ command: 'custom-fields',
38
+ describe: 'List custom contact field definitions',
39
+ handler: runCommand(async () => show(await request('GET', 'api/v1/custom-fields'))),
40
+ })
41
+ .command({
42
+ command: 'sms <contactId> <body>',
43
+ describe: 'Send an SMS to a contact (opt-outs enforced)',
44
+ builder: (y2) => y2.positional('contactId', { type: 'number' }).positional('body', { type: 'string' }),
45
+ handler: runCommand(async (a) => show(await request('POST', 'api/v1/sms', { contactId: a.contactId, body: a.body }))),
46
+ })
47
+ .command({
48
+ command: 'whatsapp <contactId> <template>',
49
+ describe: 'Send a WhatsApp template message to a contact',
50
+ builder: (y2) => y2.positional('contactId', { type: 'number' }).positional('template', { type: 'string' })
51
+ .option('language', { type: 'string', default: 'en_US' })
52
+ .option('var', { type: 'array', describe: 'Template variable (repeatable)' })
53
+ .option('idempotency-key', { type: 'string', demandOption: true }),
54
+ handler: runCommand(async (a) => show(await request('POST', 'api/v1/whatsapp', {
55
+ contactId: a.contactId, templateName: a.template, language: a.language,
56
+ variables: (a.var || []).map(String), idempotencyKey: a.idempotencyKey,
57
+ }))),
58
+ })
59
+ .demandCommand(1, 'Specify: delete | upsert | custom-fields | sms | whatsapp'),
60
+ handler: () => {},
61
+ };
62
+
63
+ export { contactsApiCommand };
@@ -0,0 +1,24 @@
1
+ import { get, post } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+
4
+ // velaro conversation-action: REST actions on a conversation. Mirrors the conversation_action_send_message,
5
+ // conversation_action_resolve, conversation_action_assign and conversation_action_notes MCP tools.
6
+ export const conversationActionCommand = {
7
+ command: 'conversation-action <action> <id>',
8
+ describe: 'send | resolve | assign | notes on a conversation',
9
+ builder: y => y
10
+ .positional('action', { choices: ['send', 'resolve', 'assign', 'notes'] })
11
+ .positional('id', { type: 'number' })
12
+ .option('text', { type: 'string', describe: 'Message text (send)' })
13
+ .option('agent-id', { type: 'number', describe: 'Agent id (assign, optional for send/resolve)' })
14
+ .option('topic', { type: 'string', describe: 'Topic (resolve)' }),
15
+ handler: runCommand(async argv => {
16
+ const base = `/api/v1/conversations/${argv.id}`;
17
+ let d;
18
+ if (argv.action === 'send') d = await post(`${base}/messages`, { text: argv.text, agentId: argv.agentId });
19
+ else if (argv.action === 'resolve') d = await post(`${base}/resolve`, { topic: argv.topic, agentId: argv.agentId });
20
+ else if (argv.action === 'assign') d = await post(`${base}/assign`, { agentId: argv.agentId });
21
+ else d = await get(`${base}/notes`);
22
+ console.log(JSON.stringify(d, null, 2));
23
+ }),
24
+ };
@@ -42,7 +42,10 @@ export const publicApiCommand = {
42
42
  page: { type: 'number' }, 'page-size': { type: 'number' },
43
43
  }, (a) => show(a.id ? `/api/v1/appointments/${a.id}` : `/api/v1/appointments${qs({ status: a.status, from: a.from, to: a.to, page: a.page, pageSize: a['page-size'] })}`))
44
44
  .command('agents', 'List the site agents', {}, () => show('/api/v1/agents'))
45
- .command('teams', 'List the site teams', {}, () => show('/api/v1/teams'))
45
+ .command('agent-availability', 'Agent availability with a count per status', { team: { type: 'number', describe: 'limit to one team id' } }, (a) => show(`/api/v1/agents/availability${qs({ teamId: a.team })}`))
46
+ .command('teams [id]', 'List the site teams or fetch one with its members', {}, (a) => show(a.id ? `/api/v1/teams/${a.id}` : '/api/v1/teams'))
47
+ .command('webhook-events', 'List webhook event types and the signature scheme', {}, () => show('/api/v1/webhooks/events'))
48
+ .command('webhook-test <id>', 'Queue a signed test delivery to a webhook', {}, (a) => send('POST', `/api/v1/webhooks/${a.id}/test`, {}))
46
49
  .command('webhooks', 'List outbound webhook subscriptions', {}, () => show('/api/v1/webhooks'))
47
50
  .command('webhook-create <url>', 'Create a webhook (secret is shown once)', { events: { type: 'string', describe: 'comma separated: contact_tag_added,conversation_started,conversation_closed' } },
48
51
  (a) => send('POST', '/api/v1/webhooks', { url: a.url, events: a.events ? a.events.split(',') : undefined }))
@@ -50,6 +53,6 @@ export const publicApiCommand = {
50
53
  .command('note <contactId> <text>', 'Add a note to a contact', {}, (a) => send('POST', `/api/v1/contacts/${a.contactId}/notes`, { note: a.text }))
51
54
  .command('contact-update <id>', 'Partially update a contact (only the flags you pass change)', { email: { type: 'string' }, 'first-name': { type: 'string' }, 'last-name': { type: 'string' }, phone: { type: 'string' }, mobile: { type: 'string' }, company: { type: 'string' }, 'job-title': { type: 'string' } },
52
55
  (a) => send('PATCH', `/api/v1/contacts/${a.id}`, Object.fromEntries(Object.entries({ email: a.email, firstName: a['first-name'], lastName: a['last-name'], phone: a.phone, mobile: a.mobile, company: a.company, jobTitle: a['job-title'] }).filter(([, v]) => v !== undefined))))
53
- .demandCommand(1, 'Specify: conversations | appointments | agents | teams | webhooks | webhook-create | webhook-delete | note | contact-update'),
56
+ .demandCommand(1, 'Specify: conversations | appointments | agents | agent-availability | teams | webhooks | webhook-events | webhook-test | webhook-create | webhook-delete | note | contact-update'),
54
57
  handler: () => {},
55
58
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "1.4.215",
3
+ "version": "1.4.217",
4
4
  "description": "Velaro Workspace v20 — command-line interface for managing bots, knowledge base ingestion, MCP API keys, search indexes, and ops health.",
5
5
  "type": "module",
6
6
  "bin": {