@samva/webhooks 0.27.0 → 0.28.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/protocol.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as WebhookTimestampError, a as encodeWebhookSignature, c as signWebhook, d as webhookSignedContent, 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, u as verifyWebhookAtWithPublicKeys, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-DcQIkEck.js";
1
+ import { _ as WebhookTimestampError, a as encodeWebhookSignature, c as signWebhook, d as webhookSignedContent, 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, u as verifyWebhookAtWithPublicKeys, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-D6Od0Usw.js";
2
2
  export { DEFAULT_TOLERANCE_SECONDS, InvalidWebhookHeadersError, InvalidWebhookSecretError, MalformedWebhookPayloadError, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WebhookCryptoError, WebhookSignatureError, WebhookTimestampError, WebhookVerificationError, encodeWebhookSignature, generateWebhookSecret, isKnownEvent, readWebhookHeaders, signWebhook, verifyWebhookAt, verifyWebhookAtWithPublicKeys, webhookSignedContent };
@@ -240,6 +240,10 @@ export declare const MessageReceivedEventSchema: Schema.StructWithRest<Schema.St
240
240
  readonly errorMessage: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
241
241
  readonly parts: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Null]>>;
242
242
  readonly carrier: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
243
+ readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
244
+ readonly campaignId: Schema.String;
245
+ readonly runId: Schema.String;
246
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.Null]>>;
243
247
  readonly whatsapp: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
244
248
  readonly text: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
245
249
  readonly template: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
@@ -578,13 +582,15 @@ export declare const ContactSubscribedEventSchema: Schema.StructWithRest<Schema.
578
582
  readonly organizationId: Schema.String;
579
583
  readonly contactId: Schema.String;
580
584
  readonly email: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
581
- readonly groupId: Schema.String;
582
- readonly groupName: Schema.String;
583
- readonly contactGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
584
- readonly unsubscribeGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
585
+ readonly topicId: Schema.String;
586
+ readonly topicName: Schema.String;
587
+ readonly channel: Schema.Literals<readonly ["sms", "whatsapp", "email"]>;
585
588
  readonly consentIp: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
586
589
  readonly consentSource: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
587
- readonly source: Schema.Literals<readonly ["link", "api", "manual", "complaint"]>;
590
+ readonly source: Schema.String;
591
+ readonly formKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
592
+ readonly page: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
593
+ readonly referrer: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
588
594
  readonly messageId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
589
595
  readonly campaignId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
590
596
  readonly campaignRunId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
@@ -598,13 +604,15 @@ export declare const ContactUnsubscribedEventSchema: Schema.StructWithRest<Schem
598
604
  readonly organizationId: Schema.String;
599
605
  readonly contactId: Schema.String;
600
606
  readonly email: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
601
- readonly groupId: Schema.String;
602
- readonly groupName: Schema.String;
603
- readonly contactGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
604
- readonly unsubscribeGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
607
+ readonly topicId: Schema.String;
608
+ readonly topicName: Schema.String;
609
+ readonly channel: Schema.Literals<readonly ["sms", "whatsapp", "email"]>;
605
610
  readonly consentIp: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
606
611
  readonly consentSource: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
607
- readonly source: Schema.Literals<readonly ["link", "api", "manual", "complaint"]>;
612
+ readonly source: Schema.String;
613
+ readonly formKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
614
+ readonly page: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
615
+ readonly referrer: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
608
616
  readonly messageId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
609
617
  readonly campaignId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
610
618
  readonly campaignRunId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
@@ -618,13 +626,15 @@ export declare const ContactResubscribedEventSchema: Schema.StructWithRest<Schem
618
626
  readonly organizationId: Schema.String;
619
627
  readonly contactId: Schema.String;
620
628
  readonly email: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
621
- readonly groupId: Schema.String;
622
- readonly groupName: Schema.String;
623
- readonly contactGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
624
- readonly unsubscribeGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
629
+ readonly topicId: Schema.String;
630
+ readonly topicName: Schema.String;
631
+ readonly channel: Schema.Literals<readonly ["sms", "whatsapp", "email"]>;
625
632
  readonly consentIp: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
