@linqapp/sdk 0.38.0 → 0.39.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/chats/background.d.mts +88 -0
  10. package/resources/chats/background.d.mts.map +1 -0
  11. package/resources/chats/background.d.ts +88 -0
  12. package/resources/chats/background.d.ts.map +1 -0
  13. package/resources/chats/background.js +72 -0
  14. package/resources/chats/background.js.map +1 -0
  15. package/resources/chats/background.mjs +68 -0
  16. package/resources/chats/background.mjs.map +1 -0
  17. package/resources/chats/chats.d.mts +30 -12
  18. package/resources/chats/chats.d.mts.map +1 -1
  19. package/resources/chats/chats.d.ts +30 -12
  20. package/resources/chats/chats.d.ts.map +1 -1
  21. package/resources/chats/chats.js +4 -0
  22. package/resources/chats/chats.js.map +1 -1
  23. package/resources/chats/chats.mjs +4 -0
  24. package/resources/chats/chats.mjs.map +1 -1
  25. package/resources/chats/index.d.mts +1 -0
  26. package/resources/chats/index.d.mts.map +1 -1
  27. package/resources/chats/index.d.ts +1 -0
  28. package/resources/chats/index.d.ts.map +1 -1
  29. package/resources/chats/index.js +3 -1
  30. package/resources/chats/index.js.map +1 -1
  31. package/resources/chats/index.mjs +1 -0
  32. package/resources/chats/index.mjs.map +1 -1
  33. package/resources/chats/typing.d.mts +3 -3
  34. package/resources/chats/typing.d.ts +3 -3
  35. package/resources/chats/typing.js +3 -3
  36. package/resources/chats/typing.mjs +3 -3
  37. package/resources/index.d.mts +1 -1
  38. package/resources/index.d.mts.map +1 -1
  39. package/resources/index.d.ts +1 -1
  40. package/resources/index.d.ts.map +1 -1
  41. package/resources/index.js.map +1 -1
  42. package/resources/index.mjs.map +1 -1
  43. package/resources/webhooks.d.mts +1149 -207
  44. package/resources/webhooks.d.mts.map +1 -1
  45. package/resources/webhooks.d.ts +1149 -207
  46. package/resources/webhooks.d.ts.map +1 -1
  47. package/src/client.ts +20 -0
  48. package/src/resources/chats/background.ts +110 -0
  49. package/src/resources/chats/chats.ts +32 -12
  50. package/src/resources/chats/index.ts +1 -0
  51. package/src/resources/chats/typing.ts +3 -3
  52. package/src/resources/index.ts +10 -0
  53. package/src/resources/webhooks.ts +1374 -175
  54. package/src/version.ts +1 -1
  55. package/version.d.mts +1 -1
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
  58. package/version.mjs +1 -1
