@samva/webhooks 0.18.0 → 0.20.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.
@@ -473,8 +473,30 @@ const MessageReceivedEventSchema = Schema.StructWithRest(Schema.Struct({
473
473
  footer: Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(60).annotate({ expected: "a string with at most 60 code points" }))),
474
474
  displayText: Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(20).annotate({ expected: "a string with at most 20 code points" })),
475
475
  url: Schema.String
476
- }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "WhatsAppCtaUrlMessage" })
477
- ]).annotate({ identifier: "WhatsAppInteractive" })),
476
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "WhatsAppCtaUrlMessage" }),
477
+ Schema.StructWithRest(Schema.Struct({
478
+ type: Schema.Literal("flow"),
479
+ header: Schema.optionalKey(Schema.StructWithRest(Schema.Struct({
480
+ type: Schema.Literal("text"),
481
+ text: Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(60).annotate({ expected: "a string with at most 60 code points" }))
482
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "WhatsAppTextHeader_1" })),
483
+ body: Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(1024).annotate({ expected: "a string with at most 1024 code points" })),
484
+ footer: Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(60).annotate({ expected: "a string with at most 60 code points" }))),
485
+ flowId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^waflow_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
486
+ expected: "a string matching the RegExp ^waflow_[0-9a-hjkmnp-tv-z]{16,24}$",
487
+ identifier: "WhatsAppFlowId"
488
+ })),
489
+ cta: Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(30).annotate({ expected: "a string with at most 30 code points" })),
490
+ token: Schema.optionalKey(Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(1024).annotate({ expected: "a string with at most 1024 code points" }))),
491
+ screen: Schema.optionalKey(Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^[A-Za-z_]{1,100}$", "u")).annotate({ expected: "a string matching the RegExp ^[A-Za-z_]{1,100}$" }))),
492
+ data: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))),
493
+ flowVersionId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^wafver_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
494
+ expected: "a string matching the RegExp ^wafver_[0-9a-hjkmnp-tv-z]{16,24}$",
495
+ identifier: "WhatsAppFlowVersionId"
496
+ })),
497
+ providerFlowId: Schema.String
498
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "WhatsAppStoredFlowMessage" })
499
+ ]).annotate({ identifier: "WhatsAppStoredInteractive" })),
478
500
  media: Schema.optionalKey(Schema.Union([Schema.Union([
479
501
  Schema.StructWithRest(Schema.Struct({
480
502
  type: Schema.Literals([
@@ -580,6 +602,11 @@ const MessageReceivedEventSchema = Schema.StructWithRest(Schema.Struct({
580
602
  title: Schema.String,
581
603
  description: Schema.optionalKey(Schema.String)
582
604
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "WhatsAppReceivedReply" })),
605
+ flowResponse: Schema.optionalKey(Schema.StructWithRest(Schema.Struct({
606
+ flowToken: Schema.Union([Schema.String, Schema.Null]),
607
+ response: Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })),
608
+ body: Schema.optionalKey(Schema.String)
609
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "WhatsAppReceivedFlowResponse" })),
583
610
  context: Schema.optionalKey(Schema.StructWithRest(Schema.Struct({
584
611
  messageId: Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^msg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
585
612
  expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$",
@@ -705,11 +732,7 @@ const ContactCreatedEventSchema = Schema.StructWithRest(Schema.Struct({
705
732
  name: Schema.String,
706
733
  displayName: Schema.optionalKey(Schema.Union([Schema.Union([Schema.String, Schema.Null]), Schema.Null])),
707
734
  identities: Schema.Array(Schema.StructWithRest(Schema.Struct({
708
- channel: Schema.Literals([
709
- "sms",
710
- "whatsapp",
711
- "email"
712
- ]),
735
+ type: Schema.Literals(["email", "phone"]),
713
736
  identifier: Schema.String,
714
737
  verified: Schema.Boolean
715
738
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "ContactEventIdentity" })),
@@ -736,11 +759,7 @@ const ContactUpdatedEventSchema = Schema.StructWithRest(Schema.Struct({
736
759
  name: Schema.String,
737
760
  displayName: Schema.optionalKey(Schema.Union([Schema.Union([Schema.String, Schema.Null]), Schema.Null])),
738
761
  identities: Schema.Array(Schema.StructWithRest(Schema.Struct({
739
- channel: Schema.Literals([
740
- "sms",
741
- "whatsapp",
742
- "email"
743
- ]),
762
+ type: Schema.Literals(["email", "phone"]),
744
763
  identifier: Schema.String,
745
764
  verified: Schema.Boolean
746
765
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "ContactEventIdentity" })),
@@ -767,11 +786,7 @@ const ContactDeletedEventSchema = Schema.StructWithRest(Schema.Struct({
767
786
  name: Schema.String,
768
787
  displayName: Schema.optionalKey(Schema.Union([Schema.Union([Schema.String, Schema.Null]), Schema.Null])),
769
788
  identities: Schema.Array(Schema.StructWithRest(Schema.Struct({
770
- channel: Schema.Literals([
771
- "sms",
772
- "whatsapp",
773
- "email"
774
- ]),
789
+ type: Schema.Literals(["email", "phone"]),
775
790
  identifier: Schema.String,
776
791
  verified: Schema.Boolean
777
792
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "ContactEventIdentity" })),
@@ -789,8 +804,11 @@ const ContactSubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
789
804
  expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$",
790
805
  identifier: "OrganizationId"
791
806
  })),
792
- contactId: Schema.Union([Schema.String, Schema.Null]),
793
- email: Schema.String,
807
+ contactId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
808
+ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$",
809
+ identifier: "ContactId"
810
+ })),
811
+ email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
794
812
  groupId: Schema.String,
795
813
  groupName: Schema.String,
796
814
  contactGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
@@ -832,8 +850,11 @@ const ContactUnsubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
832
850
  expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$",
833
851
  identifier: "OrganizationId"
834
852
  })),
835
- contactId: Schema.Union([Schema.String, Schema.Null]),
836
- email: Schema.String,
853
+ contactId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
854
+ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$",
855
+ identifier: "ContactId"
856
+ })),
857
+ email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
837
858
  groupId: Schema.String,
838
859
  groupName: Schema.String,
839
860
  contactGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
@@ -875,8 +896,11 @@ const ContactResubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
875
896
  expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$",
876
897
  identifier: "OrganizationId"
877
898
  })),
878
- contactId: Schema.Union([Schema.String, Schema.Null]),
879
- email: Schema.String,
899
+ contactId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
900
+ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$",
901
+ identifier: "ContactId"
902
+ })),
903
+ email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
880
904
  groupId: Schema.String,
881
905
  groupName: Schema.String,
882
906
  contactGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
@@ -910,6 +934,37 @@ const ContactResubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
910
934
  occurredAt: Schema.String
911
935
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
912
936
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]);
937
+ const ContactConsentChangedEventSchema = Schema.StructWithRest(Schema.Struct({
938
+ type: Schema.Literal("contact.consent_changed"),
939
+ timestamp: Schema.String,
940
+ data: Schema.StructWithRest(Schema.Struct({
941
+ organizationId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
942
+ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$",
943
+ identifier: "OrganizationId"
944
+ })),
945
+ contactId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
946
+ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$",
947
+ identifier: "ContactId"
948
+ })),
949
+ identity: Schema.StructWithRest(Schema.Struct({
950
+ id: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^cident_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
951
+ expected: "a string matching the RegExp ^cident_[0-9a-hjkmnp-tv-z]{16,24}$",
952
+ identifier: "ContactIdentityId"
953
+ })),
954
+ type: Schema.Literals(["email", "phone"]),
955
+ identifier: Schema.String
956
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]),
957
+ channel: Schema.Literals([
958
+ "sms",
959
+ "whatsapp",
960
+ "email"
961
+ ]),
962
+ status: Schema.Literals(["opted_in", "opted_out"]),
963
+ previousStatus: Schema.Union([Schema.Literals(["opted_in", "opted_out"]), Schema.Null]),
964
+ source: Schema.String,
965
+ capturedAt: Schema.String
966
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
967
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]);
913
968
  const ConversationCreatedEventSchema = Schema.StructWithRest(Schema.Struct({
914
969
  type: Schema.Literal("conversation.created"),
915
970
  timestamp: Schema.String,
@@ -1271,6 +1326,57 @@ const TemplateRegistrationUpdatedEventSchema = Schema.StructWithRest(Schema.Stru
1271
1326
  ])
1272
1327
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
1273
1328
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]);
1329
+ const FlowRegistrationUpdatedEventSchema = Schema.StructWithRest(Schema.Struct({
1330
+ type: Schema.Literal("flow.registration.updated"),
1331
+ timestamp: Schema.String,
1332
+ data: Schema.StructWithRest(Schema.Struct({
1333
+ id: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^wafreg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1334
+ expected: "a string matching the RegExp ^wafreg_[0-9a-hjkmnp-tv-z]{16,24}$",
1335
+ identifier: "WhatsAppFlowRegistrationId"
1336
+ })),
1337
+ flowId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^waflow_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1338
+ expected: "a string matching the RegExp ^waflow_[0-9a-hjkmnp-tv-z]{16,24}$",
1339
+ identifier: "WhatsAppFlowId"
1340
+ })),
1341
+ versionId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^wafver_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1342
+ expected: "a string matching the RegExp ^wafver_[0-9a-hjkmnp-tv-z]{16,24}$",
1343
+ identifier: "WhatsAppFlowVersionId"
1344
+ })),
1345
+ versionNumber: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })),
1346
+ wabaId: Schema.String,
1347
+ providerFlowId: Schema.Union([Schema.String, Schema.Null]),
1348
+ name: Schema.String,
1349
+ status: Schema.Literals([
1350
+ "draft",
1351
+ "published",
1352
+ "throttled",
1353
+ "blocked",
1354
+ "deprecated"
1355
+ ]),
1356
+ validationErrors: Schema.Array(Schema.StructWithRest(Schema.Struct({
1357
+ error: Schema.String,
1358
+ message: Schema.String,
1359
+ path: Schema.optionalKey(Schema.String),
1360
+ line: Schema.optionalKey(Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" }))),
1361
+ column: Schema.optionalKey(Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })))
1362
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ identifier: "WhatsAppFlowValidationError" })),
1363
+ publishedAt: Schema.Union([Schema.String, Schema.Null]),
1364
+ statusChangedAt: Schema.String,
1365
+ createdAt: Schema.String,
1366
+ updatedAt: Schema.String,
1367
+ organizationId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1368
+ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$",
1369
+ identifier: "OrganizationId"
1370
+ })),
1371
+ previousStatus: Schema.Union([Schema.Literals([
1372
+ "draft",
1373
+ "published",
1374
+ "throttled",
1375
+ "blocked",
1376
+ "deprecated"
1377
+ ]), Schema.Null])
1378
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
1379
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]);
1274
1380
  const MailboxMessageReceivedEventSchema = Schema.StructWithRest(Schema.Struct({
1275
1381
  type: Schema.Literal("mailbox.message.received"),
1276
1382
  timestamp: Schema.String,
@@ -1492,6 +1598,91 @@ const MailboxActionPendingApprovalEventSchema = Schema.StructWithRest(Schema.Str
1492
1598
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
1493
1599
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
1494
1600
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]);
1601
+ const MailboxActionResolvedEventSchema = Schema.StructWithRest(Schema.Struct({
1602
+ type: Schema.Literal("mailbox.action.resolved"),
1603
+ timestamp: Schema.String,
1604
+ data: Schema.StructWithRest(Schema.Struct({
1605
+ mailboxId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^mbx_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1606
+ expected: "a string matching the RegExp ^mbx_[0-9a-hjkmnp-tv-z]{16,24}$",
1607
+ identifier: "MailboxId"
1608
+ })),
1609
+ namespaceId: Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^ns_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1610
+ expected: "a string matching the RegExp ^ns_[0-9a-hjkmnp-tv-z]{16,24}$",
1611
+ identifier: "NamespaceId"
1612
+ })), Schema.Null]),
1613
+ action: Schema.StructWithRest(Schema.Struct({
1614
+ id: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1615
+ expected: "a string matching the RegExp ^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
1616
+ identifier: "MailboxActionId"
1617
+ })),
1618
+ type: Schema.Literals([
1619
+ "sendMessage",
1620
+ "reply",
1621
+ "updateDraft",
1622
+ "createNote",
1623
+ "assignThread",
1624
+ "changeThreadState",
1625
+ "call",
1626
+ "extensionRequest"
1627
+ ]),
1628
+ threadId: Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^thread_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1629
+ expected: "a string matching the RegExp ^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
1630
+ identifier: "MailboxThreadId"
1631
+ })), Schema.Null]),
1632
+ proposedBy: Schema.StructWithRest(Schema.Struct({
1633
+ kind: Schema.Literals([
1634
+ "user",
1635
+ "apiKey",
1636
+ "extension",
1637
+ "externalAgent",
1638
+ "samvaAgent",
1639
+ "system"
1640
+ ]),
1641
+ id: Schema.String,
1642
+ displayName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
1643
+ source: Schema.Literals([
1644
+ "humanUi",
1645
+ "externalApi",
1646
+ "externalAgent",
1647
+ "extension",
1648
+ "system"
1649
+ ])
1650
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]),
1651
+ createdAt: Schema.String
1652
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]),
1653
+ resolution: Schema.StructWithRest(Schema.Struct({
1654
+ outcome: Schema.Literals([
1655
+ "approved",
1656
+ "denied",
1657
+ "cancelled"
1658
+ ]),
1659
+ actor: Schema.StructWithRest(Schema.Struct({
1660
+ kind: Schema.Literals([
1661
+ "user",
1662
+ "apiKey",
1663
+ "extension",
1664
+ "externalAgent",
1665
+ "samvaAgent",
1666
+ "system"
1667
+ ]),
1668
+ id: Schema.String,
1669
+ displayName: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
1670
+ source: Schema.Literals([
1671
+ "humanUi",
1672
+ "externalApi",
1673
+ "externalAgent",
1674
+ "extension",
1675
+ "system"
1676
+ ])
1677
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({ description: "Who resolved the approval." }),
1678
+ resolvedAt: Schema.String,
1679
+ reason: Schema.Union([Schema.String, Schema.Null]).annotate({ description: "The denial reason; null for an approval or a cancellation." })
1680
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]).annotate({
1681
+ description: "How the action's approval ended.",
1682
+ identifier: "MailboxActionResolution"
1683
+ })
1684
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
1685
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]);
1495
1686
  const MailboxMessageQuarantinedEventSchema = Schema.StructWithRest(Schema.Struct({
1496
1687
  type: Schema.Literal("mailbox.message.quarantined"),
1497
1688
  timestamp: Schema.String,
@@ -1720,6 +1911,7 @@ const SamvaWebhookEventSchema = Schema.Union([
1720
1911
  ContactSubscribedEventSchema,
1721
1912
  ContactUnsubscribedEventSchema,
1722
1913
  ContactResubscribedEventSchema,
1914
+ ContactConsentChangedEventSchema,
1723
1915
  ConversationCreatedEventSchema,
1724
1916
  ConversationUpdatedEventSchema,
1725
1917
  ConversationArchivedEventSchema,
@@ -1730,15 +1922,17 @@ const SamvaWebhookEventSchema = Schema.Union([
1730
1922
  DomainUpdatedEventSchema,
1731
1923
  DomainWarmingUpdatedEventSchema,
1732
1924
  TemplateRegistrationUpdatedEventSchema,
1925
+ FlowRegistrationUpdatedEventSchema,
1733
1926
  MailboxMessageReceivedEventSchema,
1734
1927
  MailboxMessageSentEventSchema,
1735
1928
  MailboxActionPendingApprovalEventSchema,
1929
+ MailboxActionResolvedEventSchema,
1736
1930
  MailboxMessageQuarantinedEventSchema,
1737
1931
  MailboxMessageReleasedEventSchema,
1738
1932
  MailboxMessageDiscardedEventSchema,
1739
1933
  JourneyWebhookEventSchema
1740
1934
  ]);
1741
1935
  //#endregion
1742
- export { ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WebhookCreatedEventSchema, WebhookDeletedEventSchema, WebhookTestEventSchema, WebhookUpdatedEventSchema };
1936
+ export { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, FlowRegistrationUpdatedEventSchema, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxActionResolvedEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WebhookCreatedEventSchema, WebhookDeletedEventSchema, WebhookTestEventSchema, WebhookUpdatedEventSchema };
1743
1937
 
1744
1938
  //# sourceMappingURL=schemas.gen.js.map
@@ -457,6 +457,27 @@ export type MessageReceivedEvent = {
457
457
  readonly url: string;
458
458
  } & {
459
459
  readonly [x: string]: JsonValue;
460
+ }) | ({
461
+ readonly type: "flow";
462
+ readonly header?: {
463
+ readonly type: "text";
464
+ readonly text: string;
465
+ } & {
466
+ readonly [x: string]: JsonValue;
467
+ };
468
+ readonly body: string;
469
+ readonly footer?: string;
470
+ readonly flowId: string;
471
+ readonly cta: string;
472
+ readonly token?: string;
473
+ readonly screen?: string;
474
+ readonly data?: {
475
+ readonly [x: string]: JsonValue;
476
+ };
477
+ readonly flowVersionId: string;
478
+ readonly providerFlowId: string;
479
+ } & {
480
+ readonly [x: string]: JsonValue;
460
481
  });
461
482
  readonly media?: ({
462
483
  readonly type: "image" | "video" | "audio" | "document" | "sticker";
@@ -557,6 +578,15 @@ export type MessageReceivedEvent = {
557
578
  } & {
558
579
  readonly [x: string]: JsonValue;
559
580
  };
581
+ readonly flowResponse?: {
582
+ readonly flowToken: string | null;
583
+ readonly response: {
584
+ readonly [x: string]: JsonValue;
585
+ };
586
+ readonly body?: string;
587
+ } & {
588
+ readonly [x: string]: JsonValue;
589
+ };
560
590
  readonly context?: {
561
591
  readonly messageId: string | null;
562
592
  readonly providerMessageId: string;
@@ -654,7 +684,7 @@ export type ContactCreatedEvent = {
654
684
  readonly name: string;
655
685
  readonly displayName?: string | null | null;
656
686
  readonly identities: ReadonlyArray<{
657
- readonly channel: "sms" | "whatsapp" | "email";
687
+ readonly type: "email" | "phone";
658
688
  readonly identifier: string;
659
689
  readonly verified: boolean;
660
690
  } & {
@@ -680,7 +710,7 @@ export type ContactUpdatedEvent = {
680
710
  readonly name: string;
681
711
  readonly displayName?: string | null | null;
682
712
  readonly identities: ReadonlyArray<{
683
- readonly channel: "sms" | "whatsapp" | "email";
713
+ readonly type: "email" | "phone";
684
714
  readonly identifier: string;
685
715
  readonly verified: boolean;
686
716
  } & {
@@ -706,7 +736,7 @@ export type ContactDeletedEvent = {
706
736
  readonly name: string;
707
737
  readonly displayName?: string | null | null;
708
738
  readonly identities: ReadonlyArray<{
709
- readonly channel: "sms" | "whatsapp" | "email";
739
+ readonly type: "email" | "phone";
710
740
  readonly identifier: string;
711
741
  readonly verified: boolean;
712
742
  } & {
@@ -728,8 +758,8 @@ export type ContactSubscribedEvent = {
728
758
  readonly timestamp: string;
729
759
  readonly data: {
730
760
  readonly organizationId: string;
731
- readonly contactId: string | null;
732
- readonly email: string;
761
+ readonly contactId: string;
762
+ readonly email?: string | null;
733
763
  readonly groupId: string;
734
764
  readonly groupName: string;
735
765
  readonly contactGroupId?: string | null;
@@ -753,8 +783,8 @@ export type ContactUnsubscribedEvent = {
753
783
  readonly timestamp: string;
754
784
  readonly data: {
755
785
  readonly organizationId: string;
756
- readonly contactId: string | null;
757
- readonly email: string;
786
+ readonly contactId: string;
787
+ readonly email?: string | null;
758
788
  readonly groupId: string;
759
789
  readonly groupName: string;
760
790
  readonly contactGroupId?: string | null;
@@ -778,8 +808,8 @@ export type ContactResubscribedEvent = {
778
808
  readonly timestamp: string;
779
809
  readonly data: {
780
810
  readonly organizationId: string;
781
- readonly contactId: string | null;
782
- readonly email: string;
811
+ readonly contactId: string;
812
+ readonly email?: string | null;
783
813
  readonly groupId: string;
784
814
  readonly groupName: string;
785
815
  readonly contactGroupId?: string | null;
@@ -798,6 +828,31 @@ export type ContactResubscribedEvent = {
798
828
  readonly [x: string]: JsonValue;
799
829
  };
800
830
  export type ContactResubscribedPayload = ContactResubscribedEvent["data"];
831
+ export type ContactConsentChangedEvent = {
832
+ readonly type: "contact.consent_changed";
833
+ readonly timestamp: string;
834
+ readonly data: {
835
+ readonly organizationId: string;
836
+ readonly contactId: string;
837
+ readonly identity: {
838
+ readonly id: string;
839
+ readonly type: "email" | "phone";
840
+ readonly identifier: string;
841
+ } & {
842
+ readonly [x: string]: JsonValue;
843
+ };
844
+ readonly channel: "sms" | "whatsapp" | "email";
845
+ readonly status: "opted_in" | "opted_out";
846
+ readonly previousStatus: "opted_in" | "opted_out" | null;
847
+ readonly source: string;
848
+ readonly capturedAt: string;
849
+ } & {
850
+ readonly [x: string]: JsonValue;
851
+ };
852
+ } & {
853
+ readonly [x: string]: JsonValue;
854
+ };
855
+ export type ContactConsentChangedPayload = ContactConsentChangedEvent["data"];
801
856
  export type ConversationCreatedEvent = {
802
857
  readonly type: "conversation.created";
803
858
  readonly timestamp: string;
@@ -1041,6 +1096,40 @@ export type TemplateRegistrationUpdatedEvent = {
1041
1096
  readonly [x: string]: JsonValue;
1042
1097
  };
1043
1098
  export type TemplateRegistrationUpdatedPayload = TemplateRegistrationUpdatedEvent["data"];
1099
+ export type FlowRegistrationUpdatedEvent = {
1100
+ readonly type: "flow.registration.updated";
1101
+ readonly timestamp: string;
1102
+ readonly data: {
1103
+ readonly id: string;
1104
+ readonly flowId: string;
1105
+ readonly versionId: string;
1106
+ readonly versionNumber: number;
1107
+ readonly wabaId: string;
1108
+ readonly providerFlowId: string | null;
1109
+ readonly name: string;
1110
+ readonly status: "draft" | "published" | "throttled" | "blocked" | "deprecated";
1111
+ readonly validationErrors: ReadonlyArray<{
1112
+ readonly error: string;
1113
+ readonly message: string;
1114
+ readonly path?: string;
1115
+ readonly line?: number;
1116
+ readonly column?: number;
1117
+ } & {
1118
+ readonly [x: string]: JsonValue;
1119
+ }>;
1120
+ readonly publishedAt: string | null;
1121
+ readonly statusChangedAt: string;
1122
+ readonly createdAt: string;
1123
+ readonly updatedAt: string;
1124
+ readonly organizationId: string;
1125
+ readonly previousStatus: "draft" | "published" | "throttled" | "blocked" | "deprecated" | null;
1126
+ } & {
1127
+ readonly [x: string]: JsonValue;
1128
+ };
1129
+ } & {
1130
+ readonly [x: string]: JsonValue;
1131
+ };
1132
+ export type FlowRegistrationUpdatedPayload = FlowRegistrationUpdatedEvent["data"];
1044
1133
  export type MailboxMessageReceivedEvent = {
1045
1134
  readonly type: "mailbox.message.received";
1046
1135
  readonly timestamp: string;
@@ -1187,6 +1276,50 @@ export type MailboxActionPendingApprovalEvent = {
1187
1276
  readonly [x: string]: JsonValue;
1188
1277
  };
1189
1278
  export type MailboxActionPendingApprovalPayload = MailboxActionPendingApprovalEvent["data"];
1279
+ export type MailboxActionResolvedEvent = {
1280
+ readonly type: "mailbox.action.resolved";
1281
+ readonly timestamp: string;
1282
+ readonly data: {
1283
+ readonly mailboxId: string;
1284
+ readonly namespaceId: string | null;
1285
+ readonly action: {
1286
+ readonly id: string;
1287
+ readonly type: "sendMessage" | "reply" | "updateDraft" | "createNote" | "assignThread" | "changeThreadState" | "call" | "extensionRequest";
1288
+ readonly threadId: string | null;
1289
+ readonly proposedBy: {
1290
+ readonly kind: "user" | "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system";
1291
+ readonly id: string;
1292
+ readonly displayName?: string | null;
1293
+ readonly source: "humanUi" | "externalApi" | "externalAgent" | "extension" | "system";
1294
+ } & {
1295
+ readonly [x: string]: JsonValue;
1296
+ };
1297
+ readonly createdAt: string;
1298
+ } & {
1299
+ readonly [x: string]: JsonValue;
1300
+ };
1301
+ readonly resolution: {
1302
+ readonly outcome: "approved" | "denied" | "cancelled";
1303
+ readonly actor: {
1304
+ readonly kind: "user" | "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system";
1305
+ readonly id: string;
1306
+ readonly displayName?: string | null;
1307
+ readonly source: "humanUi" | "externalApi" | "externalAgent" | "extension" | "system";
1308
+ } & {
1309
+ readonly [x: string]: JsonValue;
1310
+ };
1311
+ readonly resolvedAt: string;
1312
+ readonly reason: string | null;
1313
+ } & {
1314
+ readonly [x: string]: JsonValue;
1315
+ };
1316
+ } & {
1317
+ readonly [x: string]: JsonValue;
1318
+ };
1319
+ } & {
1320
+ readonly [x: string]: JsonValue;
1321
+ };
1322
+ export type MailboxActionResolvedPayload = MailboxActionResolvedEvent["data"];
1190
1323
  export type MailboxMessageQuarantinedEvent = {
1191
1324
  readonly type: "mailbox.message.quarantined";
1192
1325
  readonly timestamp: string;
@@ -1335,7 +1468,7 @@ export type JourneyWebhookEvent = {
1335
1468
  readonly [x: string]: JsonValue;
1336
1469
  };
1337
1470
  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;
1471
+ export type SamvaWebhookEvent = MessageSentEvent | MessageDeliveredEvent | MessageReadEvent | MessageFailedEvent | MessageBouncedEvent | MessageComplainedEvent | MessageReceivedEvent | MessageOpenedEvent | MessageClickedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactSubscribedEvent | ContactUnsubscribedEvent | ContactResubscribedEvent | ContactConsentChangedEvent | ConversationCreatedEvent | ConversationUpdatedEvent | ConversationArchivedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | WebhookTestEvent | DomainUpdatedEvent | DomainWarmingUpdatedEvent | TemplateRegistrationUpdatedEvent | FlowRegistrationUpdatedEvent | MailboxMessageReceivedEvent | MailboxMessageSentEvent | MailboxActionPendingApprovalEvent | MailboxActionResolvedEvent | MailboxMessageQuarantinedEvent | MailboxMessageReleasedEvent | MailboxMessageDiscardedEvent | JourneyWebhookEvent;
1339
1472
  export interface UnknownWebhookEvent {
1340
1473
  readonly type: string;
1341
1474
  readonly timestamp: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/webhooks",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Runtime-neutral verification for Samva webhook deliveries",
5
5
  "keywords": [
6
6
  "samva",