@samva/webhooks 0.14.0 → 0.16.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.
@@ -286,6 +286,286 @@ export type MessageReceivedEvent = {
286
286
  readonly errorMessage?: string | null;
287
287
  readonly parts?: number | null;
288
288
  readonly carrier?: string | null;
289
+ readonly whatsapp?: ({
290
+ readonly text?: string | null;
291
+ readonly template?: ({
292
+ readonly name: string;
293
+ readonly language: string;
294
+ readonly components: ReadonlyArray<{
295
+ readonly type: "header" | "body" | "footer" | "button";
296
+ readonly sub_type?: "url" | "quick_reply" | "copy_code" | null;
297
+ readonly index?: string | null;
298
+ readonly parameters: ReadonlyArray<{
299
+ readonly type: "text" | "currency" | "date_time" | "image" | "document" | "video" | "coupon_code";
300
+ readonly text?: string | null;
301
+ readonly currency?: ({
302
+ readonly fallback_value: string;
303
+ readonly code: string;
304
+ readonly amount_1000: number;
305
+ } & {
306
+ readonly [x: string]: JsonValue;
307
+ }) | null;
308
+ readonly date_time?: ({
309
+ readonly fallback_value: string;
310
+ } & {
311
+ readonly [x: string]: JsonValue;
312
+ }) | null;
313
+ readonly image?: ({
314
+ readonly link: string;
315
+ } & {
316
+ readonly [x: string]: JsonValue;
317
+ }) | null;
318
+ readonly document?: ({
319
+ readonly link: string;
320
+ readonly filename?: string | null;
321
+ } & {
322
+ readonly [x: string]: JsonValue;
323
+ }) | null;
324
+ readonly video?: ({
325
+ readonly link: string;
326
+ } & {
327
+ readonly [x: string]: JsonValue;
328
+ }) | null;
329
+ readonly coupon_code?: string | null;
330
+ } & {
331
+ readonly [x: string]: JsonValue;
332
+ }>;
333
+ } & {
334
+ readonly [x: string]: JsonValue;
335
+ }>;
336
+ } & {
337
+ readonly [x: string]: JsonValue;
338
+ }) | null;
339
+ readonly interactive?: ({
340
+ readonly type: "buttons";
341
+ readonly header?: ({
342
+ readonly type: "text";
343
+ readonly text: string;
344
+ } & {
345
+ readonly [x: string]: JsonValue;
346
+ }) | ({
347
+ readonly type: "image";
348
+ readonly url: string;
349
+ } & {
350
+ readonly [x: string]: JsonValue;
351
+ }) | ({
352
+ readonly type: "image";
353
+ readonly mediaId: string;
354
+ } & {
355
+ readonly [x: string]: JsonValue;
356
+ }) | ({
357
+ readonly type: "video";
358
+ readonly url: string;
359
+ } & {
360
+ readonly [x: string]: JsonValue;
361
+ }) | ({
362
+ readonly type: "video";
363
+ readonly mediaId: string;
364
+ } & {
365
+ readonly [x: string]: JsonValue;
366
+ }) | ({
367
+ readonly type: "document";
368
+ readonly filename?: string;
369
+ readonly url: string;
370
+ } & {
371
+ readonly [x: string]: JsonValue;
372
+ }) | ({
373
+ readonly type: "document";
374
+ readonly filename?: string;
375
+ readonly mediaId: string;
376
+ } & {
377
+ readonly [x: string]: JsonValue;
378
+ });
379
+ readonly body: string;
380
+ readonly footer?: string;
381
+ readonly buttons: ReadonlyArray<{
382
+ readonly id: string;
383
+ readonly title: string;
384
+ } & {
385
+ readonly [x: string]: JsonValue;
386
+ }>;
387
+ } & {
388
+ readonly [x: string]: JsonValue;
389
+ }) | ({
390
+ readonly type: "list";
391
+ readonly header?: {
392
+ readonly type: "text";
393
+ readonly text: string;
394
+ } & {
395
+ readonly [x: string]: JsonValue;
396
+ };
397
+ readonly body: string;
398
+ readonly footer?: string;
399
+ readonly button: string;
400
+ readonly sections: ReadonlyArray<{
401
+ readonly title?: string;
402
+ readonly rows: ReadonlyArray<{
403
+ readonly id: string;
404
+ readonly title: string;
405
+ readonly description?: string;
406
+ } & {
407
+ readonly [x: string]: JsonValue;
408
+ }>;
409
+ } & {
410
+ readonly [x: string]: JsonValue;
411
+ }>;
412
+ } & {
413
+ readonly [x: string]: JsonValue;
414
+ }) | ({
415
+ readonly type: "cta_url";
416
+ readonly header?: ({
417
+ readonly type: "text";
418
+ readonly text: string;
419
+ } & {
420
+ readonly [x: string]: JsonValue;
421
+ }) | ({
422
+ readonly type: "image";
423
+ readonly url: string;
424
+ } & {
425
+ readonly [x: string]: JsonValue;
426
+ }) | ({
427
+ readonly type: "image";
428
+ readonly mediaId: string;
429
+ } & {
430
+ readonly [x: string]: JsonValue;
431
+ }) | ({
432
+ readonly type: "video";
433
+ readonly url: string;
434
+ } & {
435
+ readonly [x: string]: JsonValue;
436
+ }) | ({
437
+ readonly type: "video";
438
+ readonly mediaId: string;
439
+ } & {
440
+ readonly [x: string]: JsonValue;
441
+ }) | ({
442
+ readonly type: "document";
443
+ readonly filename?: string;
444
+ readonly url: string;
445
+ } & {
446
+ readonly [x: string]: JsonValue;
447
+ }) | ({
448
+ readonly type: "document";
449
+ readonly filename?: string;
450
+ readonly mediaId: string;
451
+ } & {
452
+ readonly [x: string]: JsonValue;
453
+ });
454
+ readonly body: string;
455
+ readonly footer?: string;
456
+ readonly displayText: string;
457
+ readonly url: string;
458
+ } & {
459
+ readonly [x: string]: JsonValue;
460
+ });
461
+ readonly media?: ({
462
+ readonly type: "image" | "video" | "audio" | "document" | "sticker";
463
+ readonly url: string;
464
+ readonly caption?: string;
465
+ readonly filename?: string;
466
+ } & {
467
+ readonly [x: string]: JsonValue;
468
+ }) | ({
469
+ readonly type: "image" | "video" | "audio" | "document" | "sticker";
470
+ readonly mediaId: string;
471
+ readonly caption?: string;
472
+ readonly filename?: string;
473
+ } & {
474
+ readonly [x: string]: JsonValue;
475
+ }) | ({
476
+ readonly type: "image" | "video" | "audio" | "document" | "sticker";
477
+ readonly providerMediaId: string;
478
+ readonly mimeType?: string | null;
479
+ readonly caption?: string | null;
480
+ readonly filename?: string;
481
+ } & {
482
+ readonly [x: string]: JsonValue;
483
+ }) | null;
484
+ readonly reaction?: {
485
+ readonly messageId: string | null;
486
+ readonly providerMessageId: string;
487
+ readonly emoji: string | null;
488
+ } & {
489
+ readonly [x: string]: JsonValue;
490
+ };
491
+ readonly location?: {
492
+ readonly latitude: number;
493
+ readonly longitude: number;
494
+ readonly name?: string;
495
+ readonly address?: string;
496
+ readonly url?: string;
497
+ } & {
498
+ readonly [x: string]: JsonValue;
499
+ };
500
+ readonly contacts?: ReadonlyArray<{
501
+ readonly name?: {
502
+ readonly formattedName?: string;
503
+ readonly firstName?: string;
504
+ readonly lastName?: string;
505
+ readonly middleName?: string;
506
+ readonly prefix?: string;
507
+ readonly suffix?: string;
508
+ } & {
509
+ readonly [x: string]: JsonValue;
510
+ };
511
+ readonly phones?: ReadonlyArray<{
512
+ readonly phone?: string;
513
+ readonly type?: string;
514
+ readonly waId?: string;
515
+ } & {
516
+ readonly [x: string]: JsonValue;
517
+ }>;
518
+ readonly emails?: ReadonlyArray<{
519
+ readonly email?: string;
520
+ readonly type?: string;
521
+ } & {
522
+ readonly [x: string]: JsonValue;
523
+ }>;
524
+ readonly urls?: ReadonlyArray<{
525
+ readonly url?: string;
526
+ readonly type?: string;
527
+ } & {
528
+ readonly [x: string]: JsonValue;
529
+ }>;
530
+ readonly org?: {
531
+ readonly company?: string;
532
+ readonly department?: string;
533
+ readonly title?: string;
534
+ } & {
535
+ readonly [x: string]: JsonValue;
536
+ };
537
+ readonly addresses?: ReadonlyArray<{
538
+ readonly street?: string;
539
+ readonly city?: string;
540
+ readonly state?: string;
541
+ readonly zip?: string;
542
+ readonly country?: string;
543
+ readonly countryCode?: string;
544
+ readonly type?: string;
545
+ } & {
546
+ readonly [x: string]: JsonValue;
547
+ }>;
548
+ readonly birthday?: string;
549
+ } & {
550
+ readonly [x: string]: JsonValue;
551
+ }>;
552
+ readonly reply?: {
553
+ readonly type: "button" | "list" | "template_button";
554
+ readonly id: string;
555
+ readonly title: string;
556
+ readonly description?: string;
557
+ } & {
558
+ readonly [x: string]: JsonValue;
559
+ };
560
+ readonly context?: {
561
+ readonly messageId: string | null;
562
+ readonly providerMessageId: string;
563
+ } & {
564
+ readonly [x: string]: JsonValue;
565
+ };
566
+ } & {
567
+ readonly [x: string]: JsonValue;
568
+ }) | null;
289
569
  readonly messageId: string;
290
570
  readonly organizationId: string;
291
571
  } & {
@@ -722,6 +1002,45 @@ export type DomainWarmingUpdatedEvent = {
722
1002
  readonly [x: string]: JsonValue;
723
1003
  };
724
1004
  export type DomainWarmingUpdatedPayload = DomainWarmingUpdatedEvent["data"];
1005
+ export type TemplateRegistrationUpdatedEvent = {
1006
+ readonly type: "template.registration.updated";
1007
+ readonly timestamp: string;
1008
+ readonly data: {
1009
+ readonly id: string;
1010
+ readonly templateId: string;
1011
+ readonly publicationId: string;
1012
+ readonly target: ({
1013
+ readonly provider: "whatsapp";
1014
+ readonly wabaId: string;
1015
+ } & {
1016
+ readonly [x: string]: JsonValue;
1017
+ }) | ({
1018
+ readonly provider: "dlt";
1019
+ readonly entityId: string;
1020
+ readonly headerId: string;
1021
+ } & {
1022
+ readonly [x: string]: JsonValue;
1023
+ });
1024
+ readonly name: string;
1025
+ readonly language: string;
1026
+ readonly status: "draft" | "submitted" | "approved" | "rejected" | "paused" | "disabled";
1027
+ readonly category: "marketing" | "utility" | "authentication" | "transactional" | "service_implicit" | "service_explicit" | "promotional";
1028
+ readonly providerCategory: "marketing" | "utility" | "authentication" | "transactional" | "service_implicit" | "service_explicit" | "promotional" | null;
1029
+ readonly providerTemplateId: string | null;
1030
+ readonly reason: string | null;
1031
+ readonly submittedAt: string | null;
1032
+ readonly statusChangedAt: string;
1033
+ readonly createdAt: string;
1034
+ readonly updatedAt: string;
1035
+ readonly organizationId: string;
1036
+ readonly previousStatus: "draft" | "submitted" | "approved" | "rejected" | "paused" | "disabled";
1037
+ } & {
1038
+ readonly [x: string]: JsonValue;
1039
+ };
1040
+ } & {
1041
+ readonly [x: string]: JsonValue;
1042
+ };
1043
+ export type TemplateRegistrationUpdatedPayload = TemplateRegistrationUpdatedEvent["data"];
725
1044
  export type MailboxMessageReceivedEvent = {
726
1045
  readonly type: "mailbox.message.received";
727
1046
  readonly timestamp: string;
@@ -985,7 +1304,7 @@ export type MailboxMessageDiscardedEvent = {
985
1304
  readonly [x: string]: JsonValue;
986
1305
  };
987
1306
  export type MailboxMessageDiscardedPayload = MailboxMessageDiscardedEvent["data"];
988
- export type SamvaWebhookEvent = MessageSentEvent | MessageDeliveredEvent | MessageReadEvent | MessageFailedEvent | MessageBouncedEvent | MessageComplainedEvent | MessageReceivedEvent | MessageOpenedEvent | MessageClickedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactSubscribedEvent | ContactUnsubscribedEvent | ContactResubscribedEvent | ConversationCreatedEvent | ConversationUpdatedEvent | ConversationArchivedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | WebhookTestEvent | DomainUpdatedEvent | DomainWarmingUpdatedEvent | MailboxMessageReceivedEvent | MailboxMessageSentEvent | MailboxActionPendingApprovalEvent | MailboxMessageQuarantinedEvent | MailboxMessageReleasedEvent | MailboxMessageDiscardedEvent;
1307
+ export type SamvaWebhookEvent = MessageSentEvent | MessageDeliveredEvent | MessageReadEvent | MessageFailedEvent | MessageBouncedEvent | MessageComplainedEvent | MessageReceivedEvent | MessageOpenedEvent | MessageClickedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactSubscribedEvent | ContactUnsubscribedEvent | ContactResubscribedEvent | ConversationCreatedEvent | ConversationUpdatedEvent | ConversationArchivedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | WebhookTestEvent | DomainUpdatedEvent | DomainWarmingUpdatedEvent | TemplateRegistrationUpdatedEvent | MailboxMessageReceivedEvent | MailboxMessageSentEvent | MailboxActionPendingApprovalEvent | MailboxMessageQuarantinedEvent | MailboxMessageReleasedEvent | MailboxMessageDiscardedEvent;
989
1308
  export interface UnknownWebhookEvent {
990
1309
  readonly type: string;
991
1310
  readonly timestamp: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/webhooks",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Runtime-neutral verification for Samva webhook deliveries",
5
5
  "keywords": [
6
6
  "samva",