@@ -140,9 +140,10 @@ export namespace MessageEventV2 {
140
140
  * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
141
141
  * flagging.
142
142
  *
143
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
144
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
145
- * relevant section of the Chat Health guide.
143
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
144
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
145
+ * relevant section of the Chat Health guide. To gate a send, act on the response
146
+ * rather than the status: a `403` is the authoritative answer.
146
147
  *
147
148
  * See the [Chat Health guide](/guides/chats/chat-health) for what each status
148
149
  * means and how to react.
@@ -167,9 +168,10 @@ export namespace MessageEventV2 {
167
168
  * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
168
169
  * flagging.
169
170
  *
170
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
171
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
172
- * relevant section of the Chat Health guide.
171
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
172
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
173
+ * relevant section of the Chat Health guide. To gate a send, act on the response
174
+ * rather than the status: a `403` is the authoritative answer.
173
175
  *
174
176
  * See the [Chat Health guide](/guides/chats/chat-health) for what each status
175
177
  * means and how to react.
@@ -194,6 +196,11 @@ export namespace MessageEventV2 {
194
196
  * is not itself an opt-out keyword opts them back in immediately — a reply in any
195
197
  * conversation with you counts, the same way the block does.
196
198
  *
199
+ * `OPTED_OUT` marks only the conversation the keyword arrived in. The block below
200
+ * is wider than the mark, so a conversation still reading `HEALTHY` can be blocked
201
+ * as well — gate on the `403`, not on the status. Group threads are never marked
202
+ * and are never blocked.
203
+ *
197
204
  * Linq enforces this: while a recipient is opted out, every send to them is
198
205
  * rejected with `403` (error code `2024`) before the message is queued, across
199
206
  * every chat and every line on your account. Nothing is delivered, including a
@@ -1022,8 +1029,8 @@ export namespace MessageFailedWebhookEvent {
1022
1029
  export interface Data {
1023
1030
  /**
1024
1031
  * Error codes in webhook failure events. The possible set varies by event:
1025
- * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
1026
- * update failure events (chat.group_name_update_failed,
1032
+ * message.failed and poll.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or
1033
+ * 4008; the group update failure events (chat.group_name_update_failed,
1027
1034
  * chat.group_icon_update_failed) carry 3007 or 4001.
1028
1035
  */
1029
1036
  code: number;
@@ -1176,9 +1183,10 @@ export namespace MessageEditedWebhookEvent {
1176
1183
  * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
1177
1184
  * flagging.
1178
1185
  *
1179
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
1180
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
1181
- * relevant section of the Chat Health guide.
1186
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
1187
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
1188
+ * relevant section of the Chat Health guide. To gate a send, act on the response
1189
+ * rather than the status: a `403` is the authoritative answer.
1182
1190
  *
1183
1191
  * See the [Chat Health guide](/guides/chats/chat-health) for what each status
1184
1192
  * means and how to react.
@@ -1203,9 +1211,10 @@ export namespace MessageEditedWebhookEvent {
1203
1211
  * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
1204
1212
  * flagging.
1205
1213
  *
1206
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
1207
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
1208
- * relevant section of the Chat Health guide.
1214
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
1215
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
1216
+ * relevant section of the Chat Health guide. To gate a send, act on the response
1217
+ * rather than the status: a `403` is the authoritative answer.
1209
1218
  *
1210
1219
  * See the [Chat Health guide](/guides/chats/chat-health) for what each status
1211
1220
  * means and how to react.
@@ -1230,6 +1239,11 @@ export namespace MessageEditedWebhookEvent {
1230
1239
  * is not itself an opt-out keyword opts them back in immediately — a reply in any
1231
1240
  * conversation with you counts, the same way the block does.
1232
1241
  *
1242
+ * `OPTED_OUT` marks only the conversation the keyword arrived in. The block below
1243
+ * is wider than the mark, so a conversation still reading `HEALTHY` can be blocked
1244
+ * as well — gate on the `403`, not on the status. Group threads are never marked
1245
+ * and are never blocked.
1246
+ *
1233
1247
  * Linq enforces this: while a recipient is opted out, every send to them is
1234
1248
  * rejected with `403` (error code `2024`) before the message is queued, across
1235
1249
  * every chat and every line on your account. Nothing is delivered, including a
@@ -1365,9 +1379,9 @@ export interface ReactionRemovedWebhookEvent {
1365
1379
  }
1366
1380
 
1367
1381
  /**
1368
- * Complete webhook payload for participant.added events
1382
+ * Complete webhook payload for poll.received events
1369
1383
  */
1370
- export interface ParticipantAddedWebhookEvent {
1384
+ export interface PollReceivedWebhookEvent {
1371
1385
  /**
1372
1386
  * API version for the webhook payload format
1373
1387
  */
@@ -1379,9 +1393,10 @@ export interface ParticipantAddedWebhookEvent {
1379
1393
  created_at: string;
1380
1394
 
1381
1395
  /**
1382
- * Payload for participant.added webhook events
1396
+ * Payload for poll.received — a poll created by someone else and delivered to your
1397
+ * line. Carries the full poll snapshot (options, no voters yet) at receipt time.
1383
1398
  */
1384
- data: ParticipantAddedWebhookEvent.Data;
1399
+ data: PollReceivedWebhookEvent.Data;
1385
1400
 
1386
1401
  /**
1387
1402
  * Unique identifier for this event (for deduplication)
@@ -1415,38 +1430,90 @@ export interface ParticipantAddedWebhookEvent {
1415
1430
  webhook_version: string;
1416
1431
  }
1417
1432
 
1418
- export namespace ParticipantAddedWebhookEvent {
1433
+ export namespace PollReceivedWebhookEvent {
1419
1434
  /**
1420
- * Payload for participant.added webhook events
1435
+ * Payload for poll.received — a poll created by someone else and delivered to your
1436
+ * line. Carries the full poll snapshot (options, no voters yet) at receipt time.
1421
1437
  */
1422
1438
  export interface Data {
1423
1439
  /**
1424
- * @deprecated DEPRECATED: Use participant instead. Handle (phone number or email
1425
- * address) of the added participant.
1440
+ * Chat info for poll webhook events.
1426
1441
  */
1427
- handle: string;
1442
+ chat: Data.Chat;
1428
1443
 
1429
- /**
1430
- * When the participant was added
1431
- */
1432
- added_at?: string;
1444
+ created_at: string;
1445
+
1446
+ direction: 'inbound' | 'outbound';
1447
+
1448
+ message_id: string;
1449
+
1450
+ poll: Data.Poll;
1451
+
1452
+ received_at: string;
1453
+
1454
+ service: string;
1455
+
1456
+ updated_at: string;
1433
1457
 
1434
1458
  /**
1435
- * Chat identifier (UUID) of the group chat
1459
+ * The line that created the poll (is_me=false for an inbound poll).
1436
1460
  */
1437
- chat_id?: string;
1461
+ sender_handle?: Shared.ChatHandle | null;
1462
+ }
1438
1463
 
1464
+ export namespace Data {
1439
1465
  /**
1440
- * The added participant as a full handle object
1466
+ * Chat info for poll webhook events.
1441
1467
  */
1442
- participant?: Shared.ChatHandle;
1468
+ export interface Chat {
1469
+ id: string;
1470
+
1471
+ is_group?: boolean | null;
1472
+
1473
+ owner_handle?: Shared.ChatHandle | null;
1474
+ }
1475
+
1476
+ export interface Poll {
1477
+ options: Array<Poll.Option>;
1478
+
1479
+ /**
1480
+ * Distinct participants across the whole poll.
1481
+ */
1482
+ total_voters: number;
1483
+ }
1484
+
1485
+ export namespace Poll {
1486
+ export interface Option {
1487
+ can_be_edited: boolean;
1488
+
1489
+ /**
1490
+ * The participant who added this option (poll creator for the initial options;
1491
+ * whoever added later ones). Null when unknown.
1492
+ */
1493
+ creator_handle: Shared.ChatHandle;
1494
+
1495
+ option_id: string;
1496
+
1497
+ text: string;
1498
+
1499
+ voters: Array<Option.Voter>;
1500
+ }
1501
+
1502
+ export namespace Option {
1503
+ export interface Voter {
1504
+ handle: string;
1505
+
1506
+ voted_at: string;
1507
+ }
1508
+ }
1509
+ }
1443
1510
  }
1444
1511
  }
1445
1512
 
1446
1513
  /**
1447
- * Complete webhook payload for participant.removed events
1514
+ * Complete webhook payload for poll.sent events
1448
1515
  */
1449
- export interface ParticipantRemovedWebhookEvent {
1516
+ export interface PollSentWebhookEvent {
1450
1517
  /**
1451
1518
  * API version for the webhook payload format
1452
1519
  */
@@ -1458,9 +1525,11 @@ export interface ParticipantRemovedWebhookEvent {
1458
1525
  created_at: string;
1459
1526
 
1460
1527
  /**
1461
- * Payload for participant.removed webhook events
1528
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1529
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1530
+ * +delivered_at; read → +read_at.
1462
1531
  */
1463
- data: ParticipantRemovedWebhookEvent.Data;
1532
+ data: PollSentWebhookEvent.Data;
1464
1533
 
1465
1534
  /**
1466
1535
  * Unique identifier for this event (for deduplication)
@@ -1494,38 +1563,95 @@ export interface ParticipantRemovedWebhookEvent {
1494
1563
  webhook_version: string;
1495
1564
  }
1496
1565
 
1497
- export namespace ParticipantRemovedWebhookEvent {
1566
+ export namespace PollSentWebhookEvent {
1498
1567
  /**
1499
- * Payload for participant.removed webhook events
1568
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1569
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1570
+ * +delivered_at; read → +read_at.
1500
1571
  */
1501
1572
  export interface Data {
1502
1573
  /**
1503
- * @deprecated DEPRECATED: Use participant instead. Handle (phone number or email
1504
- * address) of the removed participant.
1574
+ * Chat info for poll webhook events.
1505
1575
  */
1506
- handle: string;
1576
+ chat: Data.Chat;
1507
1577
 
1508
- /**
1509
- * Chat identifier (UUID) of the group chat
1510
- */
1511
- chat_id?: string;
1578
+ created_at: string;
1579
+
1580
+ direction: 'inbound' | 'outbound';
1581
+
1582
+ message_id: string;
1583
+
1584
+ poll: Data.Poll;
1585
+
1586
+ service: string;
1587
+
1588
+ updated_at: string;
1589
+
1590
+ delivered_at?: string | null;
1591
+
1592
+ read_at?: string | null;
1512
1593
 
1513
1594
  /**
1514
- * The removed participant as a full handle object
1595
+ * The handle that sent the poll.
1515
1596
  */
1516
- participant?: Shared.ChatHandle;
1597
+ sender_handle?: Shared.ChatHandle | null;
1598
+
1599
+ sent_at?: string | null;
1600
+ }
1517
1601
 
1602
+ export namespace Data {
1518
1603
  /**
1519
- * When the participant was removed
1604
+ * Chat info for poll webhook events.
1520
1605
  */
1521
- removed_at?: string;
1606
+ export interface Chat {
1607
+ id: string;
1608
+
1609
+ is_group?: boolean | null;
1610
+
1611
+ owner_handle?: Shared.ChatHandle | null;
1612
+ }
1613
+
1614
+ export interface Poll {
1615
+ options: Array<Poll.Option>;
1616
+
1617
+ /**
1618
+ * Distinct participants across the whole poll.
1619
+ */
1620
+ total_voters: number;
1621
+ }
1622
+
1623
+ export namespace Poll {
1624
+ export interface Option {
1625
+ can_be_edited: boolean;
1626
+
1627
+ /**
1628
+ * The participant who added this option (poll creator for the initial options;
1629
+ * whoever added later ones). Null when unknown.
1630
+ */
1631
+ creator_handle: Shared.ChatHandle;
1632
+
1633
+ option_id: string;
1634
+
1635
+ text: string;
1636
+
1637
+ voters: Array<Option.Voter>;
1638
+ }
1639
+
1640
+ export namespace Option {
1641
+ export interface Voter {
1642
+ handle: string;
1643
+
1644
+ voted_at: string;
1645
+ }
1646
+ }
1647
+ }
1522
1648
  }
1523
1649
  }
1524
1650
 
1525
1651
  /**
1526
- * Complete webhook payload for chat.created events
1652
+ * Complete webhook payload for poll.delivered events
1527
1653
  */
1528
- export interface ChatCreatedWebhookEvent {
1654
+ export interface PollDeliveredWebhookEvent {
1529
1655
  /**
1530
1656
  * API version for the webhook payload format
1531
1657
  */
@@ -1537,10 +1663,11 @@ export interface ChatCreatedWebhookEvent {
1537
1663
  created_at: string;
1538
1664
 
1539
1665
  /**
1540
- * Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
1541
- * response.
1666
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1667
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1668
+ * +delivered_at; read → +read_at.
1542
1669
  */
1543
- data: ChatCreatedWebhookEvent.Data;
1670
+ data: PollDeliveredWebhookEvent.Data;
1544
1671
 
1545
1672
  /**
1546
1673
  * Unique identifier for this event (for deduplication)
@@ -1574,119 +1701,95 @@ export interface ChatCreatedWebhookEvent {
1574
1701
  webhook_version: string;
1575
1702
  }
1576
1703
 
1577
- export namespace ChatCreatedWebhookEvent {
1704
+ export namespace PollDeliveredWebhookEvent {
1578
1705
  /**
1579
- * Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
1580
- * response.
1706
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1707
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1708
+ * +delivered_at; read → +read_at.
1581
1709
  */
1582
1710
  export interface Data {
1583
1711
  /**
1584
- * Unique identifier for the chat
1712
+ * Chat info for poll webhook events.
1585
1713
  */
1586
- id: string;
1714
+ chat: Data.Chat;
1587
1715
 
1588
- /**
1589
- * When the chat was created
1590
- */
1591
1716
  created_at: string;
1592
1717
 
1593
- /**
1594
- * Display name for the chat. Defaults to a comma-separated list of recipient
1595
- * handles. Can be updated for group chats.
1596
- */
1597
- display_name: string | null;
1718
+ direction: 'inbound' | 'outbound';
1598
1719
 
1599
- /**
1600
- * List of chat participants with full handle details. Always contains at least two
1601
- * handles (your phone number and the other participant).
1602
- */
1603
- handles: Array<Shared.ChatHandle>;
1720
+ message_id: string;
1604
1721
 
1605
- /**
1606
- * **[BETA]** Current health for a chat. Always present — chats start at `HEALTHY`
1607
- * and may shift based on engagement and delivery signals on the conversation. Many
1608
- * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
1609
- * flagging.
1610
- *
1611
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
1612
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
1613
- * relevant section of the Chat Health guide.
1614
- *
1615
- * See the [Chat Health guide](/guides/chats/chat-health) for what each status
1616
- * means and how to react.
1617
- */
1618
- health_status: Data.HealthStatus;
1722
+ poll: Data.Poll;
1619
1723
 
1620
- /**
1621
- * Whether this is a group chat
1622
- */
1623
- is_group: boolean;
1724
+ service: string;
1624
1725
 
1625
- /**
1626
- * When the chat was last updated
1627
- */
1628
1726
  updated_at: string;
1629
1727
 
1728
+ delivered_at?: string | null;
1729
+
1730
+ read_at?: string | null;
1731
+
1630
1732
  /**
1631
- * Messaging service type
1733
+ * The handle that sent the poll.
1632
1734
  */
1633
- service?: Shared.ServiceType | null;
1735
+ sender_handle?: Shared.ChatHandle | null;
1736
+
1737
+ sent_at?: string | null;
1634
1738
  }
1635
1739
 
1636
1740
  export namespace Data {
1637
1741
  /**
1638
- * **[BETA]** Current health for a chat. Always present — chats start at `HEALTHY`
1639
- * and may shift based on engagement and delivery signals on the conversation. Many
1640
- * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
1641
- * flagging.
1642
- *
1643
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
1644
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
1645
- * relevant section of the Chat Health guide.
1646
- *
1647
- * See the [Chat Health guide](/guides/chats/chat-health) for what each status
1648
- * means and how to react.
1742
+ * Chat info for poll webhook events.
1649
1743
  */
1650
- export interface HealthStatus {
1651
- /**
1652
- * Deep-link to the relevant section of the Chat Health guide for this status.
1653
- */
1654
- doc_url: string;
1744
+ export interface Chat {
1745
+ id: string;
1655
1746
 
1656
- /**
1657
- * Current health bucket for the chat. See the
1658
- * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
1659
- * to react. `doc_url` deep-links to the relevant section.
1660
- *
1661
- * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
1662
- * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
1663
- * longer one: `STOP` counts, `please stop` does not. Most keywords must match
1664
- * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
1665
- * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
1666
- * count. It clears as soon as they reply again: any later message from them that
1667
- * is not itself an opt-out keyword opts them back in immediately — a reply in any
1668
- * conversation with you counts, the same way the block does.
1669
- *
1670
- * Linq enforces this: while a recipient is opted out, every send to them is
1671
- * rejected with `403` (error code `2024`) before the message is queued, across
1672
- * every chat and every line on your account. Nothing is delivered, including a
1673
- * final courtesy message — to send one, set `override_optout: true` on that single
1674
- * request.
1675
- */
1676
- status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
1747
+ is_group?: boolean | null;
1748
+
1749
+ owner_handle?: Shared.ChatHandle | null;
1750
+ }
1751
+
1752
+ export interface Poll {
1753
+ options: Array<Poll.Option>;
1677
1754
 
1678
1755
  /**
1679
- * When this status last changed.
1756
+ * Distinct participants across the whole poll.
1680
1757
  */
1681
- updated_at: string;
1758
+ total_voters: number;
1759
+ }
1760
+
1761
+ export namespace Poll {
1762
+ export interface Option {
1763
+ can_be_edited: boolean;
1764
+
1765
+ /**
1766
+ * The participant who added this option (poll creator for the initial options;
1767
+ * whoever added later ones). Null when unknown.
1768
+ */
1769
+ creator_handle: Shared.ChatHandle;
1770
+
1771
+ option_id: string;
1772
+
1773
+ text: string;
1774
+
1775
+ voters: Array<Option.Voter>;
1776
+ }
1777
+
1778
+ export namespace Option {
1779
+ export interface Voter {
1780
+ handle: string;
1781
+
1782
+ voted_at: string;
1783
+ }
1784
+ }
1682
1785
  }
1683
1786
  }
1684
1787
  }
1685
1788
 
1686
1789
  /**
1687
- * Complete webhook payload for chat.group_name_updated events
1790
+ * Complete webhook payload for poll.read events
1688
1791
  */
1689
- export interface ChatGroupNameUpdatedWebhookEvent {
1792
+ export interface PollReadWebhookEvent {
1690
1793
  /**
1691
1794
  * API version for the webhook payload format
1692
1795
  */
@@ -1698,9 +1801,11 @@ export interface ChatGroupNameUpdatedWebhookEvent {
1698
1801
  created_at: string;
1699
1802
 
1700
1803
  /**
1701
- * Payload for chat.group_name_updated webhook events
1804
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1805
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1806
+ * +delivered_at; read → +read_at.
1702
1807
  */
1703
- data: ChatGroupNameUpdatedWebhookEvent.Data;
1808
+ data: PollReadWebhookEvent.Data;
1704
1809
 
1705
1810
  /**
1706
1811
  * Unique identifier for this event (for deduplication)
@@ -1734,58 +1839,1006 @@ export interface ChatGroupNameUpdatedWebhookEvent {
1734
1839
  webhook_version: string;
1735
1840
  }
1736
1841
 
1737
- export namespace ChatGroupNameUpdatedWebhookEvent {
1842
+ export namespace PollReadWebhookEvent {
1738
1843
  /**
1739
- * Payload for chat.group_name_updated webhook events
1844
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1845
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1846
+ * +delivered_at; read → +read_at.
1740
1847
  */
1741
1848
  export interface Data {
1742
1849
  /**
1743
- * Chat identifier (UUID) of the group chat
1850
+ * Chat info for poll webhook events.
1744
1851
  */
1745
- chat_id: string;
1852
+ chat: Data.Chat;
1853
+
1854
+ created_at: string;
1855
+
1856
+ direction: 'inbound' | 'outbound';
1857
+
1858
+ message_id: string;
1859
+
1860
+ poll: Data.Poll;
1861
+
1862
+ service: string;
1746
1863
 
1747
- /**
1748
- * When the update occurred
1749
- */
1750
1864
  updated_at: string;
1751
1865
 
1752
- /**
1753
- * The handle who made the change.
1754
- */
1755
- changed_by_handle?: Shared.ChatHandle | null;
1866
+ delivered_at?: string | null;
1867
+
1868
+ read_at?: string | null;
1756
1869
 
1757
1870
  /**
1758
- * New group name (null if the name was removed)
1871
+ * The handle that sent the poll.
1759
1872
  */
1760
- new_value?: string | null;
1873
+ sender_handle?: Shared.ChatHandle | null;
1874
+
1875
+ sent_at?: string | null;
1876
+ }
1761
1877
 
1878
+ export namespace Data {
1762
1879
  /**
1763
- * Previous group name (null if no previous name)
1880
+ * Chat info for poll webhook events.
1764
1881
  */
1765
- old_value?: string | null;
1766
- }
1767
- }
1882
+ export interface Chat {
1883
+ id: string;
1768
1884
 
1769
- /**
1770
- * Complete webhook payload for chat.group_icon_updated events
1771
- */
1772
- export interface ChatGroupIconUpdatedWebhookEvent {
1773
- /**
1774
- * API version for the webhook payload format
1775
- */
1776
- api_version: string;
1885
+ is_group?: boolean | null;
1777
1886
 
1778
- /**
1779
- * When the event was created
1780
- */
1781
- created_at: string;
1887
+ owner_handle?: Shared.ChatHandle | null;
1888
+ }
1782
1889
 
1783
- /**
1784
- * Payload for chat.group_icon_updated webhook events
1785
- */
1786
- data: ChatGroupIconUpdatedWebhookEvent.Data;
1890
+ export interface Poll {
1891
+ options: Array<Poll.Option>;
1787
1892
 
1788
- /**
1893
+ /**
1894
+ * Distinct participants across the whole poll.
1895
+ */
1896
+ total_voters: number;
1897
+ }
1898
+
1899
+ export namespace Poll {
1900
+ export interface Option {
1901
+ can_be_edited: boolean;
1902
+
1903
+ /**
1904
+ * The participant who added this option (poll creator for the initial options;
1905
+ * whoever added later ones). Null when unknown.
1906
+ */
1907
+ creator_handle: Shared.ChatHandle;
1908
+
1909
+ option_id: string;
1910
+
1911
+ text: string;
1912
+
1913
+ voters: Array<Option.Voter>;
1914
+ }
1915
+
1916
+ export namespace Option {
1917
+ export interface Voter {
1918
+ handle: string;
1919
+
1920
+ voted_at: string;
1921
+ }
1922
+ }
1923
+ }
1924
+ }
1925
+ }
1926
+
1927
+ /**
1928
+ * Complete webhook payload for poll.updated events
1929
+ */
1930
+ export interface PollUpdatedWebhookEvent {
1931
+ /**
1932
+ * API version for the webhook payload format
1933
+ */
1934
+ api_version: string;
1935
+
1936
+ /**
1937
+ * When the event was created
1938
+ */
1939
+ created_at: string;
1940
+
1941
+ /**
1942
+ * Payload for poll.updated (option(s) added — add-only).
1943
+ */
1944
+ data: PollUpdatedWebhookEvent.Data;
1945
+
1946
+ /**
1947
+ * Unique identifier for this event (for deduplication)
1948
+ */
1949
+ event_id: string;
1950
+
1951
+ /**
1952
+ * Valid webhook event types that can be subscribed to.
1953
+ *
1954
+ * **Note:** `message.edited` is only delivered to subscriptions using
1955
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
1956
+ * subscription will not produce any deliveries.
1957
+ */
1958
+ event_type: WebhookEventsAPI.WebhookEventType;
1959
+
1960
+ /**
1961
+ * Partner identifier. Present on all webhooks for cross-referencing.
1962
+ */
1963
+ partner_id: string;
1964
+
1965
+ /**
1966
+ * Trace ID for debugging and correlation across systems.
1967
+ */
1968
+ trace_id: string;
1969
+
1970
+ /**
1971
+ * Date-based webhook payload version. Determined by the `?version=` query
1972
+ * parameter in your webhook subscription URL. If no version parameter is
1973
+ * specified, defaults based on subscription creation date.
1974
+ */
1975
+ webhook_version: string;
1976
+ }
1977
+
1978
+ export namespace PollUpdatedWebhookEvent {
1979
+ /**
1980
+ * Payload for poll.updated (option(s) added — add-only).
1981
+ */
1982
+ export interface Data {
1983
+ added_options: Array<Data.AddedOption>;
1984
+
1985
+ /**
1986
+ * Chat info for poll webhook events.
1987
+ */
1988
+ chat: Data.Chat;
1989
+
1990
+ direction: 'inbound' | 'outbound';
1991
+
1992
+ message_id: string;
1993
+
1994
+ /**
1995
+ * The line that added the option(s) — always present.
1996
+ */
1997
+ sender_handle: Shared.ChatHandle;
1998
+
1999
+ service: string;
2000
+ }
2001
+
2002
+ export namespace Data {
2003
+ export interface AddedOption {
2004
+ can_be_edited: boolean;
2005
+
2006
+ /**
2007
+ * The participant who added this option (poll creator for the initial options;
2008
+ * whoever added later ones). Null when unknown.
2009
+ */
2010
+ creator_handle: Shared.ChatHandle;
2011
+
2012
+ option_id: string;
2013
+
2014
+ text: string;
2015
+
2016
+ voters: Array<AddedOption.Voter>;
2017
+ }
2018
+
2019
+ export namespace AddedOption {
2020
+ export interface Voter {
2021
+ handle: string;
2022
+
2023
+ voted_at: string;
2024
+ }
2025
+ }
2026
+
2027
+ /**
2028
+ * Chat info for poll webhook events.
2029
+ */
2030
+ export interface Chat {
2031
+ id: string;
2032
+
2033
+ is_group?: boolean | null;
2034
+
2035
+ owner_handle?: Shared.ChatHandle | null;
2036
+ }
2037
+ }
2038
+ }
2039
+
2040
+ /**
2041
+ * Complete webhook payload for poll.failed events
2042
+ */
2043
+ export interface PollFailedWebhookEvent {
2044
+ /**
2045
+ * API version for the webhook payload format
2046
+ */
2047
+ api_version: string;
2048
+
2049
+ /**
2050
+ * When the event was created
2051
+ */
2052
+ created_at: string;
2053
+
2054
+ /**
2055
+ * Payload for poll.failed — an outbound poll (or poll action) that failed to send.
2056
+ * Carries the poll snapshot at failure time plus the error and when it failed.
2057
+ */
2058
+ data: PollFailedWebhookEvent.Data;
2059
+
2060
+ /**
2061
+ * Unique identifier for this event (for deduplication)
2062
+ */
2063
+ event_id: string;
2064
+
2065
+ /**
2066
+ * Valid webhook event types that can be subscribed to.
2067
+ *
2068
+ * **Note:** `message.edited` is only delivered to subscriptions using
2069
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2070
+ * subscription will not produce any deliveries.
2071
+ */
2072
+ event_type: WebhookEventsAPI.WebhookEventType;
2073
+
2074
+ /**
2075
+ * Partner identifier. Present on all webhooks for cross-referencing.
2076
+ */
2077
+ partner_id: string;
2078
+
2079
+ /**
2080
+ * Trace ID for debugging and correlation across systems.
2081
+ */
2082
+ trace_id: string;
2083
+
2084
+ /**
2085
+ * Date-based webhook payload version. Determined by the `?version=` query
2086
+ * parameter in your webhook subscription URL. If no version parameter is
2087
+ * specified, defaults based on subscription creation date.
2088
+ */
2089
+ webhook_version: string;
2090
+ }
2091
+
2092
+ export namespace PollFailedWebhookEvent {
2093
+ /**
2094
+ * Payload for poll.failed — an outbound poll (or poll action) that failed to send.
2095
+ * Carries the poll snapshot at failure time plus the error and when it failed.
2096
+ */
2097
+ export interface Data {
2098
+ /**
2099
+ * Chat info for poll webhook events.
2100
+ */
2101
+ chat: Data.Chat;
2102
+
2103
+ direction: 'inbound' | 'outbound';
2104
+
2105
+ error: Data.Error;
2106
+
2107
+ failed_at: string;
2108
+
2109
+ message_id: string;
2110
+
2111
+ poll: Data.Poll;
2112
+
2113
+ service: string;
2114
+
2115
+ /**
2116
+ * Null on failure (the send never landed).
2117
+ */
2118
+ sender_handle?: Shared.ChatHandle | null;
2119
+ }
2120
+
2121
+ export namespace Data {
2122
+ /**
2123
+ * Chat info for poll webhook events.
2124
+ */
2125
+ export interface Chat {
2126
+ id: string;
2127
+
2128
+ is_group?: boolean | null;
2129
+
2130
+ owner_handle?: Shared.ChatHandle | null;
2131
+ }
2132
+
2133
+ export interface Error {
2134
+ /**
2135
+ * Error codes in webhook failure events. The possible set varies by event:
2136
+ * message.failed and poll.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or
2137
+ * 4008; the group update failure events (chat.group_name_update_failed,
2138
+ * chat.group_icon_update_failed) carry 3007 or 4001.
2139
+ */
2140
+ code: number;
2141
+
2142
+ message: string;
2143
+ }
2144
+
2145
+ export interface Poll {
2146
+ options: Array<Poll.Option>;
2147
+
2148
+ /**
2149
+ * Distinct participants across the whole poll.
2150
+ */
2151
+ total_voters: number;
2152
+ }
2153
+
2154
+ export namespace Poll {
2155
+ export interface Option {
2156
+ can_be_edited: boolean;
2157
+
2158
+ /**
2159
+ * The participant who added this option (poll creator for the initial options;
2160
+ * whoever added later ones). Null when unknown.
2161
+ */
2162
+ creator_handle: Shared.ChatHandle;
2163
+
2164
+ option_id: string;
2165
+
2166
+ text: string;
2167
+
2168
+ voters: Array<Option.Voter>;
2169
+ }
2170
+
2171
+ export namespace Option {
2172
+ export interface Voter {
2173
+ handle: string;
2174
+
2175
+ voted_at: string;
2176
+ }
2177
+ }
2178
+ }
2179
+ }
2180
+ }
2181
+
2182
+ /**
2183
+ * Complete webhook payload for poll.vote.added events
2184
+ */
2185
+ export interface PollVoteAddedWebhookEvent {
2186
+ /**
2187
+ * API version for the webhook payload format
2188
+ */
2189
+ api_version: string;
2190
+
2191
+ /**
2192
+ * When the event was created
2193
+ */
2194
+ created_at: string;
2195
+
2196
+ /**
2197
+ * Payload for poll.vote.added and poll.vote.removed (one option toggled).
2198
+ */
2199
+ data: PollVoteAddedWebhookEvent.Data;
2200
+
2201
+ /**
2202
+ * Unique identifier for this event (for deduplication)
2203
+ */
2204
+ event_id: string;
2205
+
2206
+ /**
2207
+ * Valid webhook event types that can be subscribed to.
2208
+ *
2209
+ * **Note:** `message.edited` is only delivered to subscriptions using
2210
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2211
+ * subscription will not produce any deliveries.
2212
+ */
2213
+ event_type: WebhookEventsAPI.WebhookEventType;
2214
+
2215
+ /**
2216
+ * Partner identifier. Present on all webhooks for cross-referencing.
2217
+ */
2218
+ partner_id: string;
2219
+
2220
+ /**
2221
+ * Trace ID for debugging and correlation across systems.
2222
+ */
2223
+ trace_id: string;
2224
+
2225
+ /**
2226
+ * Date-based webhook payload version. Determined by the `?version=` query
2227
+ * parameter in your webhook subscription URL. If no version parameter is
2228
+ * specified, defaults based on subscription creation date.
2229
+ */
2230
+ webhook_version: string;
2231
+ }
2232
+
2233
+ export namespace PollVoteAddedWebhookEvent {
2234
+ /**
2235
+ * Payload for poll.vote.added and poll.vote.removed (one option toggled).
2236
+ */
2237
+ export interface Data {
2238
+ /**
2239
+ * Chat info for poll webhook events.
2240
+ */
2241
+ chat: Data.Chat;
2242
+
2243
+ direction: 'inbound' | 'outbound';
2244
+
2245
+ message_id: string;
2246
+
2247
+ option_id: string;
2248
+
2249
+ /**
2250
+ * The voter — always present.
2251
+ */
2252
+ sender_handle: Shared.ChatHandle;
2253
+
2254
+ service: string;
2255
+ }
2256
+
2257
+ export namespace Data {
2258
+ /**
2259
+ * Chat info for poll webhook events.
2260
+ */
2261
+ export interface Chat {
2262
+ id: string;
2263
+
2264
+ is_group?: boolean | null;
2265
+
2266
+ owner_handle?: Shared.ChatHandle | null;
2267
+ }
2268
+ }
2269
+ }
2270
+
2271
+ /**
2272
+ * Complete webhook payload for poll.vote.removed events
2273
+ */
2274
+ export interface PollVoteRemovedWebhookEvent {
2275
+ /**
2276
+ * API version for the webhook payload format
2277
+ */
2278
+ api_version: string;
2279
+
2280
+ /**
2281
+ * When the event was created
2282
+ */
2283
+ created_at: string;
2284
+
2285
+ /**
2286
+ * Payload for poll.vote.added and poll.vote.removed (one option toggled).
2287
+ */
2288
+ data: PollVoteRemovedWebhookEvent.Data;
2289
+
2290
+ /**
2291
+ * Unique identifier for this event (for deduplication)
2292
+ */
2293
+ event_id: string;
2294
+
2295
+ /**
2296
+ * Valid webhook event types that can be subscribed to.
2297
+ *
2298
+ * **Note:** `message.edited` is only delivered to subscriptions using
2299
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2300
+ * subscription will not produce any deliveries.
2301
+ */
2302
+ event_type: WebhookEventsAPI.WebhookEventType;
2303
+
2304
+ /**
2305
+ * Partner identifier. Present on all webhooks for cross-referencing.
2306
+ */
2307
+ partner_id: string;
2308
+
2309
+ /**
2310
+ * Trace ID for debugging and correlation across systems.
2311
+ */
2312
+ trace_id: string;
2313
+
2314
+ /**
2315
+ * Date-based webhook payload version. Determined by the `?version=` query
2316
+ * parameter in your webhook subscription URL. If no version parameter is
2317
+ * specified, defaults based on subscription creation date.
2318
+ */
2319
+ webhook_version: string;
2320
+ }
2321
+
2322
+ export namespace PollVoteRemovedWebhookEvent {
2323
+ /**
2324
+ * Payload for poll.vote.added and poll.vote.removed (one option toggled).
2325
+ */
2326
+ export interface Data {
2327
+ /**
2328
+ * Chat info for poll webhook events.
2329
+ */
2330
+ chat: Data.Chat;
2331
+
2332
+ direction: 'inbound' | 'outbound';
2333
+
2334
+ message_id: string;
2335
+
2336
+ option_id: string;
2337
+
2338
+ /**
2339
+ * The voter — always present.
2340
+ */
2341
+ sender_handle: Shared.ChatHandle;
2342
+
2343
+ service: string;
2344
+ }
2345
+
2346
+ export namespace Data {
2347
+ /**
2348
+ * Chat info for poll webhook events.
2349
+ */
2350
+ export interface Chat {
2351
+ id: string;
2352
+
2353
+ is_group?: boolean | null;
2354
+
2355
+ owner_handle?: Shared.ChatHandle | null;
2356
+ }
2357
+ }
2358
+ }
2359
+
2360
+ /**
2361
+ * Complete webhook payload for poll.reaction.added events
2362
+ */
2363
+ export interface PollReactionAddedWebhookEvent {
2364
+ /**
2365
+ * API version for the webhook payload format
2366
+ */
2367
+ api_version: string;
2368
+
2369
+ /**
2370
+ * When the event was created
2371
+ */
2372
+ created_at: string;
2373
+
2374
+ /**
2375
+ * Payload for poll.reaction.added — a reaction on a poll message. Same shape as
2376
+ * reaction.added; `message_id` is the poll-definition message's ID. Poll reactions
2377
+ * are stickers, which iMessage cannot remove, so there is no removal counterpart.
2378
+ */
2379
+ data: ReactionEventBase;
2380
+
2381
+ /**
2382
+ * Unique identifier for this event (for deduplication)
2383
+ */
2384
+ event_id: string;
2385
+
2386
+ /**
2387
+ * Valid webhook event types that can be subscribed to.
2388
+ *
2389
+ * **Note:** `message.edited` is only delivered to subscriptions using
2390
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2391
+ * subscription will not produce any deliveries.
2392
+ */
2393
+ event_type: WebhookEventsAPI.WebhookEventType;
2394
+
2395
+ /**
2396
+ * Partner identifier. Present on all webhooks for cross-referencing.
2397
+ */
2398
+ partner_id: string;
2399
+
2400
+ /**
2401
+ * Trace ID for debugging and correlation across systems.
2402
+ */
2403
+ trace_id: string;
2404
+
2405
+ /**
2406
+ * Date-based webhook payload version. Determined by the `?version=` query
2407
+ * parameter in your webhook subscription URL. If no version parameter is
2408
+ * specified, defaults based on subscription creation date.
2409
+ */
2410
+ webhook_version: string;
2411
+ }
2412
+
2413
+ /**
2414
+ * Complete webhook payload for participant.added events
2415
+ */
2416
+ export interface ParticipantAddedWebhookEvent {
2417
+ /**
2418
+ * API version for the webhook payload format
2419
+ */
2420
+ api_version: string;
2421
+
2422
+ /**
2423
+ * When the event was created
2424
+ */
2425
+ created_at: string;
2426
+
2427
+ /**
2428
+ * Payload for participant.added webhook events
2429
+ */
2430
+ data: ParticipantAddedWebhookEvent.Data;
2431
+
2432
+ /**
2433
+ * Unique identifier for this event (for deduplication)
2434
+ */
2435
+ event_id: string;
2436
+
2437
+ /**
2438
+ * Valid webhook event types that can be subscribed to.
2439
+ *
2440
+ * **Note:** `message.edited` is only delivered to subscriptions using
2441
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2442
+ * subscription will not produce any deliveries.
2443
+ */
2444
+ event_type: WebhookEventsAPI.WebhookEventType;
2445
+
2446
+ /**
2447
+ * Partner identifier. Present on all webhooks for cross-referencing.
2448
+ */
2449
+ partner_id: string;
2450
+
2451
+ /**
2452
+ * Trace ID for debugging and correlation across systems.
2453
+ */
2454
+ trace_id: string;
2455
+
2456
+ /**
2457
+ * Date-based webhook payload version. Determined by the `?version=` query
2458
+ * parameter in your webhook subscription URL. If no version parameter is
2459
+ * specified, defaults based on subscription creation date.
2460
+ */
2461
+ webhook_version: string;
2462
+ }
2463
+
2464
+ export namespace ParticipantAddedWebhookEvent {
2465
+ /**
2466
+ * Payload for participant.added webhook events
2467
+ */
2468
+ export interface Data {
2469
+ /**
2470
+ * @deprecated DEPRECATED: Use participant instead. Handle (phone number or email
2471
+ * address) of the added participant.
2472
+ */
2473
+ handle: string;
2474
+
2475
+ /**
2476
+ * When the participant was added
2477
+ */
2478
+ added_at?: string;
2479
+
2480
+ /**
2481
+ * Chat identifier (UUID) of the group chat
2482
+ */
2483
+ chat_id?: string;
2484
+
2485
+ /**
2486
+ * The added participant as a full handle object
2487
+ */
2488
+ participant?: Shared.ChatHandle;
2489
+ }
2490
+ }
2491
+
2492
+ /**
2493
+ * Complete webhook payload for participant.removed events
2494
+ */
2495
+ export interface ParticipantRemovedWebhookEvent {
2496
+ /**
2497
+ * API version for the webhook payload format
2498
+ */
2499
+ api_version: string;
2500
+
2501
+ /**
2502
+ * When the event was created
2503
+ */
2504
+ created_at: string;
2505
+
2506
+ /**
2507
+ * Payload for participant.removed webhook events
2508
+ */
2509
+ data: ParticipantRemovedWebhookEvent.Data;
2510
+
2511
+ /**
2512
+ * Unique identifier for this event (for deduplication)
2513
+ */
2514
+ event_id: string;
2515
+
2516
+ /**
2517
+ * Valid webhook event types that can be subscribed to.
2518
+ *
2519
+ * **Note:** `message.edited` is only delivered to subscriptions using
2520
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2521
+ * subscription will not produce any deliveries.
2522
+ */
2523
+ event_type: WebhookEventsAPI.WebhookEventType;
2524
+
2525
+ /**
2526
+ * Partner identifier. Present on all webhooks for cross-referencing.
2527
+ */
2528
+ partner_id: string;
2529
+
2530
+ /**
2531
+ * Trace ID for debugging and correlation across systems.
2532
+ */
2533
+ trace_id: string;
2534
+
2535
+ /**
2536
+ * Date-based webhook payload version. Determined by the `?version=` query
2537
+ * parameter in your webhook subscription URL. If no version parameter is
2538
+ * specified, defaults based on subscription creation date.
2539
+ */
2540
+ webhook_version: string;
2541
+ }
2542
+
2543
+ export namespace ParticipantRemovedWebhookEvent {
2544
+ /**
2545
+ * Payload for participant.removed webhook events
2546
+ */
2547
+ export interface Data {
2548
+ /**
2549
+ * @deprecated DEPRECATED: Use participant instead. Handle (phone number or email
2550
+ * address) of the removed participant.
2551
+ */
2552
+ handle: string;
2553
+
2554
+ /**
2555
+ * Chat identifier (UUID) of the group chat
2556
+ */
2557
+ chat_id?: string;
2558
+
2559
+ /**
2560
+ * The removed participant as a full handle object
2561
+ */
2562
+ participant?: Shared.ChatHandle;
2563
+
2564
+ /**
2565
+ * When the participant was removed
2566
+ */
2567
+ removed_at?: string;
2568
+ }
2569
+ }
2570
+
2571
+ /**
2572
+ * Complete webhook payload for chat.created events
2573
+ */
2574
+ export interface ChatCreatedWebhookEvent {
2575
+ /**
2576
+ * API version for the webhook payload format
2577
+ */
2578
+ api_version: string;
2579
+
2580
+ /**
2581
+ * When the event was created
2582
+ */
2583
+ created_at: string;
2584
+
2585
+ /**
2586
+ * Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
2587
+ * response.
2588
+ */
2589
+ data: ChatCreatedWebhookEvent.Data;
2590
+
2591
+ /**
2592
+ * Unique identifier for this event (for deduplication)
2593
+ */
2594
+ event_id: string;
2595
+
2596
+ /**
2597
+ * Valid webhook event types that can be subscribed to.
2598
+ *
2599
+ * **Note:** `message.edited` is only delivered to subscriptions using
2600
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2601
+ * subscription will not produce any deliveries.
2602
+ */
2603
+ event_type: WebhookEventsAPI.WebhookEventType;
2604
+
2605
+ /**
2606
+ * Partner identifier. Present on all webhooks for cross-referencing.
2607
+ */
2608
+ partner_id: string;
2609
+
2610
+ /**
2611
+ * Trace ID for debugging and correlation across systems.
2612
+ */
2613
+ trace_id: string;
2614
+
2615
+ /**
2616
+ * Date-based webhook payload version. Determined by the `?version=` query
2617
+ * parameter in your webhook subscription URL. If no version parameter is
2618
+ * specified, defaults based on subscription creation date.
2619
+ */
2620
+ webhook_version: string;
2621
+ }
2622
+
2623
+ export namespace ChatCreatedWebhookEvent {
2624
+ /**
2625
+ * Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
2626
+ * response.
2627
+ */
2628
+ export interface Data {
2629
+ /**
2630
+ * Unique identifier for the chat
2631
+ */
2632
+ id: string;
2633
+
2634
+ /**
2635
+ * When the chat was created
2636
+ */
2637
+ created_at: string;
2638
+
2639
+ /**
2640
+ * Display name for the chat. Defaults to a comma-separated list of recipient
2641
+ * handles. Can be updated for group chats.
2642
+ */
2643
+ display_name: string | null;
2644
+
2645
+ /**
2646
+ * List of chat participants with full handle details. Always contains at least two
2647
+ * handles (your phone number and the other participant).
2648
+ */
2649
+ handles: Array<Shared.ChatHandle>;
2650
+
2651
+ /**
2652
+ * **[BETA]** Current health for a chat. Always present — chats start at `HEALTHY`
2653
+ * and may shift based on engagement and delivery signals on the conversation. Many
2654
+ * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
2655
+ * flagging.
2656
+ *
2657
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
2658
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
2659
+ * relevant section of the Chat Health guide. To gate a send, act on the response
2660
+ * rather than the status: a `403` is the authoritative answer.
2661
+ *
2662
+ * See the [Chat Health guide](/guides/chats/chat-health) for what each status
2663
+ * means and how to react.
2664
+ */
2665
+ health_status: Data.HealthStatus;
2666
+
2667
+ /**
2668
+ * Whether this is a group chat
2669
+ */
2670
+ is_group: boolean;
2671
+
2672
+ /**
2673
+ * When the chat was last updated
2674
+ */
2675
+ updated_at: string;
2676
+
2677
+ /**
2678
+ * Messaging service type
2679
+ */
2680
+ service?: Shared.ServiceType | null;
2681
+ }
2682
+
2683
+ export namespace Data {
2684
+ /**
2685
+ * **[BETA]** Current health for a chat. Always present — chats start at `HEALTHY`
2686
+ * and may shift based on engagement and delivery signals on the conversation. Many
2687
+ * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
2688
+ * flagging.
2689
+ *
2690
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
2691
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
2692
+ * relevant section of the Chat Health guide. To gate a send, act on the response
2693
+ * rather than the status: a `403` is the authoritative answer.
2694
+ *
2695
+ * See the [Chat Health guide](/guides/chats/chat-health) for what each status
2696
+ * means and how to react.
2697
+ */
2698
+ export interface HealthStatus {
2699
+ /**
2700
+ * Deep-link to the relevant section of the Chat Health guide for this status.
2701
+ */
2702
+ doc_url: string;
2703
+
2704
+ /**
2705
+ * Current health bucket for the chat. See the
2706
+ * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
2707
+ * to react. `doc_url` deep-links to the relevant section.
2708
+ *
2709
+ * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
2710
+ * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
2711
+ * longer one: `STOP` counts, `please stop` does not. Most keywords must match
2712
+ * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
2713
+ * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
2714
+ * count. It clears as soon as they reply again: any later message from them that
2715
+ * is not itself an opt-out keyword opts them back in immediately — a reply in any
2716
+ * conversation with you counts, the same way the block does.
2717
+ *
2718
+ * `OPTED_OUT` marks only the conversation the keyword arrived in. The block below
2719
+ * is wider than the mark, so a conversation still reading `HEALTHY` can be blocked
2720
+ * as well — gate on the `403`, not on the status. Group threads are never marked
2721
+ * and are never blocked.
2722
+ *
2723
+ * Linq enforces this: while a recipient is opted out, every send to them is
2724
+ * rejected with `403` (error code `2024`) before the message is queued, across
2725
+ * every chat and every line on your account. Nothing is delivered, including a
2726
+ * final courtesy message — to send one, set `override_optout: true` on that single
2727
+ * request.
2728
+ */
2729
+ status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
2730
+
2731
+ /**
2732
+ * When this status last changed.
2733
+ */
2734
+ updated_at: string;
2735
+ }
2736
+ }
2737
+ }
2738
+
2739
+ /**
2740
+ * Complete webhook payload for chat.group_name_updated events
2741
+ */
2742
+ export interface ChatGroupNameUpdatedWebhookEvent {
2743
+ /**
2744
+ * API version for the webhook payload format
2745
+ */
2746
+ api_version: string;
2747
+
2748
+ /**
2749
+ * When the event was created
2750
+ */
2751
+ created_at: string;
2752
+
2753
+ /**
2754
+ * Payload for chat.group_name_updated webhook events
2755
+ */
2756
+ data: ChatGroupNameUpdatedWebhookEvent.Data;
2757
+
2758
+ /**
2759
+ * Unique identifier for this event (for deduplication)
2760
+ */
2761
+ event_id: string;
2762
+
2763
+ /**
2764
+ * Valid webhook event types that can be subscribed to.
2765
+ *
2766
+ * **Note:** `message.edited` is only delivered to subscriptions using
2767
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2768
+ * subscription will not produce any deliveries.
2769
+ */
2770
+ event_type: WebhookEventsAPI.WebhookEventType;
2771
+
2772
+ /**
2773
+ * Partner identifier. Present on all webhooks for cross-referencing.
2774
+ */
2775
+ partner_id: string;
2776
+
2777
+ /**
2778
+ * Trace ID for debugging and correlation across systems.
2779
+ */
2780
+ trace_id: string;
2781
+
2782
+ /**
2783
+ * Date-based webhook payload version. Determined by the `?version=` query
2784
+ * parameter in your webhook subscription URL. If no version parameter is
2785
+ * specified, defaults based on subscription creation date.
2786
+ */
2787
+ webhook_version: string;
2788
+ }
2789
+
2790
+ export namespace ChatGroupNameUpdatedWebhookEvent {
2791
+ /**
2792
+ * Payload for chat.group_name_updated webhook events
2793
+ */
2794
+ export interface Data {
2795
+ /**
2796
+ * Chat identifier (UUID) of the group chat
2797
+ */
2798
+ chat_id: string;
2799
+
2800
+ /**
2801
+ * When the update occurred
2802
+ */
2803
+ updated_at: string;
2804
+
2805
+ /**
2806
+ * The handle who made the change.
2807
+ */
2808
+ changed_by_handle?: Shared.ChatHandle | null;
2809
+
2810
+ /**
2811
+ * New group name (null if the name was removed)
2812
+ */
2813
+ new_value?: string | null;
2814
+
2815
+ /**
2816
+ * Previous group name (null if no previous name)
2817
+ */
2818
+ old_value?: string | null;
2819
+ }
2820
+ }
2821
+
2822
+ /**
2823
+ * Complete webhook payload for chat.group_icon_updated events
2824
+ */
2825
+ export interface ChatGroupIconUpdatedWebhookEvent {
2826
+ /**
2827
+ * API version for the webhook payload format
2828
+ */
2829
+ api_version: string;
2830
+
2831
+ /**
2832
+ * When the event was created
2833
+ */
2834
+ created_at: string;
2835
+
2836
+ /**
2837
+ * Payload for chat.group_icon_updated webhook events
2838
+ */
2839
+ data: ChatGroupIconUpdatedWebhookEvent.Data;
2840
+
2841
+ /**
1789
2842
  * Unique identifier for this event (for deduplication)
1790
2843
  */
1791
2844
  event_id: string;
@@ -1916,8 +2969,8 @@ export namespace ChatGroupNameUpdateFailedWebhookEvent {
1916
2969
 
1917
2970
  /**
1918
2971
  * Error codes in webhook failure events. The possible set varies by event:
1919
- * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
1920
- * update failure events (chat.group_name_update_failed,
2972
+ * message.failed and poll.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or
2973
+ * 4008; the group update failure events (chat.group_name_update_failed,
1921
2974
  * chat.group_icon_update_failed) carry 3007 or 4001.
1922
2975
  */
1923
2976
  error_code: number;
@@ -1996,8 +3049,8 @@ export namespace ChatGroupIconUpdateFailedWebhookEvent {
1996
3049
 
1997
3050
  /**
1998
3051
  * Error codes in webhook failure events. The possible set varies by event:
1999
- * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
2000
- * update failure events (chat.group_name_update_failed,
3052
+ * message.failed and poll.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or
3053
+ * 4008; the group update failure events (chat.group_name_update_failed,
2001
3054
  * chat.group_icon_update_failed) carry 3007 or 4001.
2002
3055
  */
2003
3056
  error_code: number;
@@ -2135,6 +3188,132 @@ export namespace ChatTypingIndicatorStoppedWebhookEvent {
2135
3188
  }
2136
3189
  }
2137
3190
 
3191
+ /**
3192
+ * Complete webhook payload for chat.background_updated events
3193
+ */
3194
+ export interface ChatBackgroundUpdatedWebhookEvent {
3195
+ /**
3196
+ * API version for the webhook payload format
3197
+ */
3198
+ api_version: string;
3199
+
3200
+ /**
3201
+ * When the event was created
3202
+ */
3203
+ created_at: string;
3204
+
3205
+ /**
3206
+ * Payload for chat.background_updated webhook events.
3207
+ */
3208
+ data: ChatBackgroundUpdatedWebhookEvent.Data;
3209
+
3210
+ /**
3211
+ * Unique identifier for this event (for deduplication)
3212
+ */
3213
+ event_id: string;
3214
+
3215
+ /**
3216
+ * Valid webhook event types that can be subscribed to.
3217
+ *
3218
+ * **Note:** `message.edited` is only delivered to subscriptions using
3219
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
3220
+ * subscription will not produce any deliveries.
3221
+ */
3222
+ event_type: WebhookEventsAPI.WebhookEventType;
3223
+
3224
+ /**
3225
+ * Partner identifier. Present on all webhooks for cross-referencing.
3226
+ */
3227
+ partner_id: string;
3228
+
3229
+ /**
3230
+ * Trace ID for debugging and correlation across systems.
3231
+ */
3232
+ trace_id: string;
3233
+
3234
+ /**
3235
+ * Date-based webhook payload version. Determined by the `?version=` query
3236
+ * parameter in your webhook subscription URL. If no version parameter is
3237
+ * specified, defaults based on subscription creation date.
3238
+ */
3239
+ webhook_version: string;
3240
+ }
3241
+
3242
+ export namespace ChatBackgroundUpdatedWebhookEvent {
3243
+ /**
3244
+ * Payload for chat.background_updated webhook events.
3245
+ */
3246
+ export interface Data {
3247
+ /**
3248
+ * Chat information
3249
+ */
3250
+ chat: Data.Chat;
3251
+
3252
+ /**
3253
+ * Who changed it. `is_me` is true when your own number set it.
3254
+ */
3255
+ actor_handle?: Shared.ChatHandle | null;
3256
+
3257
+ /**
3258
+ * A chat transcript background. Fields are populated per `type`.
3259
+ */
3260
+ background?: Data.Background | null;
3261
+ }
3262
+
3263
+ export namespace Data {
3264
+ /**
3265
+ * Chat information
3266
+ */
3267
+ export interface Chat {
3268
+ /**
3269
+ * Chat identifier
3270
+ */
3271
+ id: string;
3272
+
3273
+ /**
3274
+ * Whether this is a group chat
3275
+ */
3276
+ is_group?: boolean | null;
3277
+
3278
+ /**
3279
+ * Your phone number's handle. Always has is_me=true.
3280
+ */
3281
+ owner_handle?: Shared.ChatHandle | null;
3282
+ }
3283
+
3284
+ /**
3285
+ * A chat transcript background. Fields are populated per `type`.
3286
+ */
3287
+ export interface Background {
3288
+ /**
3289
+ * The background family.
3290
+ */
3291
+ type: 'color' | 'dynamic' | 'photo';
3292
+
3293
+ /**
3294
+ * Photo: the image URL.
3295
+ */
3296
+ image_url?: string | null;
3297
+
3298
+ /**
3299
+ * Color: the two gradient stops as hex, top then bottom.
3300
+ */
3301
+ shades?: Array<string> | null;
3302
+
3303
+ /**
3304
+ * Dynamic: the animated style.
3305
+ */
3306
+ style?: 'sky' | 'water' | 'aurora' | 'glitter' | null;
3307
+
3308
+ /**
3309
+ * Color: `custom` (the stored two colors) or a named swatch. Dynamic: the variant
3310
+ * within the `style` (e.g. `sunrise`).
3311
+ */
3312
+ variant?: string | null;
3313
+ }
3314
+ }
3315
+ }
3316
+
2138
3317
  /**
2139
3318
  * Complete webhook payload for phone_number.status_updated events
2140
3319
  */
@@ -2275,6 +3454,15 @@ export type UnwrapWebhookEvent =
2275
3454
  | MessageEditedWebhookEvent
2276
3455
  | ReactionAddedWebhookEvent
2277
3456
  | ReactionRemovedWebhookEvent
3457
+ | PollReceivedWebhookEvent
3458
+ | PollSentWebhookEvent
3459
+ | PollDeliveredWebhookEvent
3460
+ | PollReadWebhookEvent
3461
+ | PollUpdatedWebhookEvent
3462
+ | PollFailedWebhookEvent
3463
+ | PollVoteAddedWebhookEvent
3464
+ | PollVoteRemovedWebhookEvent
3465
+ | PollReactionAddedWebhookEvent
2278
3466
  | ParticipantAddedWebhookEvent
2279
3467
  | ParticipantRemovedWebhookEvent
2280
3468
  | ChatCreatedWebhookEvent
@@ -2284,6 +3472,7 @@ export type UnwrapWebhookEvent =
2284
3472
  | ChatGroupIconUpdateFailedWebhookEvent
2285
3473
  | ChatTypingIndicatorStartedWebhookEvent
2286
3474
  | ChatTypingIndicatorStoppedWebhookEvent
3475
+ | ChatBackgroundUpdatedWebhookEvent
2287
3476
  | PhoneNumberStatusUpdatedWebhookEvent;
2288
3477
 
2289
3478
  export declare namespace Webhooks {
@@ -2302,6 +3491,15 @@ export declare namespace Webhooks {
2302
3491
  type MessageEditedWebhookEvent as MessageEditedWebhookEvent,
2303
3492
  type ReactionAddedWebhookEvent as ReactionAddedWebhookEvent,
2304
3493
  type ReactionRemovedWebhookEvent as ReactionRemovedWebhookEvent,
3494
+ type PollReceivedWebhookEvent as PollReceivedWebhookEvent,
3495
+ type PollSentWebhookEvent as PollSentWebhookEvent,
3496
+ type PollDeliveredWebhookEvent as PollDeliveredWebhookEvent,
3497
+ type PollReadWebhookEvent as PollReadWebhookEvent,
3498
+ type PollUpdatedWebhookEvent as PollUpdatedWebhookEvent,
3499
+ type PollFailedWebhookEvent as PollFailedWebhookEvent,
3500
+ type PollVoteAddedWebhookEvent as PollVoteAddedWebhookEvent,
3501
+ type PollVoteRemovedWebhookEvent as PollVoteRemovedWebhookEvent,
3502
+ type PollReactionAddedWebhookEvent as PollReactionAddedWebhookEvent,
2305
3503
  type ParticipantAddedWebhookEvent as ParticipantAddedWebhookEvent,
2306
3504
  type ParticipantRemovedWebhookEvent as ParticipantRemovedWebhookEvent,
2307
3505
  type ChatCreatedWebhookEvent as ChatCreatedWebhookEvent,
@@ -2311,6 +3509,7 @@ export declare namespace Webhooks {
2311
3509
  type ChatGroupIconUpdateFailedWebhookEvent as ChatGroupIconUpdateFailedWebhookEvent,
2312
3510
  type ChatTypingIndicatorStartedWebhookEvent as ChatTypingIndicatorStartedWebhookEvent,
2313
3511
  type ChatTypingIndicatorStoppedWebhookEvent as ChatTypingIndicatorStoppedWebhookEvent,
3512
+ type ChatBackgroundUpdatedWebhookEvent as ChatBackgroundUpdatedWebhookEvent,
2314
3513
  type PhoneNumberStatusUpdatedWebhookEvent as PhoneNumberStatusUpdatedWebhookEvent,
2315
3514
  type UnwrapWebhookEvent as UnwrapWebhookEvent,
2316
3515
  };