@samva/webhooks 0.18.0 → 0.19.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/dist/effect.js +4 -4
- package/dist/{json-schemas.gen-DC_ZmYw2.js → json-schemas.gen-CzhmDgcj.js} +475 -34
- package/dist/promise.js +2 -2
- package/dist/{protocol-GkuvvobW.js → protocol-BSGksDha.js} +266 -231
- package/dist/protocol.js +1 -1
- package/dist/schemas.gen.d.ts +207 -18
- package/dist/schemas.gen.js +218 -24
- package/dist/types.gen.d.ts +143 -10
- package/package.json +1 -1
package/dist/effect.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as WebhookTimestampError, c as signWebhook, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-
|
|
2
|
-
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-
|
|
3
|
-
import { 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 } from "./schemas.gen.js";
|
|
1
|
+
import { _ as WebhookTimestampError, c as signWebhook, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-BSGksDha.js";
|
|
2
|
+
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-CzhmDgcj.js";
|
|
3
|
+
import { 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 } from "./schemas.gen.js";
|
|
4
4
|
import { Clock, Effect } from "effect";
|
|
5
5
|
//#region src/effect.ts
|
|
6
6
|
/**
|
|
@@ -75,6 +75,6 @@ const verifyRequest = Effect.fn("Webhooks.verifyRequest")(function* (request, se
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
//#endregion
|
|
78
|
-
export { ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DEFAULT_TOLERANCE_SECONDS, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, InvalidWebhookHeadersError, InvalidWebhookSecretError, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MalformedWebhookPayloadError, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WebhookCreatedEventSchema, WebhookCryptoError, WebhookDeletedEventSchema, WebhookEventJsonSchemas, WebhookSignatureError, WebhookTestEventSchema, WebhookTimestampError, WebhookUpdatedEventSchema, WebhookVerificationError, generateWebhookSecret, isKnownEvent, signWebhook, verify, verifyRequest };
|
|
78
|
+
export { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DEFAULT_TOLERANCE_SECONDS, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, FlowRegistrationUpdatedEventSchema, InvalidWebhookHeadersError, InvalidWebhookSecretError, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxActionResolvedEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MalformedWebhookPayloadError, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WebhookCreatedEventSchema, WebhookCryptoError, WebhookDeletedEventSchema, WebhookEventJsonSchemas, WebhookSignatureError, WebhookTestEventSchema, WebhookTimestampError, WebhookUpdatedEventSchema, WebhookVerificationError, generateWebhookSecret, isKnownEvent, signWebhook, verify, verifyRequest };
|
|
79
79
|
|
|
80
80
|
//# sourceMappingURL=effect.js.map
|
|
@@ -835,10 +835,82 @@ const WebhookEventJsonSchemas = {
|
|
|
835
835
|
],
|
|
836
836
|
additionalProperties: true
|
|
837
837
|
},
|
|
838
|
-
|
|
838
|
+
WhatsAppTextHeader_1: {
|
|
839
|
+
type: "object",
|
|
840
|
+
properties: {
|
|
841
|
+
type: {
|
|
842
|
+
type: "string",
|
|
843
|
+
enum: ["text"]
|
|
844
|
+
},
|
|
845
|
+
text: {
|
|
846
|
+
type: "string",
|
|
847
|
+
minLength: 1,
|
|
848
|
+
maxLength: 60
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
required: ["type", "text"],
|
|
852
|
+
additionalProperties: true
|
|
853
|
+
},
|
|
854
|
+
WhatsAppFlowId: {
|
|
855
|
+
type: "string",
|
|
856
|
+
pattern: "^waflow_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
857
|
+
},
|
|
858
|
+
WhatsAppFlowVersionId: {
|
|
859
|
+
type: "string",
|
|
860
|
+
pattern: "^wafver_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
861
|
+
},
|
|
862
|
+
WhatsAppStoredFlowMessage: {
|
|
863
|
+
type: "object",
|
|
864
|
+
properties: {
|
|
865
|
+
type: {
|
|
866
|
+
type: "string",
|
|
867
|
+
enum: ["flow"]
|
|
868
|
+
},
|
|
869
|
+
header: { $ref: "#/$defs/WhatsAppTextHeader_1" },
|
|
870
|
+
body: {
|
|
871
|
+
type: "string",
|
|
872
|
+
minLength: 1,
|
|
873
|
+
maxLength: 1024
|
|
874
|
+
},
|
|
875
|
+
footer: {
|
|
876
|
+
type: "string",
|
|
877
|
+
minLength: 1,
|
|
878
|
+
maxLength: 60
|
|
879
|
+
},
|
|
880
|
+
flowId: { $ref: "#/$defs/WhatsAppFlowId" },
|
|
881
|
+
cta: {
|
|
882
|
+
type: "string",
|
|
883
|
+
minLength: 1,
|
|
884
|
+
maxLength: 30
|
|
885
|
+
},
|
|
886
|
+
token: {
|
|
887
|
+
type: "string",
|
|
888
|
+
minLength: 1,
|
|
889
|
+
maxLength: 1024
|
|
890
|
+
},
|
|
891
|
+
screen: {
|
|
892
|
+
type: "string",
|
|
893
|
+
pattern: "^[A-Za-z_]{1,100}$"
|
|
894
|
+
},
|
|
895
|
+
data: { type: "object" },
|
|
896
|
+
flowVersionId: { $ref: "#/$defs/WhatsAppFlowVersionId" },
|
|
897
|
+
providerFlowId: { type: "string" }
|
|
898
|
+
},
|
|
899
|
+
required: [
|
|
900
|
+
"type",
|
|
901
|
+
"body",
|
|
902
|
+
"flowId",
|
|
903
|
+
"cta",
|
|
904
|
+
"flowVersionId",
|
|
905
|
+
"providerFlowId"
|
|
906
|
+
],
|
|
907
|
+
additionalProperties: true
|
|
908
|
+
},
|
|
909
|
+
WhatsAppStoredInteractive: { anyOf: [
|
|
839
910
|
{ $ref: "#/$defs/WhatsAppButtonsMessage" },
|
|
840
911
|
{ $ref: "#/$defs/WhatsAppListMessage" },
|
|
841
|
-
{ $ref: "#/$defs/WhatsAppCtaUrlMessage" }
|
|
912
|
+
{ $ref: "#/$defs/WhatsAppCtaUrlMessage" },
|
|
913
|
+
{ $ref: "#/$defs/WhatsAppStoredFlowMessage" }
|
|
842
914
|
] },
|
|
843
915
|
WhatsAppStoredMedia: { anyOf: [
|
|
844
916
|
{
|
|
@@ -1033,6 +1105,16 @@ const WebhookEventJsonSchemas = {
|
|
|
1033
1105
|
],
|
|
1034
1106
|
additionalProperties: true
|
|
1035
1107
|
},
|
|
1108
|
+
WhatsAppReceivedFlowResponse: {
|
|
1109
|
+
type: "object",
|
|
1110
|
+
properties: {
|
|
1111
|
+
flowToken: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1112
|
+
response: { type: "object" },
|
|
1113
|
+
body: { type: "string" }
|
|
1114
|
+
},
|
|
1115
|
+
required: ["flowToken", "response"],
|
|
1116
|
+
additionalProperties: true
|
|
1117
|
+
},
|
|
1036
1118
|
WhatsAppMessageReference: {
|
|
1037
1119
|
type: "object",
|
|
1038
1120
|
properties: {
|
|
@@ -1152,7 +1234,7 @@ const WebhookEventJsonSchemas = {
|
|
|
1152
1234
|
],
|
|
1153
1235
|
additionalProperties: true
|
|
1154
1236
|
}, { type: "null" }] },
|
|
1155
|
-
interactive: { $ref: "#/$defs/
|
|
1237
|
+
interactive: { $ref: "#/$defs/WhatsAppStoredInteractive" },
|
|
1156
1238
|
media: { anyOf: [{ $ref: "#/$defs/WhatsAppStoredMedia" }, { type: "null" }] },
|
|
1157
1239
|
reaction: { $ref: "#/$defs/WhatsAppStoredReaction" },
|
|
1158
1240
|
location: { $ref: "#/$defs/WhatsAppStoredLocation" },
|
|
@@ -1161,6 +1243,7 @@ const WebhookEventJsonSchemas = {
|
|
|
1161
1243
|
items: { $ref: "#/$defs/WhatsAppStoredContactCard" }
|
|
1162
1244
|
},
|
|
1163
1245
|
reply: { $ref: "#/$defs/WhatsAppReceivedReply" },
|
|
1246
|
+
flowResponse: { $ref: "#/$defs/WhatsAppReceivedFlowResponse" },
|
|
1164
1247
|
context: { $ref: "#/$defs/WhatsAppMessageReference" }
|
|
1165
1248
|
},
|
|
1166
1249
|
additionalProperties: true
|
|
@@ -1412,19 +1495,15 @@ const WebhookEventJsonSchemas = {
|
|
|
1412
1495
|
ContactEventIdentity: {
|
|
1413
1496
|
type: "object",
|
|
1414
1497
|
properties: {
|
|
1415
|
-
|
|
1498
|
+
type: {
|
|
1416
1499
|
type: "string",
|
|
1417
|
-
enum: [
|
|
1418
|
-
"sms",
|
|
1419
|
-
"whatsapp",
|
|
1420
|
-
"email"
|
|
1421
|
-
]
|
|
1500
|
+
enum: ["email", "phone"]
|
|
1422
1501
|
},
|
|
1423
1502
|
identifier: { type: "string" },
|
|
1424
1503
|
verified: { type: "boolean" }
|
|
1425
1504
|
},
|
|
1426
1505
|
required: [
|
|
1427
|
-
"
|
|
1506
|
+
"type",
|
|
1428
1507
|
"identifier",
|
|
1429
1508
|
"verified"
|
|
1430
1509
|
],
|
|
@@ -1493,19 +1572,15 @@ const WebhookEventJsonSchemas = {
|
|
|
1493
1572
|
ContactEventIdentity: {
|
|
1494
1573
|
type: "object",
|
|
1495
1574
|
properties: {
|
|
1496
|
-
|
|
1575
|
+
type: {
|
|
1497
1576
|
type: "string",
|
|
1498
|
-
enum: [
|
|
1499
|
-
"sms",
|
|
1500
|
-
"whatsapp",
|
|
1501
|
-
"email"
|
|
1502
|
-
]
|
|
1577
|
+
enum: ["email", "phone"]
|
|
1503
1578
|
},
|
|
1504
1579
|
identifier: { type: "string" },
|
|
1505
1580
|
verified: { type: "boolean" }
|
|
1506
1581
|
},
|
|
1507
1582
|
required: [
|
|
1508
|
-
"
|
|
1583
|
+
"type",
|
|
1509
1584
|
"identifier",
|
|
1510
1585
|
"verified"
|
|
1511
1586
|
],
|
|
@@ -1574,19 +1649,15 @@ const WebhookEventJsonSchemas = {
|
|
|
1574
1649
|
ContactEventIdentity: {
|
|
1575
1650
|
type: "object",
|
|
1576
1651
|
properties: {
|
|
1577
|
-
|
|
1652
|
+
type: {
|
|
1578
1653
|
type: "string",
|
|
1579
|
-
enum: [
|
|
1580
|
-
"sms",
|
|
1581
|
-
"whatsapp",
|
|
1582
|
-
"email"
|
|
1583
|
-
]
|
|
1654
|
+
enum: ["email", "phone"]
|
|
1584
1655
|
},
|
|
1585
1656
|
identifier: { type: "string" },
|
|
1586
1657
|
verified: { type: "boolean" }
|
|
1587
1658
|
},
|
|
1588
1659
|
required: [
|
|
1589
|
-
"
|
|
1660
|
+
"type",
|
|
1590
1661
|
"identifier",
|
|
1591
1662
|
"verified"
|
|
1592
1663
|
],
|
|
@@ -1606,8 +1677,8 @@ const WebhookEventJsonSchemas = {
|
|
|
1606
1677
|
type: "object",
|
|
1607
1678
|
properties: {
|
|
1608
1679
|
organizationId: { $ref: "#/$defs/OrganizationId" },
|
|
1609
|
-
contactId: {
|
|
1610
|
-
email: { type: "string" },
|
|
1680
|
+
contactId: { $ref: "#/$defs/ContactId" },
|
|
1681
|
+
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1611
1682
|
groupId: { type: "string" },
|
|
1612
1683
|
groupName: { type: "string" },
|
|
1613
1684
|
contactGroupId: { anyOf: [{ $ref: "#/$defs/ContactGroupId" }, { type: "null" }] },
|
|
@@ -1631,7 +1702,6 @@ const WebhookEventJsonSchemas = {
|
|
|
1631
1702
|
required: [
|
|
1632
1703
|
"organizationId",
|
|
1633
1704
|
"contactId",
|
|
1634
|
-
"email",
|
|
1635
1705
|
"groupId",
|
|
1636
1706
|
"groupName",
|
|
1637
1707
|
"source",
|
|
@@ -1651,6 +1721,10 @@ const WebhookEventJsonSchemas = {
|
|
|
1651
1721
|
type: "string",
|
|
1652
1722
|
pattern: "^org_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1653
1723
|
},
|
|
1724
|
+
ContactId: {
|
|
1725
|
+
type: "string",
|
|
1726
|
+
pattern: "^contact_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1727
|
+
},
|
|
1654
1728
|
ContactGroupId: {
|
|
1655
1729
|
type: "string",
|
|
1656
1730
|
pattern: "^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
@@ -1685,8 +1759,8 @@ const WebhookEventJsonSchemas = {
|
|
|
1685
1759
|
type: "object",
|
|
1686
1760
|
properties: {
|
|
1687
1761
|
organizationId: { $ref: "#/$defs/OrganizationId" },
|
|
1688
|
-
contactId: {
|
|
1689
|
-
email: { type: "string" },
|
|
1762
|
+
contactId: { $ref: "#/$defs/ContactId" },
|
|
1763
|
+
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1690
1764
|
groupId: { type: "string" },
|
|
1691
1765
|
groupName: { type: "string" },
|
|
1692
1766
|
contactGroupId: { anyOf: [{ $ref: "#/$defs/ContactGroupId" }, { type: "null" }] },
|
|
@@ -1710,7 +1784,6 @@ const WebhookEventJsonSchemas = {
|
|
|
1710
1784
|
required: [
|
|
1711
1785
|
"organizationId",
|
|
1712
1786
|
"contactId",
|
|
1713
|
-
"email",
|
|
1714
1787
|
"groupId",
|
|
1715
1788
|
"groupName",
|
|
1716
1789
|
"source",
|
|
@@ -1730,6 +1803,10 @@ const WebhookEventJsonSchemas = {
|
|
|
1730
1803
|
type: "string",
|
|
1731
1804
|
pattern: "^org_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1732
1805
|
},
|
|
1806
|
+
ContactId: {
|
|
1807
|
+
type: "string",
|
|
1808
|
+
pattern: "^contact_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1809
|
+
},
|
|
1733
1810
|
ContactGroupId: {
|
|
1734
1811
|
type: "string",
|
|
1735
1812
|
pattern: "^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
@@ -1764,8 +1841,8 @@ const WebhookEventJsonSchemas = {
|
|
|
1764
1841
|
type: "object",
|
|
1765
1842
|
properties: {
|
|
1766
1843
|
organizationId: { $ref: "#/$defs/OrganizationId" },
|
|
1767
|
-
contactId: {
|
|
1768
|
-
email: { type: "string" },
|
|
1844
|
+
contactId: { $ref: "#/$defs/ContactId" },
|
|
1845
|
+
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1769
1846
|
groupId: { type: "string" },
|
|
1770
1847
|
groupName: { type: "string" },
|
|
1771
1848
|
contactGroupId: { anyOf: [{ $ref: "#/$defs/ContactGroupId" }, { type: "null" }] },
|
|
@@ -1789,7 +1866,6 @@ const WebhookEventJsonSchemas = {
|
|
|
1789
1866
|
required: [
|
|
1790
1867
|
"organizationId",
|
|
1791
1868
|
"contactId",
|
|
1792
|
-
"email",
|
|
1793
1869
|
"groupId",
|
|
1794
1870
|
"groupName",
|
|
1795
1871
|
"source",
|
|
@@ -1809,6 +1885,10 @@ const WebhookEventJsonSchemas = {
|
|
|
1809
1885
|
type: "string",
|
|
1810
1886
|
pattern: "^org_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1811
1887
|
},
|
|
1888
|
+
ContactId: {
|
|
1889
|
+
type: "string",
|
|
1890
|
+
pattern: "^contact_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1891
|
+
},
|
|
1812
1892
|
ContactGroupId: {
|
|
1813
1893
|
type: "string",
|
|
1814
1894
|
pattern: "^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
@@ -1831,6 +1911,89 @@ const WebhookEventJsonSchemas = {
|
|
|
1831
1911
|
}
|
|
1832
1912
|
}
|
|
1833
1913
|
},
|
|
1914
|
+
"contact.consent_changed": {
|
|
1915
|
+
type: "object",
|
|
1916
|
+
properties: {
|
|
1917
|
+
type: {
|
|
1918
|
+
type: "string",
|
|
1919
|
+
enum: ["contact.consent_changed"]
|
|
1920
|
+
},
|
|
1921
|
+
timestamp: { type: "string" },
|
|
1922
|
+
data: {
|
|
1923
|
+
type: "object",
|
|
1924
|
+
properties: {
|
|
1925
|
+
organizationId: { $ref: "#/$defs/OrganizationId" },
|
|
1926
|
+
contactId: { $ref: "#/$defs/ContactId" },
|
|
1927
|
+
identity: {
|
|
1928
|
+
type: "object",
|
|
1929
|
+
properties: {
|
|
1930
|
+
id: { $ref: "#/$defs/ContactIdentityId" },
|
|
1931
|
+
type: {
|
|
1932
|
+
type: "string",
|
|
1933
|
+
enum: ["email", "phone"]
|
|
1934
|
+
},
|
|
1935
|
+
identifier: { type: "string" }
|
|
1936
|
+
},
|
|
1937
|
+
required: [
|
|
1938
|
+
"id",
|
|
1939
|
+
"type",
|
|
1940
|
+
"identifier"
|
|
1941
|
+
],
|
|
1942
|
+
additionalProperties: true
|
|
1943
|
+
},
|
|
1944
|
+
channel: {
|
|
1945
|
+
type: "string",
|
|
1946
|
+
enum: [
|
|
1947
|
+
"sms",
|
|
1948
|
+
"whatsapp",
|
|
1949
|
+
"email"
|
|
1950
|
+
]
|
|
1951
|
+
},
|
|
1952
|
+
status: {
|
|
1953
|
+
type: "string",
|
|
1954
|
+
enum: ["opted_in", "opted_out"]
|
|
1955
|
+
},
|
|
1956
|
+
previousStatus: { anyOf: [{
|
|
1957
|
+
type: "string",
|
|
1958
|
+
enum: ["opted_in", "opted_out"]
|
|
1959
|
+
}, { type: "null" }] },
|
|
1960
|
+
source: { type: "string" },
|
|
1961
|
+
capturedAt: { type: "string" }
|
|
1962
|
+
},
|
|
1963
|
+
required: [
|
|
1964
|
+
"organizationId",
|
|
1965
|
+
"contactId",
|
|
1966
|
+
"identity",
|
|
1967
|
+
"channel",
|
|
1968
|
+
"status",
|
|
1969
|
+
"previousStatus",
|
|
1970
|
+
"source",
|
|
1971
|
+
"capturedAt"
|
|
1972
|
+
],
|
|
1973
|
+
additionalProperties: true
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1976
|
+
required: [
|
|
1977
|
+
"type",
|
|
1978
|
+
"timestamp",
|
|
1979
|
+
"data"
|
|
1980
|
+
],
|
|
1981
|
+
additionalProperties: true,
|
|
1982
|
+
$defs: {
|
|
1983
|
+
OrganizationId: {
|
|
1984
|
+
type: "string",
|
|
1985
|
+
pattern: "^org_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1986
|
+
},
|
|
1987
|
+
ContactId: {
|
|
1988
|
+
type: "string",
|
|
1989
|
+
pattern: "^contact_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1990
|
+
},
|
|
1991
|
+
ContactIdentityId: {
|
|
1992
|
+
type: "string",
|
|
1993
|
+
pattern: "^cident_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
},
|
|
1834
1997
|
"conversation.created": {
|
|
1835
1998
|
type: "object",
|
|
1836
1999
|
properties: {
|
|
@@ -2650,6 +2813,111 @@ const WebhookEventJsonSchemas = {
|
|
|
2650
2813
|
}
|
|
2651
2814
|
}
|
|
2652
2815
|
},
|
|
2816
|
+
"flow.registration.updated": {
|
|
2817
|
+
type: "object",
|
|
2818
|
+
properties: {
|
|
2819
|
+
type: {
|
|
2820
|
+
type: "string",
|
|
2821
|
+
enum: ["flow.registration.updated"]
|
|
2822
|
+
},
|
|
2823
|
+
timestamp: { type: "string" },
|
|
2824
|
+
data: {
|
|
2825
|
+
type: "object",
|
|
2826
|
+
properties: {
|
|
2827
|
+
id: { $ref: "#/$defs/WhatsAppFlowRegistrationId" },
|
|
2828
|
+
flowId: { $ref: "#/$defs/WhatsAppFlowId" },
|
|
2829
|
+
versionId: { $ref: "#/$defs/WhatsAppFlowVersionId" },
|
|
2830
|
+
versionNumber: { type: "integer" },
|
|
2831
|
+
wabaId: { type: "string" },
|
|
2832
|
+
providerFlowId: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
2833
|
+
name: { type: "string" },
|
|
2834
|
+
status: {
|
|
2835
|
+
type: "string",
|
|
2836
|
+
enum: [
|
|
2837
|
+
"draft",
|
|
2838
|
+
"published",
|
|
2839
|
+
"throttled",
|
|
2840
|
+
"blocked",
|
|
2841
|
+
"deprecated"
|
|
2842
|
+
]
|
|
2843
|
+
},
|
|
2844
|
+
validationErrors: {
|
|
2845
|
+
type: "array",
|
|
2846
|
+
items: { $ref: "#/$defs/WhatsAppFlowValidationError" }
|
|
2847
|
+
},
|
|
2848
|
+
publishedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
2849
|
+
statusChangedAt: { type: "string" },
|
|
2850
|
+
createdAt: { type: "string" },
|
|
2851
|
+
updatedAt: { type: "string" },
|
|
2852
|
+
organizationId: { $ref: "#/$defs/OrganizationId" },
|
|
2853
|
+
previousStatus: { anyOf: [{
|
|
2854
|
+
type: "string",
|
|
2855
|
+
enum: [
|
|
2856
|
+
"draft",
|
|
2857
|
+
"published",
|
|
2858
|
+
"throttled",
|
|
2859
|
+
"blocked",
|
|
2860
|
+
"deprecated"
|
|
2861
|
+
]
|
|
2862
|
+
}, { type: "null" }] }
|
|
2863
|
+
},
|
|
2864
|
+
required: [
|
|
2865
|
+
"id",
|
|
2866
|
+
"flowId",
|
|
2867
|
+
"versionId",
|
|
2868
|
+
"versionNumber",
|
|
2869
|
+
"wabaId",
|
|
2870
|
+
"providerFlowId",
|
|
2871
|
+
"name",
|
|
2872
|
+
"status",
|
|
2873
|
+
"validationErrors",
|
|
2874
|
+
"publishedAt",
|
|
2875
|
+
"statusChangedAt",
|
|
2876
|
+
"createdAt",
|
|
2877
|
+
"updatedAt",
|
|
2878
|
+
"organizationId",
|
|
2879
|
+
"previousStatus"
|
|
2880
|
+
],
|
|
2881
|
+
additionalProperties: true
|
|
2882
|
+
}
|
|
2883
|
+
},
|
|
2884
|
+
required: [
|
|
2885
|
+
"type",
|
|
2886
|
+
"timestamp",
|
|
2887
|
+
"data"
|
|
2888
|
+
],
|
|
2889
|
+
additionalProperties: true,
|
|
2890
|
+
$defs: {
|
|
2891
|
+
WhatsAppFlowRegistrationId: {
|
|
2892
|
+
type: "string",
|
|
2893
|
+
pattern: "^wafreg_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
2894
|
+
},
|
|
2895
|
+
WhatsAppFlowId: {
|
|
2896
|
+
type: "string",
|
|
2897
|
+
pattern: "^waflow_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
2898
|
+
},
|
|
2899
|
+
WhatsAppFlowVersionId: {
|
|
2900
|
+
type: "string",
|
|
2901
|
+
pattern: "^wafver_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
2902
|
+
},
|
|
2903
|
+
WhatsAppFlowValidationError: {
|
|
2904
|
+
type: "object",
|
|
2905
|
+
properties: {
|
|
2906
|
+
error: { type: "string" },
|
|
2907
|
+
message: { type: "string" },
|
|
2908
|
+
path: { type: "string" },
|
|
2909
|
+
line: { type: "integer" },
|
|
2910
|
+
column: { type: "integer" }
|
|
2911
|
+
},
|
|
2912
|
+
required: ["error", "message"],
|
|
2913
|
+
additionalProperties: true
|
|
2914
|
+
},
|
|
2915
|
+
OrganizationId: {
|
|
2916
|
+
type: "string",
|
|
2917
|
+
pattern: "^org_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
},
|
|
2653
2921
|
"mailbox.message.received": {
|
|
2654
2922
|
type: "object",
|
|
2655
2923
|
properties: {
|
|
@@ -3138,6 +3406,179 @@ const WebhookEventJsonSchemas = {
|
|
|
3138
3406
|
}
|
|
3139
3407
|
}
|
|
3140
3408
|
},
|
|
3409
|
+
"mailbox.action.resolved": {
|
|
3410
|
+
type: "object",
|
|
3411
|
+
properties: {
|
|
3412
|
+
type: {
|
|
3413
|
+
type: "string",
|
|
3414
|
+
enum: ["mailbox.action.resolved"]
|
|
3415
|
+
},
|
|
3416
|
+
timestamp: { type: "string" },
|
|
3417
|
+
data: {
|
|
3418
|
+
type: "object",
|
|
3419
|
+
properties: {
|
|
3420
|
+
mailboxId: { $ref: "#/$defs/MailboxId" },
|
|
3421
|
+
namespaceId: { anyOf: [{ $ref: "#/$defs/NamespaceId" }, { type: "null" }] },
|
|
3422
|
+
action: {
|
|
3423
|
+
type: "object",
|
|
3424
|
+
properties: {
|
|
3425
|
+
id: { $ref: "#/$defs/MailboxActionId" },
|
|
3426
|
+
type: {
|
|
3427
|
+
type: "string",
|
|
3428
|
+
enum: [
|
|
3429
|
+
"sendMessage",
|
|
3430
|
+
"reply",
|
|
3431
|
+
"updateDraft",
|
|
3432
|
+
"createNote",
|
|
3433
|
+
"assignThread",
|
|
3434
|
+
"changeThreadState",
|
|
3435
|
+
"call",
|
|
3436
|
+
"extensionRequest"
|
|
3437
|
+
]
|
|
3438
|
+
},
|
|
3439
|
+
threadId: { anyOf: [{ $ref: "#/$defs/MailboxThreadId" }, { type: "null" }] },
|
|
3440
|
+
proposedBy: {
|
|
3441
|
+
type: "object",
|
|
3442
|
+
properties: {
|
|
3443
|
+
kind: {
|
|
3444
|
+
type: "string",
|
|
3445
|
+
enum: [
|
|
3446
|
+
"user",
|
|
3447
|
+
"apiKey",
|
|
3448
|
+
"extension",
|
|
3449
|
+
"externalAgent",
|
|
3450
|
+
"samvaAgent",
|
|
3451
|
+
"system"
|
|
3452
|
+
]
|
|
3453
|
+
},
|
|
3454
|
+
id: { type: "string" },
|
|
3455
|
+
displayName: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
3456
|
+
source: {
|
|
3457
|
+
type: "string",
|
|
3458
|
+
enum: [
|
|
3459
|
+
"humanUi",
|
|
3460
|
+
"externalApi",
|
|
3461
|
+
"externalAgent",
|
|
3462
|
+
"extension",
|
|
3463
|
+
"system"
|
|
3464
|
+
]
|
|
3465
|
+
}
|
|
3466
|
+
},
|
|
3467
|
+
required: [
|
|
3468
|
+
"kind",
|
|
3469
|
+
"id",
|
|
3470
|
+
"source"
|
|
3471
|
+
],
|
|
3472
|
+
additionalProperties: true
|
|
3473
|
+
},
|
|
3474
|
+
createdAt: { type: "string" }
|
|
3475
|
+
},
|
|
3476
|
+
required: [
|
|
3477
|
+
"id",
|
|
3478
|
+
"type",
|
|
3479
|
+
"threadId",
|
|
3480
|
+
"proposedBy",
|
|
3481
|
+
"createdAt"
|
|
3482
|
+
],
|
|
3483
|
+
additionalProperties: true
|
|
3484
|
+
},
|
|
3485
|
+
resolution: { $ref: "#/$defs/MailboxActionResolution" }
|
|
3486
|
+
},
|
|
3487
|
+
required: [
|
|
3488
|
+
"mailboxId",
|
|
3489
|
+
"namespaceId",
|
|
3490
|
+
"action",
|
|
3491
|
+
"resolution"
|
|
3492
|
+
],
|
|
3493
|
+
additionalProperties: true
|
|
3494
|
+
}
|
|
3495
|
+
},
|
|
3496
|
+
required: [
|
|
3497
|
+
"type",
|
|
3498
|
+
"timestamp",
|
|
3499
|
+
"data"
|
|
3500
|
+
],
|
|
3501
|
+
additionalProperties: true,
|
|
3502
|
+
$defs: {
|
|
3503
|
+
MailboxId: {
|
|
3504
|
+
type: "string",
|
|
3505
|
+
pattern: "^mbx_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3506
|
+
},
|
|
3507
|
+
NamespaceId: {
|
|
3508
|
+
type: "string",
|
|
3509
|
+
pattern: "^ns_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3510
|
+
},
|
|
3511
|
+
MailboxActionId: {
|
|
3512
|
+
type: "string",
|
|
3513
|
+
pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3514
|
+
},
|
|
3515
|
+
MailboxThreadId: {
|
|
3516
|
+
type: "string",
|
|
3517
|
+
pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3518
|
+
},
|
|
3519
|
+
MailboxActionResolution: {
|
|
3520
|
+
type: "object",
|
|
3521
|
+
properties: {
|
|
3522
|
+
outcome: {
|
|
3523
|
+
type: "string",
|
|
3524
|
+
enum: [
|
|
3525
|
+
"approved",
|
|
3526
|
+
"denied",
|
|
3527
|
+
"cancelled"
|
|
3528
|
+
]
|
|
3529
|
+
},
|
|
3530
|
+
actor: {
|
|
3531
|
+
type: "object",
|
|
3532
|
+
properties: {
|
|
3533
|
+
kind: {
|
|
3534
|
+
type: "string",
|
|
3535
|
+
enum: [
|
|
3536
|
+
"user",
|
|
3537
|
+
"apiKey",
|
|
3538
|
+
"extension",
|
|
3539
|
+
"externalAgent",
|
|
3540
|
+
"samvaAgent",
|
|
3541
|
+
"system"
|
|
3542
|
+
]
|
|
3543
|
+
},
|
|
3544
|
+
id: { type: "string" },
|
|
3545
|
+
displayName: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
3546
|
+
source: {
|
|
3547
|
+
type: "string",
|
|
3548
|
+
enum: [
|
|
3549
|
+
"humanUi",
|
|
3550
|
+
"externalApi",
|
|
3551
|
+
"externalAgent",
|
|
3552
|
+
"extension",
|
|
3553
|
+
"system"
|
|
3554
|
+
]
|
|
3555
|
+
}
|
|
3556
|
+
},
|
|
3557
|
+
required: [
|
|
3558
|
+
"kind",
|
|
3559
|
+
"id",
|
|
3560
|
+
"source"
|
|
3561
|
+
],
|
|
3562
|
+
additionalProperties: true,
|
|
3563
|
+
description: "Who resolved the approval."
|
|
3564
|
+
},
|
|
3565
|
+
resolvedAt: { type: "string" },
|
|
3566
|
+
reason: {
|
|
3567
|
+
anyOf: [{ type: "string" }, { type: "null" }],
|
|
3568
|
+
description: "The denial reason; null for an approval or a cancellation."
|
|
3569
|
+
}
|
|
3570
|
+
},
|
|
3571
|
+
required: [
|
|
3572
|
+
"outcome",
|
|
3573
|
+
"actor",
|
|
3574
|
+
"resolvedAt",
|
|
3575
|
+
"reason"
|
|
3576
|
+
],
|
|
3577
|
+
additionalProperties: true,
|
|
3578
|
+
description: "How the action's approval ended."
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
},
|
|
3141
3582
|
"mailbox.message.quarantined": {
|
|
3142
3583
|
type: "object",
|
|
3143
3584
|
properties: {
|
|
@@ -3614,4 +4055,4 @@ const WebhookEventJsonSchemas = {
|
|
|
3614
4055
|
//#endregion
|
|
3615
4056
|
export { WebhookEventJsonSchemas as t };
|
|
3616
4057
|
|
|
3617
|
-
//# sourceMappingURL=json-schemas.gen-
|
|
4058
|
+
//# sourceMappingURL=json-schemas.gen-CzhmDgcj.js.map
|
package/dist/promise.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as WebhookTimestampError, c as signWebhook, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, s as readWebhookHeaders, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-
|
|
2
|
-
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-
|
|
1
|
+
import { _ as WebhookTimestampError, c as signWebhook, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, s as readWebhookHeaders, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-BSGksDha.js";
|
|
2
|
+
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-CzhmDgcj.js";
|
|
3
3
|
//#region src/promise.ts
|
|
4
4
|
/**
|
|
5
5
|
* Verifies a Samva webhook delivery from its body and header values, then returns its ID and
|