626
633
  readonly consentSource: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
627
- readonly source: Schema.Literals<readonly ["link", "api", "manual", "complaint"]>;
634
+ readonly source: Schema.String;
635
+ readonly formKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
636
+ readonly page: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
637
+ readonly referrer: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
628
638
  readonly messageId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
629
639
  readonly campaignId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
630
640
  readonly campaignRunId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
@@ -891,6 +901,10 @@ export declare const MailboxMessageReceivedEventSchema: Schema.StructWithRest<Sc
891
901
  readonly namespaceId: Schema.Union<readonly [Schema.String, Schema.Null]>;
892
902
  readonly message: Schema.StructWithRest<Schema.Struct<{
893
903
  readonly id: Schema.String;
904
+ readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
905
+ readonly campaignId: Schema.String;
906
+ readonly runId: Schema.String;
907
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.Null]>>;
894
908
  readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
895
909
  readonly threadId: Schema.String;
896
910
  readonly from: Schema.StructWithRest<Schema.Struct<{
@@ -935,6 +949,10 @@ export declare const MailboxMessageSentEventSchema: Schema.StructWithRest<Schema
935
949
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
936
950
  readonly message: Schema.StructWithRest<Schema.Struct<{
937
951
  readonly id: Schema.String;
952
+ readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
953
+ readonly campaignId: Schema.String;
954
+ readonly runId: Schema.String;
955
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.Null]>>;
938
956
  readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
939
957
  readonly threadId: Schema.String;
940
958
  readonly from: Schema.StructWithRest<Schema.Struct<{
@@ -1061,6 +1079,10 @@ export declare const MailboxMessageReleasedEventSchema: Schema.StructWithRest<Sc
1061
1079
  readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
1062
1080
  readonly message: Schema.StructWithRest<Schema.Struct<{
1063
1081
  readonly id: Schema.String;
1082
+ readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
1083
+ readonly campaignId: Schema.String;
1084
+ readonly runId: Schema.String;
1085
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.Null]>>;
1064
1086
  readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
1065
1087
  readonly threadId: Schema.String;
1066
1088
  readonly from: Schema.StructWithRest<Schema.Struct<{
@@ -1414,6 +1436,10 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1414
1436
  readonly errorMessage: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1415
1437
  readonly parts: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Null]>>;
1416
1438
  readonly carrier: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1439
+ readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
1440
+ readonly campaignId: Schema.String;
1441
+ readonly runId: Schema.String;
1442
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.Null]>>;
1417
1443
  readonly whatsapp: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
1418
1444
  readonly text: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1419
1445
  readonly template: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
@@ -1746,13 +1772,15 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1746
1772
  readonly organizationId: Schema.String;
1747
1773
  readonly contactId: Schema.String;
1748
1774
  readonly email: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1749
- readonly groupId: Schema.String;
1750
- readonly groupName: Schema.String;
1751
- readonly contactGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1752
- readonly unsubscribeGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1775
+ readonly topicId: Schema.String;
1776
+ readonly topicName: Schema.String;
1777
+ readonly channel: Schema.Literals<readonly ["sms", "whatsapp", "email"]>;
1753
1778
  readonly consentIp: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1754
1779
  readonly consentSource: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1755
- readonly source: Schema.Literals<readonly ["link", "api", "manual", "complaint"]>;
1780
+ readonly source: Schema.String;
1781
+ readonly formKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1782
+ readonly page: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1783
+ readonly referrer: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1756
1784
  readonly messageId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1757
1785
  readonly campaignId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1758
1786
  readonly campaignRunId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
@@ -1765,13 +1793,15 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1765
1793
  readonly organizationId: Schema.String;
1766
1794
  readonly contactId: Schema.String;
1767
1795
  readonly email: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1768
- readonly groupId: Schema.String;
1769
- readonly groupName: Schema.String;
1770
- readonly contactGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1771
- readonly unsubscribeGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1796
+ readonly topicId: Schema.String;
1797
+ readonly topicName: Schema.String;
1798
+ readonly channel: Schema.Literals<readonly ["sms", "whatsapp", "email"]>;
1772
1799
  readonly consentIp: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1773
1800
  readonly consentSource: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1774
- readonly source: Schema.Literals<readonly ["link", "api", "manual", "complaint"]>;
1801
+ readonly source: Schema.String;
1802
+ readonly formKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1803
+ readonly page: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1804
+ readonly referrer: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1775
1805
  readonly messageId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1776
1806
  readonly campaignId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1777
1807
  readonly campaignRunId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
@@ -1784,13 +1814,15 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1784
1814
  readonly organizationId: Schema.String;
1785
1815
  readonly contactId: Schema.String;
1786
1816
  readonly email: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1787
- readonly groupId: Schema.String;
1788
- readonly groupName: Schema.String;
1789
- readonly contactGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1790
- readonly unsubscribeGroupId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1817
+ readonly topicId: Schema.String;
1818
+ readonly topicName: Schema.String;
1819
+ readonly channel: Schema.Literals<readonly ["sms", "whatsapp", "email"]>;
1791
1820
  readonly consentIp: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1792
1821
  readonly consentSource: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1793
- readonly source: Schema.Literals<readonly ["link", "api", "manual", "complaint"]>;
1822
+ readonly source: Schema.String;
1823
+ readonly formKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1824
+ readonly page: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1825
+ readonly referrer: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1794
1826
  readonly messageId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1795
1827
  readonly campaignId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1796
1828
  readonly campaignRunId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
@@ -2043,6 +2075,10 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
2043
2075
  readonly namespaceId: Schema.Union<readonly [Schema.String, Schema.Null]>;
2044
2076
  readonly message: Schema.StructWithRest<Schema.Struct<{
2045
2077
  readonly id: Schema.String;
2078
+ readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
2079
+ readonly campaignId: Schema.String;
2080
+ readonly runId: Schema.String;
2081
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.Null]>>;
2046
2082
  readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
2047
2083
  readonly threadId: Schema.String;
2048
2084
  readonly from: Schema.StructWithRest<Schema.Struct<{
@@ -2086,6 +2122,10 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
2086
2122
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
2087
2123
  readonly message: Schema.StructWithRest<Schema.Struct<{
2088
2124
  readonly id: Schema.String;
2125
+ readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
2126
+ readonly campaignId: Schema.String;
2127
+ readonly runId: Schema.String;
2128
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.Null]>>;
2089
2129
  readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
2090
2130
  readonly threadId: Schema.String;
2091
2131
  readonly from: Schema.StructWithRest<Schema.Struct<{
@@ -2208,6 +2248,10 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
2208
2248
  readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
2209
2249
  readonly message: Schema.StructWithRest<Schema.Struct<{
2210
2250
  readonly id: Schema.String;
2251
+ readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
2252
+ readonly campaignId: Schema.String;
2253
+ readonly runId: Schema.String;
2254
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.Null]>>;
2211
2255
  readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
2212
2256
  readonly threadId: Schema.String;
2213
2257
  readonly from: Schema.StructWithRest<Schema.Struct<{
@@ -297,6 +297,10 @@ const MessageReceivedEventSchema = Schema.StructWithRest(Schema.Struct({
297
297
  errorMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
298
298
  parts: Schema.optionalKey(Schema.Union([Schema.Finite, Schema.Null])),
299
299
  carrier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
300
+ campaign: Schema.optionalKey(Schema.Union([Schema.StructWithRest(Schema.Struct({
301
+ campaignId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^camp_[0-9a-hjkmnp-tv-z]{16,24}$" })),
302
+ runId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^crun_[0-9a-hjkmnp-tv-z]{16,24}$" }))
303
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]), Schema.Null])),
300
304
  whatsapp: Schema.optionalKey(Schema.Union([Schema.StructWithRest(Schema.Struct({
301
305
  text: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
302
306
  template: Schema.optionalKey(Schema.Union([Schema.StructWithRest(Schema.Struct({
@@ -714,18 +718,19 @@ const ContactSubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
714
718
  organizationId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$" })),
715
719
  contactId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$" })),
716
720
  email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
717
- groupId: Schema.String,
718
- groupName: Schema.String,
719
- contactGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
720
- unsubscribeGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^unsub_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
721
+ topicId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^unsub_[0-9a-hjkmnp-tv-z]{16,24}$" })),
722
+ topicName: Schema.String,
723
+ channel: Schema.Literals([
724
+ "sms",
725
+ "whatsapp",
726
+ "email"
727
+ ]),
721
728
  consentIp: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
722
729
  consentSource: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
723
- source: Schema.Literals([
724
- "link",
725
- "api",
726
- "manual",
727
- "complaint"
728
- ]),
730
+ source: Schema.String,
731
+ formKey: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
732
+ page: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
733
+ referrer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
729
734
  messageId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^msg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
730
735
  campaignId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^camp_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
731
736
  campaignRunId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^crun_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
@@ -739,18 +744,19 @@ const ContactUnsubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
739
744
  organizationId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$" })),
740
745
  contactId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$" })),
741
746
  email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
742
- groupId: Schema.String,
743
- groupName: Schema.String,
744
- contactGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
745
- unsubscribeGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^unsub_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
747
+ topicId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^unsub_[0-9a-hjkmnp-tv-z]{16,24}$" })),
748
+ topicName: Schema.String,
749
+ channel: Schema.Literals([
750
+ "sms",
751
+ "whatsapp",
752
+ "email"
753
+ ]),
746
754
  consentIp: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
747
755
  consentSource: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
748
- source: Schema.Literals([
749
- "link",
750
- "api",
751
- "manual",
752
- "complaint"
753
- ]),
756
+ source: Schema.String,
757
+ formKey: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
758
+ page: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
759
+ referrer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
754
760
  messageId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^msg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
755
761
  campaignId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^camp_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
756
762
  campaignRunId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^crun_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
@@ -764,18 +770,19 @@ const ContactResubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
764
770
  organizationId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$" })),
765
771
  contactId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$" })),
766
772
  email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
767
- groupId: Schema.String,
768
- groupName: Schema.String,
769
- contactGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
770
- unsubscribeGroupId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^unsub_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
773
+ topicId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^unsub_[0-9a-hjkmnp-tv-z]{16,24}$" })),
774
+ topicName: Schema.String,
775
+ channel: Schema.Literals([
776
+ "sms",
777
+ "whatsapp",
778
+ "email"
779
+ ]),
771
780
  consentIp: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
772
781
  consentSource: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
773
- source: Schema.Literals([
774
- "link",
775
- "api",
776
- "manual",
777
- "complaint"
778
- ]),
782
+ source: Schema.String,
783
+ formKey: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
784
+ page: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
785
+ referrer: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
779
786
  messageId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^msg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
780
787
  campaignId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^camp_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
781
788
  campaignRunId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^crun_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null])),
@@ -1177,6 +1184,10 @@ const MailboxMessageReceivedEventSchema = Schema.StructWithRest(Schema.Struct({
1177
1184
  namespaceId: Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^ns_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^ns_[0-9a-hjkmnp-tv-z]{16,24}$" })), Schema.Null]),
1178
1185
  message: Schema.StructWithRest(Schema.Struct({
1179
1186
  id: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^msg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$" })),
1187
+ campaign: Schema.optionalKey(Schema.Union([Schema.StructWithRest(Schema.Struct({
1188
+ campaignId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^camp_[0-9a-hjkmnp-tv-z]{16,24}$" })),
1189
+ runId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^crun_[0-9a-hjkmnp-tv-z]{16,24}$" }))
1190
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]), Schema.Null])),
1180
1191
  channel: Schema.optionalKey(Schema.Literals([
1181
1192
  "email",
1182
1193
  "whatsapp",
@@ -1239,6 +1250,10 @@ const MailboxMessageSentEventSchema = Schema.StructWithRest(Schema.Struct({
1239
1250
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]),
1240
1251
  message: Schema.StructWithRest(Schema.Struct({
1241
1252
  id: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^msg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$" })),
1253
+ campaign: Schema.optionalKey(Schema.Union([Schema.StructWithRest(Schema.Struct({
1254
+ campaignId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^camp_[0-9a-hjkmnp-tv-z]{16,24}$" })),
1255
+ runId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^crun_[0-9a-hjkmnp-tv-z]{16,24}$" }))
1256
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]), Schema.Null])),
1242
1257
  channel: Schema.optionalKey(Schema.Literals([
1243
1258
  "email",
1244
1259
  "whatsapp",
@@ -1473,6 +1488,10 @@ const MailboxMessageReleasedEventSchema = Schema.StructWithRest(Schema.Struct({
1473
1488
  ]),
1474
1489
  message: Schema.StructWithRest(Schema.Struct({
1475
1490
  id: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^msg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$" })),
1491
+ campaign: Schema.optionalKey(Schema.Union([Schema.StructWithRest(Schema.Struct({
1492
+ campaignId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^camp_[0-9a-hjkmnp-tv-z]{16,24}$" })),
1493
+ runId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^crun_[0-9a-hjkmnp-tv-z]{16,24}$" }))
1494
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]), Schema.Null])),
1476
1495
  channel: Schema.optionalKey(Schema.Literals([
1477
1496
  "email",
1478
1497
  "whatsapp",
@@ -286,6 +286,12 @@ export type MessageReceivedEvent = {
286
286
  readonly errorMessage?: string | null;
287
287
  readonly parts?: number | null;
288
288
  readonly carrier?: string | null;
289
+ readonly campaign?: ({
290
+ readonly campaignId: string;
291
+ readonly runId: string;
292
+ } & {
293
+ readonly [x: string]: JsonValue;
294
+ }) | null;
289
295
  readonly whatsapp?: ({
290
296
  readonly text?: string | null;
291
297
  readonly template?: ({
@@ -766,13 +772,15 @@ export type ContactSubscribedEvent = {
766
772
  readonly organizationId: string;
767
773
  readonly contactId: string;
768
774
  readonly email?: string | null;
769
- readonly groupId: string;
770
- readonly groupName: string;
771
- readonly contactGroupId?: string | null;
772
- readonly unsubscribeGroupId?: string | null;
775
+ readonly topicId: string;
776
+ readonly topicName: string;
777
+ readonly channel: "sms" | "whatsapp" | "email";
773
778
  readonly consentIp?: string | null;
774
779
  readonly consentSource?: string | null;
775
- readonly source: "link" | "api" | "manual" | "complaint";
780
+ readonly source: string;
781
+ readonly formKey?: string | null;
782
+ readonly page?: string | null;
783
+ readonly referrer?: string | null;
776
784
  readonly messageId?: string | null;
777
785
  readonly campaignId?: string | null;
778
786
  readonly campaignRunId?: string | null;
@@ -791,13 +799,15 @@ export type ContactUnsubscribedEvent = {
791
799
  readonly organizationId: string;
792
800
  readonly contactId: string;
793
801
  readonly email?: string | null;
794
- readonly groupId: string;
795
- readonly groupName: string;
796
- readonly contactGroupId?: string | null;
797
- readonly unsubscribeGroupId?: string | null;
802
+ readonly topicId: string;
803
+ readonly topicName: string;
804
+ readonly channel: "sms" | "whatsapp" | "email";
798
805
  readonly consentIp?: string | null;
799
806
  readonly consentSource?: string | null;
800
- readonly source: "link" | "api" | "manual" | "complaint";
807
+ readonly source: string;
808
+ readonly formKey?: string | null;
809
+ readonly page?: string | null;
810
+ readonly referrer?: string | null;
801
811
  readonly messageId?: string | null;
802
812
  readonly campaignId?: string | null;
803
813
  readonly campaignRunId?: string | null;
@@ -816,13 +826,15 @@ export type ContactResubscribedEvent = {
816
826
  readonly organizationId: string;
817
827
  readonly contactId: string;
818
828
  readonly email?: string | null;
819
- readonly groupId: string;
820
- readonly groupName: string;
821
- readonly contactGroupId?: string | null;
822
- readonly unsubscribeGroupId?: string | null;
829
+ readonly topicId: string;
830
+ readonly topicName: string;
831
+ readonly channel: "sms" | "whatsapp" | "email";
823
832
  readonly consentIp?: string | null;
824
833
  readonly consentSource?: string | null;
825
- readonly source: "link" | "api" | "manual" | "complaint";
834
+ readonly source: string;
835
+ readonly formKey?: string | null;
836
+ readonly page?: string | null;
837
+ readonly referrer?: string | null;
826
838
  readonly messageId?: string | null;
827
839
  readonly campaignId?: string | null;
828
840
  readonly campaignRunId?: string | null;
@@ -1181,6 +1193,12 @@ export type MailboxMessageReceivedEvent = {
1181
1193
  readonly namespaceId: string | null;
1182
1194
  readonly message: {
1183
1195
  readonly id: string;
1196
+ readonly campaign?: ({
1197
+ readonly campaignId: string;
1198
+ readonly runId: string;
1199
+ } & {
1200
+ readonly [x: string]: JsonValue;
1201
+ }) | null;
1184
1202
  readonly channel?: "email" | "whatsapp" | "sms";
1185
1203
  readonly threadId: string;
1186
1204
  readonly from: {
@@ -1240,6 +1258,12 @@ export type MailboxMessageSentEvent = {
1240
1258
  };
1241
1259
  readonly message: {
1242
1260
  readonly id: string;
1261
+ readonly campaign?: ({
1262
+ readonly campaignId: string;
1263
+ readonly runId: string;
1264
+ } & {
1265
+ readonly [x: string]: JsonValue;
1266
+ }) | null;
1243
1267
  readonly channel?: "email" | "whatsapp" | "sms";
1244
1268
  readonly threadId: string;
1245
1269
  readonly from: {
@@ -1418,6 +1442,12 @@ export type MailboxMessageReleasedEvent = {
1418
1442
  readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "phishing" | "fraud" | "prompt_injection";
1419
1443
  readonly message: {
1420
1444
  readonly id: string;
1445
+ readonly campaign?: ({
1446
+ readonly campaignId: string;
1447
+ readonly runId: string;
1448
+ } & {
1449
+ readonly [x: string]: JsonValue;
1450
+ }) | null;
1421
1451
  readonly channel?: "email" | "whatsapp" | "sms";
1422
1452
  readonly threadId: string;
1423
1453
  readonly from: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/webhooks",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Runtime-neutral verification for Samva webhook deliveries",
5
5
  "keywords": [
6
6
  "samva",
@@ -11,13 +11,13 @@
11
11
  ],
12
12
  "homepage": "https://samva.dev",
13
13
  "bugs": {
14
- "url": "https://github.com/AryaLabsHQ/samva/issues"
14
+ "url": "https://github.com/SamvaHQ/samva-typescript/issues"
15
15
  },
16
16
  "license": "MIT",
17
17
  "author": "Arya Labs, Inc.",
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "https://github.com/AryaLabsHQ/samva.git",
20
+ "url": "https://github.com/SamvaHQ/samva-typescript.git",
21
21
  "directory": "packages/webhooks"
22
22
  },
23
23
  "files": [
@@ -60,8 +60,8 @@
60
60
  "prepack": "bun run build",
61
61
  "test": "bun run test:generation && vitest run --root ../.. --project packages packages/webhooks/tests",
62
62
  "typecheck": "tsc-rs --noEmit",
63
- "generate": "bun run --filter @samva/openapi fetch && bun run scripts/generate.ts",
64
- "test:generation": "bun run --filter @samva/openapi fetch && bun run scripts/generate.ts --check",
63
+ "generate": "bun run --filter @samva/openapi build && bun run scripts/generate.ts",
64
+ "test:generation": "bun run --filter @samva/openapi build && bun run scripts/generate.ts --check",
65
65
  "test:bundle": "bun run build && bun run scripts/check-bundle.ts"
66
66
  },
67
67
  "devDependencies": {