@startanaicompany/crm 2.7.0 → 2.8.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/index.js +27 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -444,8 +444,10 @@ leadsCmd
|
|
|
444
444
|
.option('--tag <tag>', 'Filter by tag — repeatable, AND logic', (v, prev) => prev.concat([v]), [])
|
|
445
445
|
.option('--api-key-id <id>', 'Filter by the API key ID that created the lead')
|
|
446
446
|
.option('--self', 'Filter leads created by the current API key (shorthand for --api-key-id self)')
|
|
447
|
-
.option('--sort-by <field>', 'Sort field: created_at|updated_at|deal_value|name|company|last_activity_at|status_changed_at')
|
|
447
|
+
.option('--sort-by <field>', 'Sort field: created_at|updated_at|deal_value|name|company|last_activity_at|status_changed_at|score')
|
|
448
448
|
.option('--order <dir>', 'Sort direction: asc|desc', 'desc')
|
|
449
|
+
.option('--score-min <n>', 'Filter leads with score >= n (0-100)')
|
|
450
|
+
.option('--score-max <n>', 'Filter leads with score <= n (0-100)')
|
|
449
451
|
.option('--created-after <date>', 'Filter leads created after this ISO8601 date (e.g. 2026-01-01T00:00:00Z)')
|
|
450
452
|
.option('--created-before <date>', 'Filter leads created before this ISO8601 date')
|
|
451
453
|
.option('--updated-after <date>', 'Filter leads updated after this ISO8601 date')
|
|
@@ -467,6 +469,8 @@ leadsCmd
|
|
|
467
469
|
...(apiKeyIdFilter && { api_key_id: apiKeyIdFilter }),
|
|
468
470
|
...(opts.sortBy && { sort_by: opts.sortBy }),
|
|
469
471
|
...(opts.order && { order: opts.order }),
|
|
472
|
+
...(opts.scoreMin !== undefined && { score_min: opts.scoreMin }),
|
|
473
|
+
...(opts.scoreMax !== undefined && { score_max: opts.scoreMax }),
|
|
470
474
|
...(opts.createdAfter && { created_after: opts.createdAfter }),
|
|
471
475
|
...(opts.createdBefore && { created_before: opts.createdBefore }),
|
|
472
476
|
...(opts.updatedAfter && { updated_after: opts.updatedAfter }),
|
|
@@ -514,9 +518,30 @@ leadsCmd
|
|
|
514
518
|
}
|
|
515
519
|
});
|
|
516
520
|
|
|
521
|
+
leadsCmd
|
|
522
|
+
.command('score')
|
|
523
|
+
.description('Set lead score (0-100). Conventions: 0-19 Cold, 20-39 Warm, 40-59 Developing, 60-79 Qualified, 80-100 Hot')
|
|
524
|
+
.requiredOption('--id <uuid>', 'Lead UUID')
|
|
525
|
+
.requiredOption('--score <n>', 'Score value (0-100 integer)')
|
|
526
|
+
.option('--reason <text>', 'Score reason/explanation')
|
|
527
|
+
.action(async (opts) => {
|
|
528
|
+
const globalOpts = program.opts();
|
|
529
|
+
const client = getClient(globalOpts);
|
|
530
|
+
const body = {
|
|
531
|
+
score: parseInt(opts.score),
|
|
532
|
+
...(opts.reason && { score_reason: opts.reason })
|
|
533
|
+
};
|
|
534
|
+
try {
|
|
535
|
+
const res = await client.patch(`/leads/${opts.id}/score`, body);
|
|
536
|
+
printJSON(res.data);
|
|
537
|
+
} catch (err) {
|
|
538
|
+
handleError(err);
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
|
|
517
542
|
leadsCmd
|
|
518
543
|
.command('get <id>')
|
|
519
|
-
.description('Get a single lead by ID')
|
|
544
|
+
.description('Get a single lead by ID (includes activity_summary)')
|
|
520
545
|
.action(async (id) => {
|
|
521
546
|
const globalOpts = program.opts();
|
|
522
547
|
const client = getClient(globalOpts);
|