@polymorfa/sdk 0.1.0-dev.20260922093854

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.
Files changed (347) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1881 -0
  3. package/dist/bridge.d.ts +31 -0
  4. package/dist/bridge.d.ts.map +1 -0
  5. package/dist/bridge.js +39 -0
  6. package/dist/bridge.js.map +1 -0
  7. package/dist/calls/api.d.ts +109 -0
  8. package/dist/calls/api.d.ts.map +1 -0
  9. package/dist/calls/api.js +179 -0
  10. package/dist/calls/api.js.map +1 -0
  11. package/dist/calls/call.d.ts +286 -0
  12. package/dist/calls/call.d.ts.map +1 -0
  13. package/dist/calls/call.js +860 -0
  14. package/dist/calls/call.js.map +1 -0
  15. package/dist/calls/client.d.ts +124 -0
  16. package/dist/calls/client.d.ts.map +1 -0
  17. package/dist/calls/client.js +447 -0
  18. package/dist/calls/client.js.map +1 -0
  19. package/dist/calls/diagnostics.d.ts +74 -0
  20. package/dist/calls/diagnostics.d.ts.map +1 -0
  21. package/dist/calls/diagnostics.js +133 -0
  22. package/dist/calls/diagnostics.js.map +1 -0
  23. package/dist/calls/errors.d.ts +37 -0
  24. package/dist/calls/errors.d.ts.map +1 -0
  25. package/dist/calls/errors.js +52 -0
  26. package/dist/calls/errors.js.map +1 -0
  27. package/dist/calls/events.d.ts +15 -0
  28. package/dist/calls/events.d.ts.map +1 -0
  29. package/dist/calls/events.js +34 -0
  30. package/dist/calls/events.js.map +1 -0
  31. package/dist/calls/index.d.ts +6 -0
  32. package/dist/calls/index.d.ts.map +1 -0
  33. package/dist/calls/index.js +7 -0
  34. package/dist/calls/index.js.map +1 -0
  35. package/dist/calls/internal.d.ts +18 -0
  36. package/dist/calls/internal.d.ts.map +1 -0
  37. package/dist/calls/internal.js +18 -0
  38. package/dist/calls/internal.js.map +1 -0
  39. package/dist/calls/lifecycle.d.ts +111 -0
  40. package/dist/calls/lifecycle.d.ts.map +1 -0
  41. package/dist/calls/lifecycle.js +490 -0
  42. package/dist/calls/lifecycle.js.map +1 -0
  43. package/dist/calls/media.d.ts +102 -0
  44. package/dist/calls/media.d.ts.map +1 -0
  45. package/dist/calls/media.js +414 -0
  46. package/dist/calls/media.js.map +1 -0
  47. package/dist/calls/protocol.d.ts +216 -0
  48. package/dist/calls/protocol.d.ts.map +1 -0
  49. package/dist/calls/protocol.js +268 -0
  50. package/dist/calls/protocol.js.map +1 -0
  51. package/dist/calls/token.d.ts +43 -0
  52. package/dist/calls/token.d.ts.map +1 -0
  53. package/dist/calls/token.js +146 -0
  54. package/dist/calls/token.js.map +1 -0
  55. package/dist/client.d.ts +65 -0
  56. package/dist/client.d.ts.map +1 -0
  57. package/dist/client.js +119 -0
  58. package/dist/client.js.map +1 -0
  59. package/dist/credentials.d.ts +50 -0
  60. package/dist/credentials.d.ts.map +1 -0
  61. package/dist/credentials.js +73 -0
  62. package/dist/credentials.js.map +1 -0
  63. package/dist/errors.d.ts +71 -0
  64. package/dist/errors.d.ts.map +1 -0
  65. package/dist/errors.js +129 -0
  66. package/dist/errors.js.map +1 -0
  67. package/dist/index.d.ts +70 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +61 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/media/whatsapp.d.ts +105 -0
  72. package/dist/media/whatsapp.d.ts.map +1 -0
  73. package/dist/media/whatsapp.js +624 -0
  74. package/dist/media/whatsapp.js.map +1 -0
  75. package/dist/messaging/bansafe.d.ts +30 -0
  76. package/dist/messaging/bansafe.d.ts.map +1 -0
  77. package/dist/messaging/bansafe.js +86 -0
  78. package/dist/messaging/bansafe.js.map +1 -0
  79. package/dist/messaging/business.d.ts +35 -0
  80. package/dist/messaging/business.d.ts.map +1 -0
  81. package/dist/messaging/business.js +145 -0
  82. package/dist/messaging/business.js.map +1 -0
  83. package/dist/messaging/calls.d.ts +9 -0
  84. package/dist/messaging/calls.d.ts.map +1 -0
  85. package/dist/messaging/calls.js +16 -0
  86. package/dist/messaging/calls.js.map +1 -0
  87. package/dist/messaging/campaigns.d.ts +19 -0
  88. package/dist/messaging/campaigns.d.ts.map +1 -0
  89. package/dist/messaging/campaigns.js +77 -0
  90. package/dist/messaging/campaigns.js.map +1 -0
  91. package/dist/messaging/channels.d.ts +23 -0
  92. package/dist/messaging/channels.d.ts.map +1 -0
  93. package/dist/messaging/channels.js +104 -0
  94. package/dist/messaging/channels.js.map +1 -0
  95. package/dist/messaging/chats.d.ts +14 -0
  96. package/dist/messaging/chats.d.ts.map +1 -0
  97. package/dist/messaging/chats.js +51 -0
  98. package/dist/messaging/chats.js.map +1 -0
  99. package/dist/messaging/client-tokens.d.ts +15 -0
  100. package/dist/messaging/client-tokens.d.ts.map +1 -0
  101. package/dist/messaging/client-tokens.js +64 -0
  102. package/dist/messaging/client-tokens.js.map +1 -0
  103. package/dist/messaging/client.d.ts +58 -0
  104. package/dist/messaging/client.d.ts.map +1 -0
  105. package/dist/messaging/client.js +100 -0
  106. package/dist/messaging/client.js.map +1 -0
  107. package/dist/messaging/contacts.d.ts +20 -0
  108. package/dist/messaging/contacts.d.ts.map +1 -0
  109. package/dist/messaging/contacts.js +75 -0
  110. package/dist/messaging/contacts.js.map +1 -0
  111. package/dist/messaging/groups.d.ts +34 -0
  112. package/dist/messaging/groups.d.ts.map +1 -0
  113. package/dist/messaging/groups.js +97 -0
  114. package/dist/messaging/groups.js.map +1 -0
  115. package/dist/messaging/identities.d.ts +9 -0
  116. package/dist/messaging/identities.d.ts.map +1 -0
  117. package/dist/messaging/identities.js +21 -0
  118. package/dist/messaging/identities.js.map +1 -0
  119. package/dist/messaging/labels.d.ts +16 -0
  120. package/dist/messaging/labels.d.ts.map +1 -0
  121. package/dist/messaging/labels.js +65 -0
  122. package/dist/messaging/labels.js.map +1 -0
  123. package/dist/messaging/media.d.ts +72 -0
  124. package/dist/messaging/media.d.ts.map +1 -0
  125. package/dist/messaging/media.js +142 -0
  126. package/dist/messaging/media.js.map +1 -0
  127. package/dist/messaging/messages.d.ts +18 -0
  128. package/dist/messaging/messages.d.ts.map +1 -0
  129. package/dist/messaging/messages.js +32 -0
  130. package/dist/messaging/messages.js.map +1 -0
  131. package/dist/messaging/observation-policies.d.ts +10 -0
  132. package/dist/messaging/observation-policies.d.ts.map +1 -0
  133. package/dist/messaging/observation-policies.js +28 -0
  134. package/dist/messaging/observation-policies.js.map +1 -0
  135. package/dist/messaging/onboarding.d.ts +53 -0
  136. package/dist/messaging/onboarding.d.ts.map +1 -0
  137. package/dist/messaging/onboarding.js +69 -0
  138. package/dist/messaging/onboarding.js.map +1 -0
  139. package/dist/messaging/presence.d.ts +12 -0
  140. package/dist/messaging/presence.d.ts.map +1 -0
  141. package/dist/messaging/presence.js +43 -0
  142. package/dist/messaging/presence.js.map +1 -0
  143. package/dist/messaging/privacy.d.ts +11 -0
  144. package/dist/messaging/privacy.d.ts.map +1 -0
  145. package/dist/messaging/privacy.js +34 -0
  146. package/dist/messaging/privacy.js.map +1 -0
  147. package/dist/messaging/profile.d.ts +13 -0
  148. package/dist/messaging/profile.d.ts.map +1 -0
  149. package/dist/messaging/profile.js +49 -0
  150. package/dist/messaging/profile.js.map +1 -0
  151. package/dist/messaging/quick-replies.d.ts +13 -0
  152. package/dist/messaging/quick-replies.d.ts.map +1 -0
  153. package/dist/messaging/quick-replies.js +45 -0
  154. package/dist/messaging/quick-replies.js.map +1 -0
  155. package/dist/messaging/quicklinks.d.ts +69 -0
  156. package/dist/messaging/quicklinks.d.ts.map +1 -0
  157. package/dist/messaging/quicklinks.js +45 -0
  158. package/dist/messaging/quicklinks.js.map +1 -0
  159. package/dist/messaging/session-configuration.d.ts +67 -0
  160. package/dist/messaging/session-configuration.d.ts.map +1 -0
  161. package/dist/messaging/session-configuration.js +2 -0
  162. package/dist/messaging/session-configuration.js.map +1 -0
  163. package/dist/messaging/sessions.d.ts +26 -0
  164. package/dist/messaging/sessions.d.ts.map +1 -0
  165. package/dist/messaging/sessions.js +108 -0
  166. package/dist/messaging/sessions.js.map +1 -0
  167. package/dist/messaging/templates.d.ts +15 -0
  168. package/dist/messaging/templates.d.ts.map +1 -0
  169. package/dist/messaging/templates.js +67 -0
  170. package/dist/messaging/templates.js.map +1 -0
  171. package/dist/messaging/testing-configuration.d.ts +89 -0
  172. package/dist/messaging/testing-configuration.d.ts.map +1 -0
  173. package/dist/messaging/testing-configuration.js +14 -0
  174. package/dist/messaging/testing-configuration.js.map +1 -0
  175. package/dist/messaging/types.d.ts +1793 -0
  176. package/dist/messaging/types.d.ts.map +1 -0
  177. package/dist/messaging/types.js +25 -0
  178. package/dist/messaging/types.js.map +1 -0
  179. package/dist/messaging/users.d.ts +9 -0
  180. package/dist/messaging/users.d.ts.map +1 -0
  181. package/dist/messaging/users.js +15 -0
  182. package/dist/messaging/users.js.map +1 -0
  183. package/dist/messaging/voip.d.ts +51 -0
  184. package/dist/messaging/voip.d.ts.map +1 -0
  185. package/dist/messaging/voip.js +293 -0
  186. package/dist/messaging/voip.js.map +1 -0
  187. package/dist/messaging/webhooks.d.ts +13 -0
  188. package/dist/messaging/webhooks.d.ts.map +1 -0
  189. package/dist/messaging/webhooks.js +48 -0
  190. package/dist/messaging/webhooks.js.map +1 -0
  191. package/dist/node.d.ts +55 -0
  192. package/dist/node.d.ts.map +1 -0
  193. package/dist/node.js +237 -0
  194. package/dist/node.js.map +1 -0
  195. package/dist/pagination.d.ts +24 -0
  196. package/dist/pagination.d.ts.map +1 -0
  197. package/dist/pagination.js +28 -0
  198. package/dist/pagination.js.map +1 -0
  199. package/dist/platform/api-keys.d.ts +10 -0
  200. package/dist/platform/api-keys.d.ts.map +1 -0
  201. package/dist/platform/api-keys.js +22 -0
  202. package/dist/platform/api-keys.js.map +1 -0
  203. package/dist/platform/audiences.d.ts +16 -0
  204. package/dist/platform/audiences.d.ts.map +1 -0
  205. package/dist/platform/audiences.js +46 -0
  206. package/dist/platform/audiences.js.map +1 -0
  207. package/dist/platform/audit-logs.d.ts +9 -0
  208. package/dist/platform/audit-logs.d.ts.map +1 -0
  209. package/dist/platform/audit-logs.js +20 -0
  210. package/dist/platform/audit-logs.js.map +1 -0
  211. package/dist/platform/bansafe.d.ts +24 -0
  212. package/dist/platform/bansafe.d.ts.map +1 -0
  213. package/dist/platform/bansafe.js +70 -0
  214. package/dist/platform/bansafe.js.map +1 -0
  215. package/dist/platform/billing.d.ts +13 -0
  216. package/dist/platform/billing.d.ts.map +1 -0
  217. package/dist/platform/billing.js +27 -0
  218. package/dist/platform/billing.js.map +1 -0
  219. package/dist/platform/campaigns.d.ts +28 -0
  220. package/dist/platform/campaigns.d.ts.map +1 -0
  221. package/dist/platform/campaigns.js +92 -0
  222. package/dist/platform/campaigns.js.map +1 -0
  223. package/dist/platform/customers.d.ts +23 -0
  224. package/dist/platform/customers.d.ts.map +1 -0
  225. package/dist/platform/customers.js +140 -0
  226. package/dist/platform/customers.js.map +1 -0
  227. package/dist/platform/developer-resources.d.ts +101 -0
  228. package/dist/platform/developer-resources.d.ts.map +1 -0
  229. package/dist/platform/developer-resources.js +250 -0
  230. package/dist/platform/developer-resources.js.map +1 -0
  231. package/dist/platform/developer-types.d.ts +378 -0
  232. package/dist/platform/developer-types.d.ts.map +1 -0
  233. package/dist/platform/developer-types.js +2 -0
  234. package/dist/platform/developer-types.js.map +1 -0
  235. package/dist/platform/event-stream.d.ts +114 -0
  236. package/dist/platform/event-stream.d.ts.map +1 -0
  237. package/dist/platform/event-stream.js +308 -0
  238. package/dist/platform/event-stream.js.map +1 -0
  239. package/dist/platform/media.d.ts +13 -0
  240. package/dist/platform/media.d.ts.map +1 -0
  241. package/dist/platform/media.js +33 -0
  242. package/dist/platform/media.js.map +1 -0
  243. package/dist/platform/members.d.ts +9 -0
  244. package/dist/platform/members.d.ts.map +1 -0
  245. package/dist/platform/members.js +15 -0
  246. package/dist/platform/members.js.map +1 -0
  247. package/dist/platform/opt-outs.d.ts +15 -0
  248. package/dist/platform/opt-outs.d.ts.map +1 -0
  249. package/dist/platform/opt-outs.js +36 -0
  250. package/dist/platform/opt-outs.js.map +1 -0
  251. package/dist/platform/organizations.d.ts +9 -0
  252. package/dist/platform/organizations.d.ts.map +1 -0
  253. package/dist/platform/organizations.js +15 -0
  254. package/dist/platform/organizations.js.map +1 -0
  255. package/dist/platform/project-tokens.d.ts +9 -0
  256. package/dist/platform/project-tokens.d.ts.map +1 -0
  257. package/dist/platform/project-tokens.js +16 -0
  258. package/dist/platform/project-tokens.js.map +1 -0
  259. package/dist/platform/projects.d.ts +24 -0
  260. package/dist/platform/projects.d.ts.map +1 -0
  261. package/dist/platform/projects.js +83 -0
  262. package/dist/platform/projects.js.map +1 -0
  263. package/dist/platform/quicklink-settings.d.ts +85 -0
  264. package/dist/platform/quicklink-settings.d.ts.map +1 -0
  265. package/dist/platform/quicklink-settings.js +35 -0
  266. package/dist/platform/quicklink-settings.js.map +1 -0
  267. package/dist/platform/response.d.ts +10 -0
  268. package/dist/platform/response.d.ts.map +1 -0
  269. package/dist/platform/response.js +41 -0
  270. package/dist/platform/response.js.map +1 -0
  271. package/dist/platform/security-incidents.d.ts +10 -0
  272. package/dist/platform/security-incidents.d.ts.map +1 -0
  273. package/dist/platform/security-incidents.js +22 -0
  274. package/dist/platform/security-incidents.js.map +1 -0
  275. package/dist/platform/session-bans.d.ts +13 -0
  276. package/dist/platform/session-bans.d.ts.map +1 -0
  277. package/dist/platform/session-bans.js +21 -0
  278. package/dist/platform/session-bans.js.map +1 -0
  279. package/dist/platform/session-configuration.d.ts +15 -0
  280. package/dist/platform/session-configuration.d.ts.map +1 -0
  281. package/dist/platform/session-configuration.js +36 -0
  282. package/dist/platform/session-configuration.js.map +1 -0
  283. package/dist/platform/sessions.d.ts +26 -0
  284. package/dist/platform/sessions.d.ts.map +1 -0
  285. package/dist/platform/sessions.js +121 -0
  286. package/dist/platform/sessions.js.map +1 -0
  287. package/dist/platform/sip-trunks.d.ts +141 -0
  288. package/dist/platform/sip-trunks.d.ts.map +1 -0
  289. package/dist/platform/sip-trunks.js +140 -0
  290. package/dist/platform/sip-trunks.js.map +1 -0
  291. package/dist/platform/types.d.ts +897 -0
  292. package/dist/platform/types.d.ts.map +1 -0
  293. package/dist/platform/types.js +2 -0
  294. package/dist/platform/types.js.map +1 -0
  295. package/dist/raw.d.ts +26 -0
  296. package/dist/raw.d.ts.map +1 -0
  297. package/dist/raw.js +79 -0
  298. package/dist/raw.js.map +1 -0
  299. package/dist/system.d.ts +37 -0
  300. package/dist/system.d.ts.map +1 -0
  301. package/dist/system.js +45 -0
  302. package/dist/system.js.map +1 -0
  303. package/dist/transport/body.d.ts +6 -0
  304. package/dist/transport/body.d.ts.map +1 -0
  305. package/dist/transport/body.js +33 -0
  306. package/dist/transport/body.js.map +1 -0
  307. package/dist/transport/content-disposition.d.ts +9 -0
  308. package/dist/transport/content-disposition.d.ts.map +1 -0
  309. package/dist/transport/content-disposition.js +107 -0
  310. package/dist/transport/content-disposition.js.map +1 -0
  311. package/dist/transport/http.d.ts +35 -0
  312. package/dist/transport/http.d.ts.map +1 -0
  313. package/dist/transport/http.js +660 -0
  314. package/dist/transport/http.js.map +1 -0
  315. package/dist/transport/idempotency.d.ts +10 -0
  316. package/dist/transport/idempotency.d.ts.map +1 -0
  317. package/dist/transport/idempotency.js +13 -0
  318. package/dist/transport/idempotency.js.map +1 -0
  319. package/dist/transport/retry.d.ts +11 -0
  320. package/dist/transport/retry.d.ts.map +1 -0
  321. package/dist/transport/retry.js +45 -0
  322. package/dist/transport/retry.js.map +1 -0
  323. package/dist/transport/types.d.ts +58 -0
  324. package/dist/transport/types.d.ts.map +1 -0
  325. package/dist/transport/types.js +2 -0
  326. package/dist/transport/types.js.map +1 -0
  327. package/dist/version.d.ts +2 -0
  328. package/dist/version.d.ts.map +1 -0
  329. package/dist/version.js +2 -0
  330. package/dist/version.js.map +1 -0
  331. package/dist/webhooks/events.d.ts +741 -0
  332. package/dist/webhooks/events.d.ts.map +1 -0
  333. package/dist/webhooks/events.js +80 -0
  334. package/dist/webhooks/events.js.map +1 -0
  335. package/dist/webhooks/index.d.ts +4 -0
  336. package/dist/webhooks/index.d.ts.map +1 -0
  337. package/dist/webhooks/index.js +4 -0
  338. package/dist/webhooks/index.js.map +1 -0
  339. package/dist/webhooks/utilities.d.ts +33 -0
  340. package/dist/webhooks/utilities.d.ts.map +1 -0
  341. package/dist/webhooks/utilities.js +67 -0
  342. package/dist/webhooks/utilities.js.map +1 -0
  343. package/dist/webhooks/verify.d.ts +9 -0
  344. package/dist/webhooks/verify.d.ts.map +1 -0
  345. package/dist/webhooks/verify.js +77 -0
  346. package/dist/webhooks/verify.js.map +1 -0
  347. package/package.json +58 -0
