@samva/webhooks 0.15.0 → 0.17.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;
@@ -730,6 +1049,7 @@ export type MailboxMessageReceivedEvent = {
730
1049
  readonly namespaceId: string | null;
731
1050
  readonly message: {
732
1051
  readonly id: string;
1052
+ readonly channel?: "email" | "whatsapp" | "sms";
733
1053
  readonly threadId: string;
734
1054
  readonly from: {
735
1055
  readonly address: string;
@@ -756,6 +1076,7 @@ export type MailboxMessageReceivedEvent = {
756
1076
  };
757
1077
  readonly thread: {
758
1078
  readonly id: string;
1079
+ readonly endpointId?: string | null;
759
1080
  readonly subject: string | null;
760
1081
  readonly preview: string | null;
761
1082
  } & {
@@ -787,6 +1108,7 @@ export type MailboxMessageSentEvent = {
787
1108
  };
788
1109
  readonly message: {
789
1110
  readonly id: string;
1111
+ readonly channel?: "email" | "whatsapp" | "sms";
790
1112
  readonly threadId: string;
791
1113
  readonly from: {
792
1114
  readonly address: string;
@@ -911,6 +1233,7 @@ export type MailboxMessageReleasedEvent = {
911
1233
  readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "phishing" | "fraud" | "prompt_injection";
912
1234
  readonly message: {
913
1235
  readonly id: string;
1236
+ readonly channel?: "email" | "whatsapp" | "sms";
914
1237
  readonly threadId: string;
915
1238
  readonly from: {
916
1239
  readonly address: string;
@@ -937,6 +1260,7 @@ export type MailboxMessageReleasedEvent = {
937
1260
  };
938
1261
  readonly thread: {
939
1262
  readonly id: string;
1263
+ readonly endpointId?: string | null;
940
1264
  readonly subject: string | null;
941
1265
  readonly preview: string | null;
942
1266
  } & {
@@ -985,7 +1309,33 @@ export type MailboxMessageDiscardedEvent = {
985
1309
  readonly [x: string]: JsonValue;
986
1310
  };
987
1311
  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;
1312
+ export type JourneyWebhookEvent = {
1313
+ readonly type: "journey.webhook";
1314
+ readonly timestamp: string;
1315
+ readonly data: {
1316
+ readonly organizationId: string;
1317
+ readonly journeyId: string;
1318
+ readonly journeyVersion: number;
1319
+ readonly runId: string;
1320
+ readonly nodeId: string;
1321
+ readonly contact: {
1322
+ readonly id: string;
1323
+ readonly externalId: string | null;
1324
+ readonly email: string | null;
1325
+ } & {
1326
+ readonly [x: string]: JsonValue;
1327
+ };
1328
+ readonly data: {
1329
+ readonly [x: string]: JsonValue;
1330
+ };
1331
+ } & {
1332
+ readonly [x: string]: JsonValue;
1333
+ };
1334
+ } & {
1335
+ readonly [x: string]: JsonValue;
1336
+ };
1337
+ export type JourneyWebhookPayload = JourneyWebhookEvent["data"];
1338
+ 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 | JourneyWebhookEvent;
989
1339
  export interface UnknownWebhookEvent {
990
1340
  readonly type: string;
991
1341
  readonly timestamp: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/webhooks",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "Runtime-neutral verification for Samva webhook deliveries",
5
5
  "keywords": [
6
6
  "samva",