@velaro/cli 1.4.216 → 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
@@ -134,6 +134,7 @@ import { usageCommand } from '../lib/commands/usage.js';
134
134
  import { campaignsCommand } from '../lib/commands/campaigns.js';
135
135
  import { senderDomainHealthCommand } from '../lib/commands/sender-domain-health.js';
136
136
  import { contactsCommand } from '../lib/commands/contacts.js';
137
+ import { contactsApiCommand } from '../lib/commands/contacts-rest-extras.js';
137
138
  import { contactListCommand } from '../lib/commands/contact-list.js';
138
139
  import { contactSegmentCommand } from '../lib/commands/contact-segment.js';
139
140
  import { recycleBinCommand, aiUsageCommand, siteInfoCommand, billingReceiptsCommand } from '../lib/commands/endpoint-parity.js';
@@ -313,6 +314,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
313
314
  .command(campaignsCommand)
314
315
  .command(senderDomainHealthCommand)
315
316
  .command(contactsCommand)
317
+ .command(contactsApiCommand)
316
318
  .command(contactListCommand)
317
319
  .command(contactSegmentCommand)
318
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "1.4.216",
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": {