@absolutejs/voice 0.0.22-beta.210 → 0.0.22-beta.211

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/README.md +110 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -479,6 +479,116 @@ The UI should keep the scheduling flow simple: microphone, transcript, selected
479
479
 
480
480
  This recipe covers the hosted-platform expectations that matter for appointment scheduling: scheduling tools, deterministic tool proof, post-call confirmation work, outcome validation, simulation proof, production readiness, and one call-log replacement for debugging.
481
481
 
482
+ ## Use-Case Recipe: Campaign Outreach
483
+
484
+ Use this path when you need Retell/Bland-style outbound outreach without handing recipients, consent proof, attempt policy, carrier outcomes, or debugging records to a hosted campaign dashboard. The package gives you campaign primitives; your app decides who can upload recipients, when workers run, which carrier dials, and how campaign results sync back to your product.
485
+
486
+ The production shape is:
487
+
488
+ 1. Store campaigns in app-owned storage.
489
+ 2. Import recipients with consent checks, phone validation, dedupe, variables, and rejected-row evidence.
490
+ 3. Configure campaign policy for max attempts, concurrency, attempt windows, quiet hours, rate limits, and retry backoff.
491
+ 4. Use a carrier dialer or your own dialer function, then apply Twilio/Telnyx/Plivo webhook outcomes back to attempts.
492
+ 5. Expose campaign routes, observability, readiness proof, production readiness, and operations-record links for every attempted call.
493
+
494
+ ```ts
495
+ import { Elysia } from 'elysia';
496
+ import {
497
+ createVoiceCampaignRoutes,
498
+ createVoiceFileRuntimeStorage,
499
+ createVoiceOperationsRecordRoutes,
500
+ createVoiceProductionReadinessRoutes,
501
+ createVoiceReadinessProfile,
502
+ createVoiceSQLiteCampaignStore,
503
+ runVoiceCampaignReadinessProof
504
+ } from '@absolutejs/voice';
505
+
506
+ const runtime = createVoiceFileRuntimeStorage({
507
+ directory: '.voice-runtime/campaign-outreach'
508
+ });
509
+
510
+ const campaigns = createVoiceSQLiteCampaignStore({
511
+ path: '.voice-runtime/campaigns.sqlite'
512
+ });
513
+
514
+ const app = new Elysia()
515
+ .use(
516
+ createVoiceCampaignRoutes({
517
+ htmlPath: '/voice/campaigns',
518
+ operationsRecordHref: '/voice-operations/:sessionId',
519
+ path: '/api/voice/campaigns',
520
+ store: campaigns,
521
+ title: 'Renewal Outreach'
522
+ })
523
+ )
524
+ .use(
525
+ createVoiceOperationsRecordRoutes({
526
+ htmlPath: '/voice-operations/:sessionId',
527
+ path: '/api/voice-operations/:sessionId',
528
+ store: runtime.traces
529
+ })
530
+ )
531
+ .use(
532
+ createVoiceProductionReadinessRoutes({
533
+ ...createVoiceReadinessProfile('phone-agent', {
534
+ campaignReadiness: () =>
535
+ runVoiceCampaignReadinessProof({
536
+ store: campaigns
537
+ }),
538
+ explain: true
539
+ }),
540
+ links: {
541
+ campaigns: '/voice/campaigns',
542
+ operationsRecords: '/voice-operations/:sessionId'
543
+ },
544
+ store: runtime.traces
545
+ })
546
+ );
547
+
548
+ await fetch('/api/voice/campaigns', {
549
+ body: JSON.stringify({
550
+ maxAttempts: 3,
551
+ maxConcurrentAttempts: 10,
552
+ name: 'Renewal outreach',
553
+ schedule: {
554
+ attemptWindow: { startHour: 9, endHour: 17 },
555
+ quietHours: { startHour: 12, endHour: 13 },
556
+ rateLimit: { maxAttempts: 60, windowMs: 60_000 },
557
+ retryPolicy: { backoffMs: [5 * 60_000, 30 * 60_000] }
558
+ }
559
+ }),
560
+ headers: { 'content-type': 'application/json' },
561
+ method: 'POST'
562
+ });
563
+
564
+ await fetch('/api/voice/campaigns/campaign-1/recipients/import', {
565
+ body: JSON.stringify({
566
+ csv: `id,name,phone,consent,segment
567
+ recipient-1,Ada,+15550001001,yes,trial
568
+ recipient-2,Grace,+15550001002,true,enterprise
569
+ recipient-3,Linus,not-a-phone,yes,partner
570
+ recipient-4,Barbara,+15550001004,no,trial`,
571
+ metadataColumns: ['segment'],
572
+ requireConsent: true,
573
+ variableColumns: ['segment']
574
+ }),
575
+ headers: { 'content-type': 'application/json' },
576
+ method: 'POST'
577
+ });
578
+
579
+ await fetch('/api/voice/campaigns/campaign-1/enqueue', {
580
+ method: 'POST'
581
+ });
582
+ ```
583
+
584
+ Use `/api/voice/campaigns/campaign-1/tick` for manual workers or `createVoiceCampaignWorkerLoop(...)` when the app should continuously drain eligible recipients. The runtime enforces the campaign policy on each tick, so parallel workers do not double-start recipients and attempts respect quiet hours, rate limits, retry backoff, and max attempts.
585
+
586
+ For production carrier dialing, pass a `dialer` to `createVoiceCampaignRoutes(...)`: `createVoiceTwilioCampaignDialer(...)`, `createVoiceTelnyxCampaignDialer(...)`, `createVoicePlivoCampaignDialer(...)`, or a custom dialer that starts the call and returns an external call id. Run `runVoiceCampaignDialerProof(...)` before live traffic to dry-run carrier request metadata and webhook outcome application.
587
+
588
+ The UI should show `/voice/campaigns`, `/voice/campaigns/observability`, `/api/voice/campaigns/readiness-proof`, `/production-readiness`, and operations-record links for recent attempts. If a recipient failed, the operator should open the campaign attempt, follow `/voice-operations/:sessionId`, and see the same trace/review/task/audit context used by support and phone-agent flows.
589
+
590
+ This recipe covers the hosted-platform expectations that matter for campaign outreach: recipient import evidence, consent/dedupe checks, scheduling policy, worker-safe attempts, carrier dry-run proof, webhook outcome mapping, queue observability, readiness gating, and call-log replacement links.
591
+
482
592
  ## How This Differs From Hosted Voice Platforms
483
593
 
484
594
  Hosted voice-agent platforms are strongest when you want a managed dashboard, phone-number provisioning, hosted orchestration, and campaign tooling out of the box.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.210",
3
+ "version": "0.0.22-beta.211",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",