@@ -0,0 +1,741 @@
1
+ import type { MessagingConnection, PhonePlatform, WhatsAppAccountType } from "../messaging/types.js";
2
+ export declare const KNOWN_WEBHOOK_EVENT_TYPES: readonly ["bansafe.action", "bansafe.claim", "bansafe.enforcement", "bansafe.health_changed", "bansafe.health_threshold", "bansafe.incident", "bansafe.risk_changed", "blocklist.update", "business.quick_reply.update", "call.accepted", "call.connection_joined", "call.connection_left", "call.ended", "call.missed", "call.participant_joined", "call.participant_left", "call.participant_state", "call.received", "call.rejected", "call.telemetry", "campaign.cap_reached", "campaign.cold_blocked", "campaign.completed", "campaign.failed", "campaign.paused", "campaign.recipient_failed", "campaign.recipient_sent", "campaign.recipient_skipped", "campaign.throttled", "chat.archive", "chat.clear", "chat.delete", "chat.mute", "chat.read", "command.result", "contact.sync", "contact.update", "customer.archived", "customer.archiving", "customer.created", "customer.enabled", "customer.number.attached", "customer.number.disconnected", "customer.number.transferred", "customer.pairing_link.connected", "customer.pairing_link.created", "customer.pairing_link.expired", "customer.pairing_link.failed", "customer.pairing_link.opened", "customer.pairing_link.revoked", "customer.restored", "customer.updated", "group.participant", "group.update", "history.sync", "labels.update", "message.ack", "message.delete", "message.echo", "message.edited", "message.failed", "message.reaction", "message.received", "message.revoked", "message.sent", "message.update", "message.vote", "newsletter.update", "presence.update", "session.connected", "session.logged_out", "session.phone_offline", "session.status", "template.status"];
3
+ export type KnownWebhookEventType = (typeof KNOWN_WEBHOOK_EVENT_TYPES)[number];
4
+ export interface IdentityReference {
5
+ readonly id: string;
6
+ readonly phoneNumber?: string;
7
+ readonly bsuid?: string;
8
+ readonly username?: string;
9
+ }
10
+ export interface ConversationReference extends IdentityReference {
11
+ readonly sender?: IdentityReference;
12
+ }
13
+ export interface NativeFlowResponse {
14
+ readonly name: string;
15
+ readonly paramsJson: string;
16
+ readonly version?: number;
17
+ }
18
+ export interface PollOption {
19
+ readonly name: string;
20
+ readonly hash: string;
21
+ }
22
+ export type LinkedDeviceMessageType = "text" | "image" | "video" | "audio" | "document" | "location" | "contact" | "phone_number_shared" | "poll" | "sticker" | "reaction" | "revoke" | "edited" | "unknown";
23
+ export interface LinkedDeviceMessagePayload {
24
+ readonly id: string;
25
+ readonly whatsapp_id: string;
26
+ readonly conversation: ConversationReference;
27
+ readonly fromMe: boolean;
28
+ readonly timestamp: number;
29
+ readonly pushName: string;
30
+ readonly isGroup: boolean;
31
+ readonly type: LinkedDeviceMessageType;
32
+ readonly text?: string;
33
+ readonly caption?: string;
34
+ readonly mimeType?: string;
35
+ readonly ptt?: boolean;
36
+ readonly filename?: string;
37
+ readonly latitude?: number;
38
+ readonly longitude?: number;
39
+ readonly displayName?: string;
40
+ readonly title?: string;
41
+ readonly reaction?: string;
42
+ readonly reactionTo?: string;
43
+ readonly revokedId?: string;
44
+ readonly media?: string;
45
+ readonly mediaUrl?: string;
46
+ readonly edited?: boolean;
47
+ readonly pollOptions?: readonly PollOption[];
48
+ readonly unavailable?: boolean;
49
+ readonly unavailableReason?: string;
50
+ readonly nativeFlowResponse?: NativeFlowResponse;
51
+ readonly [key: string]: unknown;
52
+ }
53
+ export type MessagePayload = LinkedDeviceMessagePayload;
54
+ export interface CloudMessagePayload {
55
+ readonly id: string;
56
+ readonly whatsapp_id: string;
57
+ readonly conversation: ConversationReference;
58
+ readonly timestamp: string;
59
+ readonly type: string;
60
+ readonly senderName?: string;
61
+ readonly nativeFlowResponse?: NativeFlowResponse;
62
+ readonly interactive?: Readonly<Record<string, unknown>>;
63
+ readonly [key: string]: unknown;
64
+ }
65
+ export type MessageReceivedPayload = LinkedDeviceMessagePayload | CloudMessagePayload;
66
+ export interface MessageSentPayload {
67
+ readonly id: string;
68
+ readonly whatsapp_id: string;
69
+ readonly conversation: ConversationReference;
70
+ readonly type: string;
71
+ readonly timestamp: number;
72
+ }
73
+ export interface MessageAckPayload {
74
+ readonly messages: readonly {
75
+ readonly id: string;
76
+ readonly whatsapp_id: string;
77
+ }[];
78
+ readonly conversation: ConversationReference;
79
+ readonly from?: IdentityReference;
80
+ readonly sender?: IdentityReference;
81
+ readonly type: string;
82
+ readonly timestamp: number;
83
+ }
84
+ export interface MessageDeletePayload {
85
+ readonly from: IdentityReference;
86
+ readonly sender: IdentityReference;
87
+ readonly id: string;
88
+ readonly whatsapp_id: string;
89
+ readonly conversation: ConversationReference;
90
+ readonly fromMe: boolean;
91
+ }
92
+ export interface PollVotePayload {
93
+ readonly conversation: ConversationReference;
94
+ readonly pollMessageId: string;
95
+ readonly voter: IdentityReference;
96
+ readonly selectedHashes: readonly string[];
97
+ readonly timestamp: number;
98
+ }
99
+ export interface SessionStatusPayload {
100
+ readonly status: string;
101
+ readonly statusReason?: string;
102
+ }
103
+ export interface SessionConnectedPayload {
104
+ readonly phoneNumber: string;
105
+ readonly id?: string;
106
+ readonly pushName: string;
107
+ readonly phonePlatform: PhonePlatform;
108
+ readonly accountType: WhatsAppAccountType;
109
+ readonly businessName?: string;
110
+ }
111
+ export interface SessionLoggedOutPayload {
112
+ readonly reason: string;
113
+ }
114
+ export interface SessionPhoneOfflinePayload {
115
+ readonly daysSinceLastSeen: number;
116
+ readonly daysRemaining: number;
117
+ readonly lastSeen: string;
118
+ readonly action: string;
119
+ }
120
+ export interface GroupUpdatePayload {
121
+ readonly id: string;
122
+ readonly newSubject?: string;
123
+ readonly newDescription?: string;
124
+ readonly action?: string;
125
+ }
126
+ export interface GroupParticipantPayload {
127
+ readonly id: string;
128
+ readonly joined?: readonly IdentityReference[];
129
+ readonly left?: readonly IdentityReference[];
130
+ readonly promoted?: readonly IdentityReference[];
131
+ readonly demoted?: readonly IdentityReference[];
132
+ }
133
+ export interface PresenceUpdatePayload {
134
+ readonly observedAt: number;
135
+ readonly from?: IdentityReference;
136
+ readonly sender?: IdentityReference;
137
+ readonly state?: string;
138
+ readonly media?: string;
139
+ readonly unavailable?: boolean;
140
+ readonly lastSeen?: number;
141
+ }
142
+ export interface ContactUpdatePayload {
143
+ readonly id: string;
144
+ readonly phoneNumber?: string;
145
+ readonly bsuid?: string;
146
+ readonly fullName?: string;
147
+ readonly firstName?: string;
148
+ readonly pushName?: string;
149
+ readonly oldPushName?: string;
150
+ readonly businessName?: string;
151
+ readonly oldBusinessName?: string;
152
+ readonly pictureId?: string;
153
+ readonly pictureRemoved?: boolean;
154
+ readonly username?: string;
155
+ }
156
+ export interface ChatArchivePayload {
157
+ readonly from: IdentityReference;
158
+ readonly archive?: boolean;
159
+ readonly pinned?: boolean;
160
+ }
161
+ export interface ChatMutePayload {
162
+ readonly from: IdentityReference;
163
+ readonly muted: boolean;
164
+ readonly muteEndTimestamp?: number;
165
+ }
166
+ export interface ChatReadPayload {
167
+ readonly from: IdentityReference;
168
+ readonly read: boolean;
169
+ }
170
+ export interface ChatClearPayload {
171
+ readonly from: IdentityReference;
172
+ }
173
+ export interface ChatDeletePayload {
174
+ readonly from: IdentityReference;
175
+ }
176
+ /** What a call supports, as reported by the session that carries it. */
177
+ export interface WebhookCallCapabilities {
178
+ readonly video: boolean;
179
+ /** Other parties can be invited, turning the call into a group call. */
180
+ readonly invite: boolean;
181
+ }
182
+ export interface CallReceivedPayload {
183
+ readonly from: IdentityReference;
184
+ readonly callId: string;
185
+ readonly hasVideo: boolean;
186
+ /** How the session is connected to WhatsApp. */
187
+ readonly sessionConnection?: MessagingConnection;
188
+ readonly capabilities?: WebhookCallCapabilities;
189
+ }
190
+ export interface CallMissedPayload {
191
+ readonly from: IdentityReference;
192
+ readonly callId: string;
193
+ readonly reason: string;
194
+ }
195
+ export interface CallAcceptedPayload {
196
+ readonly from: IdentityReference;
197
+ readonly callId: string;
198
+ /** Participant reference that answered first, when known. */
199
+ readonly answeredBy?: string;
200
+ /** The answer claimed the call: other participants stopped ringing. */
201
+ readonly exclusive?: boolean;
202
+ readonly sessionConnection?: MessagingConnection;
203
+ readonly capabilities?: WebhookCallCapabilities;
204
+ }
205
+ export interface CallRejectedPayload {
206
+ readonly from: IdentityReference;
207
+ readonly callId: string;
208
+ }
209
+ export interface CallEndedPayload {
210
+ /** Null when the media host disappeared before reporting caller identity. */
211
+ readonly from: IdentityReference | null;
212
+ readonly callId: string;
213
+ readonly durationSeconds: number;
214
+ /** Includes pod_lost for calls ended after the media host disappears. */
215
+ readonly reason: string;
216
+ readonly direction: "inbound" | "outbound";
217
+ readonly hadVideo: boolean;
218
+ readonly sessionConnection?: MessagingConnection;
219
+ }
220
+ export interface CallTelemetryPayload {
221
+ readonly callId: string;
222
+ readonly setupMs: number;
223
+ readonly ringMs: number;
224
+ readonly durationSeconds: number;
225
+ readonly terminateReason: string;
226
+ readonly codec: string;
227
+ readonly jitterMs: number;
228
+ readonly packetsLost: number;
229
+ readonly rttMs: number;
230
+ /** Cumulative received kilobits, despite the legacy field name. */
231
+ readonly recvKbps: number;
232
+ /** Cumulative sent kilobits, despite the legacy field name. */
233
+ readonly sendKbps: number;
234
+ }
235
+ export interface CallParticipant {
236
+ readonly id: string;
237
+ readonly phoneNumber?: string;
238
+ readonly bsuid?: string;
239
+ readonly username?: string;
240
+ readonly audioMuted: false;
241
+ readonly video: false;
242
+ readonly state: "invited" | "ringing" | "connected" | "left";
243
+ }
244
+ export interface CallParticipantPayload {
245
+ readonly callId: string;
246
+ readonly participant: CallParticipant;
247
+ }
248
+ export interface CallParticipantLeftPayload {
249
+ readonly callId: string;
250
+ readonly participantId: string;
251
+ readonly reason?: string;
252
+ }
253
+ /** One media connection to a call: a browser, app, server, or SIP trunk. */
254
+ export interface CallConnection {
255
+ readonly id: string;
256
+ /** `client:<id>` for a client token, `server:<id>` for a server credential. */
257
+ readonly participant: string;
258
+ readonly transport: "webrtc" | "socket" | "sip";
259
+ }
260
+ export interface CallConnectionJoinedPayload {
261
+ readonly callId: string;
262
+ readonly connection: CallConnection;
263
+ }
264
+ /**
265
+ * Why a connection left. A SIP trunk that never joined reports a `sip_*`
266
+ * reason, `claimed`, or `call_ended`, with no joined event before it.
267
+ */
268
+ export type CallConnectionLeftReason = "left" | "replaced" | "claimed" | "call_ended" | "sip_busy" | "sip_declined" | "sip_no_answer" | "sip_unavailable" | "sip_auth_failed";
269
+ export interface CallConnectionLeftPayload {
270
+ readonly callId: string;
271
+ readonly connectionId: string;
272
+ readonly participant: string;
273
+ readonly reason: CallConnectionLeftReason;
274
+ }
275
+ export interface NewsletterUpdatePayload {
276
+ readonly id: string;
277
+ readonly action: string;
278
+ readonly muted?: boolean;
279
+ }
280
+ export interface BlocklistChange {
281
+ readonly action: string;
282
+ readonly phoneNumber?: string;
283
+ readonly bsuid?: string;
284
+ readonly id: string;
285
+ readonly username?: string;
286
+ }
287
+ export interface BlocklistUpdatePayload {
288
+ readonly action: string;
289
+ readonly changes: readonly BlocklistChange[];
290
+ }
291
+ export interface LabelsUpdatePayload {
292
+ /** label_edit, label_association_chat, label_association_message, or star. */
293
+ readonly action: string;
294
+ readonly labelId?: string;
295
+ readonly from?: IdentityReference;
296
+ readonly label?: string;
297
+ readonly name?: string;
298
+ readonly color?: number;
299
+ readonly orderIndex?: number;
300
+ readonly deleted?: boolean;
301
+ readonly labeled?: boolean;
302
+ readonly observedAt?: number;
303
+ /** Polymorfa message ID; an association alone may not supply its routing key. */
304
+ readonly messageId?: string;
305
+ readonly starred?: boolean;
306
+ }
307
+ export type HistorySyncPayload = LinkedHistorySyncPayload | CloudHistorySyncPayload;
308
+ export interface CloudHistorySyncPayload {
309
+ readonly kind: "history";
310
+ readonly value: Readonly<Record<string, unknown>>;
311
+ }
312
+ export interface LinkedHistorySyncPayload {
313
+ readonly whatsapp_id: string;
314
+ readonly original_whatsapp_id?: string;
315
+ readonly messages: readonly {
316
+ readonly id: string;
317
+ readonly whatsapp_id: string;
318
+ readonly conversation: IdentityReference;
319
+ readonly fromMe?: boolean;
320
+ }[];
321
+ readonly mode: "deliver";
322
+ readonly syncType: string;
323
+ readonly chunkOrder?: number;
324
+ readonly progress?: number;
325
+ readonly fileLength: number;
326
+ readonly conversationCount: number;
327
+ readonly messageCount: number;
328
+ readonly pushNameCount: number;
329
+ readonly statusMessageCount: number;
330
+ readonly whatsapp: {
331
+ readonly encoding: "gzip-base64-protobuf";
332
+ readonly data: string;
333
+ };
334
+ }
335
+ /** Meta Cloud API contact synchronization batch. */
336
+ export interface ContactsSyncPayload {
337
+ readonly kind: "contacts";
338
+ readonly value: Readonly<Record<string, unknown>>;
339
+ }
340
+ /** A message sent from the WhatsApp Business app on a Meta Cloud API number. */
341
+ export interface MessageEchoPayload {
342
+ readonly source: "whatsapp_business_app";
343
+ readonly value: Readonly<Record<string, unknown>>;
344
+ }
345
+ export interface CommandResultPayload {
346
+ readonly requestId: string;
347
+ readonly command: string;
348
+ readonly success: boolean;
349
+ readonly data?: Readonly<Record<string, unknown>>;
350
+ readonly error?: string;
351
+ }
352
+ export interface BusinessQuickReplyUpdatePayload {
353
+ readonly id: string;
354
+ readonly shortcut: string;
355
+ readonly message: string;
356
+ readonly keywords: readonly string[];
357
+ readonly count: number;
358
+ readonly deleted: boolean;
359
+ readonly associatedLabelIds: readonly string[];
360
+ readonly observedAt: number;
361
+ readonly fromFullSync: boolean;
362
+ }
363
+ /** Principal that caused a Customer lifecycle change. */
364
+ export type CustomerEventActorKind = "better_auth" | "org_key" | "project_token" | "cli_grant" | "system";
365
+ /** Fields shared by every Customer lifecycle webhook payload. */
366
+ export interface CustomerEventPayload {
367
+ readonly eventId: string;
368
+ readonly occurredAt: string;
369
+ readonly organizationId: string;
370
+ readonly projectId: string;
371
+ readonly customerId: string;
372
+ readonly actorKind: CustomerEventActorKind;
373
+ }
374
+ export type CustomerCreatedPayload = CustomerEventPayload;
375
+ export type CustomerArchivedPayload = CustomerEventPayload;
376
+ export type CustomerRestoredPayload = CustomerEventPayload;
377
+ export interface CustomerUpdatedPayload extends CustomerEventPayload {
378
+ readonly fields: readonly ("name" | "phone" | "externalCustomerId")[];
379
+ }
380
+ export interface CustomerEnabledPayload extends CustomerEventPayload {
381
+ readonly migratedNumberCount: number;
382
+ }
383
+ export interface CustomerArchivingPayload extends CustomerEventPayload {
384
+ readonly blockingNumberCount: number;
385
+ readonly revokedPairingLinkCount: number;
386
+ }
387
+ export interface CustomerPairingLinkPayload extends CustomerEventPayload {
388
+ readonly pairingLinkId: string;
389
+ }
390
+ export type CustomerPairingLinkCreatedPayload = CustomerPairingLinkPayload;
391
+ export type CustomerPairingLinkOpenedPayload = CustomerPairingLinkPayload;
392
+ export type CustomerPairingLinkExpiredPayload = CustomerPairingLinkPayload;
393
+ export interface CustomerPairingLinkConnectedPayload extends CustomerPairingLinkPayload {
394
+ readonly sessionId: string;
395
+ }
396
+ export interface CustomerPairingLinkFailedPayload extends CustomerPairingLinkPayload {
397
+ readonly errorCode: string;
398
+ }
399
+ export interface CustomerPairingLinkRevokedPayload extends CustomerPairingLinkPayload {
400
+ readonly reason?: "customer_archived" | "phone_mismatch_limit" | "exchange_failure_limit" | "terminal_failure";
401
+ }
402
+ export interface CustomerNumberAttachedPayload extends CustomerEventPayload {
403
+ readonly sessionId: string;
404
+ readonly pairingLinkId?: string;
405
+ }
406
+ export interface CustomerNumberTransferredPayload extends CustomerEventPayload {
407
+ readonly sessionId: string;
408
+ readonly sourceCustomerId: string;
409
+ }
410
+ export interface CustomerNumberDisconnectedPayload extends CustomerEventPayload {
411
+ readonly sessionId: string;
412
+ readonly reason: string;
413
+ }
414
+ export type BanSafeIncidentEventKind = "cap_warning" | "cap_reached" | "timelock" | "temporary_ban" | "permanent_ban" | "connect_blocked" | "customer_report";
415
+ export type BanSafeEventRung = "none" | "notify" | "throttle" | "block_cold" | "suspend";
416
+ export type BanSafeRiskLevel = "low" | "elevated" | "high" | "critical";
417
+ export type BanSafeHealthBandName = "good" | "fair" | "poor" | "failing" | "unknown";
418
+ export interface BanSafeForecast {
419
+ /** Probability (0-1) of a temporary or permanent ban within 7 days. */
420
+ readonly days7: number;
421
+ readonly days14: number;
422
+ readonly days30: number;
423
+ }
424
+ export interface BanSafeRiskFactor {
425
+ /** Feature key, or `group:<groupId>`. */
426
+ readonly key: string;
427
+ readonly group: string;
428
+ readonly label: string;
429
+ readonly direction: "raises" | "lowers";
430
+ readonly strength: "strong" | "moderate" | "slight";
431
+ /** Share, as a whole percentage, of the raising or lowering total. */
432
+ readonly impact: number;
433
+ readonly sentence: string;
434
+ readonly hint: string | null;
435
+ }
436
+ export interface BanSafeModelRef {
437
+ readonly version: string;
438
+ readonly reliability: "prior" | "early" | "calibrated";
439
+ }
440
+ export interface BanSafeRiskChangedPayload {
441
+ /** The customer's own number in E.164 format. */
442
+ readonly phoneNumber: string;
443
+ readonly level: BanSafeRiskLevel;
444
+ /** Null for the first evaluation of the number. */
445
+ readonly previousLevel: BanSafeRiskLevel | null;
446
+ /** Risk score from 0 (lowest) to 100 (highest). */
447
+ readonly score: number;
448
+ readonly forecast: BanSafeForecast;
449
+ /** Up to five contributing factors, ordered by impact. */
450
+ readonly factors: readonly BanSafeRiskFactor[];
451
+ readonly model: BanSafeModelRef;
452
+ readonly evaluatedAt: string;
453
+ }
454
+ export interface BanSafeHealthPenalties {
455
+ readonly conduct: number;
456
+ readonly restriction: number;
457
+ readonly connection: number;
458
+ }
459
+ export interface BanSafeHealthFinding {
460
+ readonly key: string;
461
+ readonly title: string;
462
+ readonly severity: "info" | "warning" | "critical";
463
+ /** `not_measured` means the signal could not be measured for this number. */
464
+ readonly status: "open" | "acknowledged" | "not_measured";
465
+ /** Health points this finding costs. */
466
+ readonly points: number;
467
+ }
468
+ export interface BanSafeHealthChangedPayload {
469
+ readonly phoneNumber: string;
470
+ /** Health from 0 (worst) to 100 (best), or null when not measured. */
471
+ readonly health: number | null;
472
+ readonly band: BanSafeHealthBandName;
473
+ readonly previousBand: string | null;
474
+ readonly state: "measured" | "partial" | "measuring" | "restricted" | "banned";
475
+ readonly penalties: BanSafeHealthPenalties;
476
+ readonly findings: readonly BanSafeHealthFinding[];
477
+ readonly measuredChecks: number;
478
+ readonly totalChecks: number;
479
+ /** Messages allowed today under the warm-up plan; null or absent without one. */
480
+ readonly allowance?: number | null;
481
+ readonly evaluatedAt: string;
482
+ }
483
+ export interface BanSafeHealthThresholdPayload {
484
+ readonly sessionId: string;
485
+ readonly projectId: string;
486
+ /** Health from 0 to 100. */
487
+ readonly health: number;
488
+ readonly threshold: number;
489
+ readonly healthSource: "rules_v1" | "ml_model";
490
+ readonly estimatorVersion: string;
491
+ readonly modelVersion: string | null;
492
+ readonly evaluatedAt: string;
493
+ readonly policyVersion: number;
494
+ readonly episodeId: string;
495
+ readonly actionId: string;
496
+ }
497
+ export interface BanSafeEnforcementPayload {
498
+ readonly phoneNumber: string;
499
+ readonly kind: BanSafeIncidentEventKind;
500
+ readonly source: "runtime" | "customer";
501
+ readonly code?: number;
502
+ readonly subCode?: number;
503
+ readonly reason?: string;
504
+ readonly enforcementType?: string;
505
+ readonly startedAt: string;
506
+ readonly endsAt?: string;
507
+ }
508
+ /** A finding that must be resolved before a BanSafe action can lift. */
509
+ export interface BanSafeRequiredFinding {
510
+ readonly findingKey: string;
511
+ readonly title: string;
512
+ readonly severity: "info" | "warning" | "critical";
513
+ }
514
+ export interface BanSafeActionPayload {
515
+ readonly phoneNumber: string;
516
+ readonly action: "applied" | "changed" | "lifted" | "daily_allowance_reached";
517
+ readonly scope: "number" | "organization";
518
+ readonly rung: BanSafeEventRung;
519
+ readonly previousRung: BanSafeEventRung | null;
520
+ readonly reason: "health" | "finding" | "org_pattern" | "repeat" | "restriction" | "operator" | "health_model_cutover" | "warmup";
521
+ readonly health: number | null;
522
+ readonly healthBand: "good" | "fair" | "poor" | "failing" | "unknown";
523
+ readonly requires: readonly BanSafeRequiredFinding[];
524
+ readonly throughputPerMinute: number | null;
525
+ readonly eligibleLiftAt: string | null;
526
+ readonly liftRequires: string;
527
+ readonly appealUrl: string;
528
+ readonly startedAt: string;
529
+ readonly docs: string;
530
+ }
531
+ export interface BanSafeIncidentPayload {
532
+ readonly id: string;
533
+ readonly phoneNumber: string;
534
+ readonly kind: BanSafeIncidentEventKind;
535
+ readonly source: "runtime" | "customer";
536
+ readonly startedAt: string;
537
+ readonly endsAt: string | null;
538
+ /** Probability from 0 to 1 that the incident was a real enforcement. */
539
+ readonly belief: number;
540
+ readonly resolution: "open" | "corroborated" | "contradicted" | "phone_switch" | "final";
541
+ readonly claimId: string | null;
542
+ readonly closedAt: string | null;
543
+ }
544
+ export interface BanSafeClaimPayload {
545
+ readonly id: string;
546
+ readonly incidentId: string;
547
+ readonly phoneNumber: string;
548
+ readonly status: "filed" | "under_review" | "approved" | "denied" | "paid" | "reversed";
549
+ readonly verdict: "other_device" | "customer_conduct" | "shared_network" | "ours" | "inconclusive";
550
+ readonly windowStart: string;
551
+ readonly windowEnd: string;
552
+ /** Decimal cent amounts with up to six fractional digits. */
553
+ readonly measuredCents: number;
554
+ readonly capCents: number;
555
+ readonly amountCents: number;
556
+ readonly summary: string;
557
+ readonly reason: string;
558
+ readonly decidedAt: string | null;
559
+ readonly paidAt: string | null;
560
+ }
561
+ export type MessageFailedReason = "invalid_recipient" | "session_not_connected" | "ack_timeout" | "send_failed" | "blocked_by_safety";
562
+ export interface MessageFailedPayload {
563
+ readonly to: IdentityReference;
564
+ readonly type: string;
565
+ readonly error: MessageFailedReason;
566
+ readonly code?: string;
567
+ /** Seconds to wait before retrying, when the failure is retryable. */
568
+ readonly retryAfter?: number;
569
+ readonly timestamp: number;
570
+ }
571
+ export interface TemplateStatusPayload {
572
+ readonly templateName: string;
573
+ readonly templateId: string;
574
+ readonly status: string;
575
+ readonly category: string;
576
+ readonly reason: string;
577
+ readonly qualityRating: string;
578
+ }
579
+ export interface CampaignPausedPayload {
580
+ readonly campaignId: string;
581
+ readonly sentCount: number;
582
+ readonly remainingCount: number;
583
+ readonly pausedAt: number;
584
+ }
585
+ export interface CampaignCompletedPayload {
586
+ readonly campaignId: string;
587
+ readonly sentCount: number;
588
+ readonly deliveredCount: number;
589
+ readonly readCount: number;
590
+ readonly failedCount: number;
591
+ readonly skippedCount: number;
592
+ readonly responseCount: number;
593
+ readonly completedAt: number;
594
+ readonly durationMs: number;
595
+ }
596
+ export interface CampaignFailedPayload {
597
+ readonly campaignId: string;
598
+ readonly reason: string;
599
+ readonly failedAt: number;
600
+ }
601
+ export interface CampaignRecipientSentPayload {
602
+ readonly campaignId: string;
603
+ readonly recipientId: string;
604
+ readonly phone: string;
605
+ readonly sessionKey: string;
606
+ readonly externalMessageId: string;
607
+ readonly variantKey: string;
608
+ readonly attempt: number;
609
+ }
610
+ export interface CampaignRecipientFailedPayload {
611
+ readonly campaignId: string;
612
+ readonly recipientId: string;
613
+ readonly phone: string;
614
+ readonly attempts: number;
615
+ readonly error: string;
616
+ readonly failedAt: number;
617
+ }
618
+ export interface CampaignRecipientSkippedPayload {
619
+ readonly campaignId: string;
620
+ readonly recipientId: string;
621
+ readonly phone: string;
622
+ readonly reason: string;
623
+ readonly skippedAt: number;
624
+ }
625
+ export interface CampaignThrottledPayload {
626
+ readonly campaignId: string;
627
+ readonly sessionKey: string;
628
+ readonly reason: string;
629
+ readonly deferredCount: number;
630
+ readonly at: number;
631
+ }
632
+ export interface CampaignCapReachedPayload {
633
+ readonly campaignId: string;
634
+ readonly sessionKey: string;
635
+ readonly phone: string;
636
+ readonly capType: string;
637
+ readonly capLimit: number;
638
+ readonly windowResetsAt: number;
639
+ readonly at: number;
640
+ }
641
+ export interface CampaignColdBlockedPayload {
642
+ readonly campaignId: string;
643
+ readonly recipientId: string;
644
+ readonly phone: string;
645
+ readonly surface: string;
646
+ readonly reason: string;
647
+ readonly at: number;
648
+ }
649
+ export interface WebhookPayloadMap {
650
+ readonly "bansafe.action": BanSafeActionPayload;
651
+ readonly "bansafe.claim": BanSafeClaimPayload;
652
+ readonly "bansafe.enforcement": BanSafeEnforcementPayload;
653
+ readonly "bansafe.health_changed": BanSafeHealthChangedPayload;
654
+ readonly "bansafe.health_threshold": BanSafeHealthThresholdPayload;
655
+ readonly "bansafe.incident": BanSafeIncidentPayload;
656
+ readonly "bansafe.risk_changed": BanSafeRiskChangedPayload;
657
+ readonly "blocklist.update": BlocklistUpdatePayload;
658
+ readonly "business.quick_reply.update": BusinessQuickReplyUpdatePayload;
659
+ readonly "call.accepted": CallAcceptedPayload;
660
+ readonly "call.connection_joined": CallConnectionJoinedPayload;
661
+ readonly "call.connection_left": CallConnectionLeftPayload;
662
+ readonly "call.ended": CallEndedPayload;
663
+ readonly "call.missed": CallMissedPayload;
664
+ readonly "call.participant_joined": CallParticipantPayload;
665
+ readonly "call.participant_left": CallParticipantLeftPayload;
666
+ readonly "call.participant_state": CallParticipantPayload;
667
+ readonly "call.received": CallReceivedPayload;
668
+ readonly "call.rejected": CallRejectedPayload;
669
+ readonly "call.telemetry": CallTelemetryPayload;
670
+ readonly "campaign.cap_reached": CampaignCapReachedPayload;
671
+ readonly "campaign.cold_blocked": CampaignColdBlockedPayload;
672
+ readonly "campaign.completed": CampaignCompletedPayload;
673
+ readonly "campaign.failed": CampaignFailedPayload;
674
+ readonly "campaign.paused": CampaignPausedPayload;
675
+ readonly "campaign.recipient_failed": CampaignRecipientFailedPayload;
676
+ readonly "campaign.recipient_sent": CampaignRecipientSentPayload;
677
+ readonly "campaign.recipient_skipped": CampaignRecipientSkippedPayload;
678
+ readonly "campaign.throttled": CampaignThrottledPayload;
679
+ readonly "chat.archive": ChatArchivePayload;
680
+ readonly "chat.clear": ChatClearPayload;
681
+ readonly "chat.delete": ChatDeletePayload;
682
+ readonly "chat.mute": ChatMutePayload;
683
+ readonly "chat.read": ChatReadPayload;
684
+ readonly "command.result": CommandResultPayload;
685
+ readonly "contact.sync": ContactsSyncPayload;
686
+ readonly "contact.update": ContactUpdatePayload;
687
+ readonly "customer.archived": CustomerArchivedPayload;
688
+ readonly "customer.archiving": CustomerArchivingPayload;
689
+ readonly "customer.created": CustomerCreatedPayload;
690
+ readonly "customer.enabled": CustomerEnabledPayload;
691
+ readonly "customer.number.attached": CustomerNumberAttachedPayload;
692
+ readonly "customer.number.disconnected": CustomerNumberDisconnectedPayload;
693
+ readonly "customer.number.transferred": CustomerNumberTransferredPayload;
694
+ readonly "customer.pairing_link.connected": CustomerPairingLinkConnectedPayload;
695
+ readonly "customer.pairing_link.created": CustomerPairingLinkCreatedPayload;
696
+ readonly "customer.pairing_link.expired": CustomerPairingLinkExpiredPayload;
697
+ readonly "customer.pairing_link.failed": CustomerPairingLinkFailedPayload;
698
+ readonly "customer.pairing_link.opened": CustomerPairingLinkOpenedPayload;
699
+ readonly "customer.pairing_link.revoked": CustomerPairingLinkRevokedPayload;
700
+ readonly "customer.restored": CustomerRestoredPayload;
701
+ readonly "customer.updated": CustomerUpdatedPayload;
702
+ readonly "group.participant": GroupParticipantPayload;
703
+ readonly "group.update": GroupUpdatePayload;
704
+ readonly "history.sync": HistorySyncPayload;
705
+ readonly "labels.update": LabelsUpdatePayload;
706
+ readonly "message.ack": MessageAckPayload;
707
+ readonly "message.delete": MessageDeletePayload;
708
+ readonly "message.echo": MessageEchoPayload;
709
+ readonly "message.edited": MessagePayload;
710
+ readonly "message.failed": MessageFailedPayload;
711
+ readonly "message.reaction": MessageReceivedPayload;
712
+ readonly "message.received": MessageReceivedPayload;
713
+ readonly "message.revoked": MessagePayload;
714
+ readonly "message.sent": MessageSentPayload;
715
+ readonly "message.update": MessagePayload;
716
+ readonly "message.vote": PollVotePayload;
717
+ readonly "newsletter.update": NewsletterUpdatePayload;
718
+ readonly "presence.update": PresenceUpdatePayload;
719
+ readonly "session.connected": SessionConnectedPayload;
720
+ readonly "session.logged_out": SessionLoggedOutPayload;
721
+ readonly "session.phone_offline": SessionPhoneOfflinePayload;
722
+ readonly "session.status": SessionStatusPayload;
723
+ readonly "template.status": TemplateStatusPayload;
724
+ }
725
+ export interface WebhookEventOf<TEvent extends string, TPayload> {
726
+ readonly id: string;
727
+ readonly session: string;
728
+ /** Integrator reference from the QuickLink that created the session, when supplied. */
729
+ readonly externalId?: string;
730
+ readonly timestamp: string;
731
+ readonly event: TEvent;
732
+ readonly payload: TPayload;
733
+ }
734
+ export type KnownWebhookEvent = {
735
+ [TEvent in KnownWebhookEventType]: WebhookEventOf<TEvent, WebhookPayloadMap[TEvent]>;
736
+ }[KnownWebhookEventType];
737
+ export type MessageReceivedEvent = WebhookEventOf<"message.received", MessageReceivedPayload>;
738
+ export type UnknownWebhookEvent = WebhookEventOf<string, unknown>;
739
+ export type WebhookEvent = KnownWebhookEvent | UnknownWebhookEvent;
740
+ export declare function isEvent<TEvent extends KnownWebhookEventType>(event: WebhookEvent, type: TEvent): event is WebhookEventOf<TEvent, WebhookPayloadMap[TEvent]>;
741
+ //# sourceMappingURL=events.d.ts.map