@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
@@ -107,9 +107,10 @@ export declare namespace MessageEventV2 {
107
107
  * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
108
108
  * flagging.
109
109
  *
110
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
111
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
112
- * relevant section of the Chat Health guide.
110
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
111
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
112
+ * relevant section of the Chat Health guide. To gate a send, act on the response
113
+ * rather than the status: a `403` is the authoritative answer.
113
114
  *
114
115
  * See the [Chat Health guide](/guides/chats/chat-health) for what each status
115
116
  * means and how to react.
@@ -131,9 +132,10 @@ export declare namespace MessageEventV2 {
131
132
  * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
132
133
  * flagging.
133
134
  *
134
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
135
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
136
- * relevant section of the Chat Health guide.
135
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
136
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
137
+ * relevant section of the Chat Health guide. To gate a send, act on the response
138
+ * rather than the status: a `403` is the authoritative answer.
137
139
  *
138
140
  * See the [Chat Health guide](/guides/chats/chat-health) for what each status
139
141
  * means and how to react.
@@ -157,6 +159,11 @@ export declare namespace MessageEventV2 {
157
159
  * is not itself an opt-out keyword opts them back in immediately — a reply in any
158
160
  * conversation with you counts, the same way the block does.
159
161
  *
162
+ * `OPTED_OUT` marks only the conversation the keyword arrived in. The block below
163
+ * is wider than the mark, so a conversation still reading `HEALTHY` can be blocked
164
+ * as well — gate on the `403`, not on the status. Group threads are never marked
165
+ * and are never blocked.
166
+ *
160
167
  * Linq enforces this: while a recipient is opted out, every send to them is
161
168
  * rejected with `403` (error code `2024`) before the message is queued, across
162
169
  * every chat and every line on your account. Nothing is delivered, including a
@@ -865,8 +872,8 @@ export declare namespace MessageFailedWebhookEvent {
865
872
  interface Data {
866
873
  /**
867
874
  * Error codes in webhook failure events. The possible set varies by event:
868
- * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
869
- * update failure events (chat.group_name_update_failed,
875
+ * message.failed and poll.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or
876
+ * 4008; the group update failure events (chat.group_name_update_failed,
870
877
  * chat.group_icon_update_failed) carry 3007 or 4001.
871
878
  */
872
879
  code: number;
@@ -996,9 +1003,10 @@ export declare namespace MessageEditedWebhookEvent {
996
1003
  * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
997
1004
  * flagging.
998
1005
  *
999
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
1000
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
1001
- * relevant section of the Chat Health guide.
1006
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
1007
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
1008
+ * relevant section of the Chat Health guide. To gate a send, act on the response
1009
+ * rather than the status: a `403` is the authoritative answer.
1002
1010
  *
1003
1011
  * See the [Chat Health guide](/guides/chats/chat-health) for what each status
1004
1012
  * means and how to react.
@@ -1020,9 +1028,10 @@ export declare namespace MessageEditedWebhookEvent {
1020
1028
  * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
1021
1029
  * flagging.
1022
1030
  *
1023
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
1024
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
1025
- * relevant section of the Chat Health guide.
1031
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
1032
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
1033
+ * relevant section of the Chat Health guide. To gate a send, act on the response
1034
+ * rather than the status: a `403` is the authoritative answer.
1026
1035
  *
1027
1036
  * See the [Chat Health guide](/guides/chats/chat-health) for what each status
1028
1037
  * means and how to react.
@@ -1046,6 +1055,11 @@ export declare namespace MessageEditedWebhookEvent {
1046
1055
  * is not itself an opt-out keyword opts them back in immediately — a reply in any
1047
1056
  * conversation with you counts, the same way the block does.
1048
1057
  *
1058
+ * `OPTED_OUT` marks only the conversation the keyword arrived in. The block below
1059
+ * is wider than the mark, so a conversation still reading `HEALTHY` can be blocked
1060
+ * as well — gate on the `403`, not on the status. Group threads are never marked
1061
+ * and are never blocked.
1062
+ *
1049
1063
  * Linq enforces this: while a recipient is opted out, every send to them is
1050
1064
  * rejected with `403` (error code `2024`) before the message is queued, across
1051
1065
  * every chat and every line on your account. Nothing is delivered, including a
@@ -1161,9 +1175,9 @@ export interface ReactionRemovedWebhookEvent {
1161
1175
  webhook_version: string;
1162
1176
  }
1163
1177
  /**
1164
- * Complete webhook payload for participant.added events
1178
+ * Complete webhook payload for poll.received events
1165
1179
  */
1166
- export interface ParticipantAddedWebhookEvent {
1180
+ export interface PollReceivedWebhookEvent {
1167
1181
  /**
1168
1182
  * API version for the webhook payload format
1169
1183
  */
@@ -1173,9 +1187,10 @@ export interface ParticipantAddedWebhookEvent {
1173
1187
  */
1174
1188
  created_at: string;
1175
1189
  /**
1176
- * Payload for participant.added webhook events
1190
+ * Payload for poll.received — a poll created by someone else and delivered to your
1191
+ * line. Carries the full poll snapshot (options, no voters yet) at receipt time.
1177
1192
  */
1178
- data: ParticipantAddedWebhookEvent.Data;
1193
+ data: PollReceivedWebhookEvent.Data;
1179
1194
  /**
1180
1195
  * Unique identifier for this event (for deduplication)
1181
1196
  */
@@ -1203,34 +1218,69 @@ export interface ParticipantAddedWebhookEvent {
1203
1218
  */
1204
1219
  webhook_version: string;
1205
1220
  }
1206
- export declare namespace ParticipantAddedWebhookEvent {
1221
+ export declare namespace PollReceivedWebhookEvent {
1207
1222
  /**
1208
- * Payload for participant.added webhook events
1223
+ * Payload for poll.received — a poll created by someone else and delivered to your
1224
+ * line. Carries the full poll snapshot (options, no voters yet) at receipt time.
1209
1225
  */
1210
1226
  interface Data {
1211
1227
  /**
1212
- * @deprecated DEPRECATED: Use participant instead. Handle (phone number or email
1213
- * address) of the added participant.
1214
- */
1215
- handle: string;
1216
- /**
1217
- * When the participant was added
1228
+ * Chat info for poll webhook events.
1218
1229
  */
1219
- added_at?: string;
1230
+ chat: Data.Chat;
1231
+ created_at: string;
1232
+ direction: 'inbound' | 'outbound';
1233
+ message_id: string;
1234
+ poll: Data.Poll;
1235
+ received_at: string;
1236
+ service: string;
1237
+ updated_at: string;
1220
1238
  /**
1221
- * Chat identifier (UUID) of the group chat
1239
+ * The line that created the poll (is_me=false for an inbound poll).
1222
1240
  */
1223
- chat_id?: string;
1241
+ sender_handle?: Shared.ChatHandle | null;
1242
+ }
1243
+ namespace Data {
1224
1244
  /**
1225
- * The added participant as a full handle object
1245
+ * Chat info for poll webhook events.
1226
1246
  */
1227
- participant?: Shared.ChatHandle;
1247
+ interface Chat {
1248
+ id: string;
1249
+ is_group?: boolean | null;
1250
+ owner_handle?: Shared.ChatHandle | null;
1251
+ }
1252
+ interface Poll {
1253
+ options: Array<Poll.Option>;
1254
+ /**
1255
+ * Distinct participants across the whole poll.
1256
+ */
1257
+ total_voters: number;
1258
+ }
1259
+ namespace Poll {
1260
+ interface Option {
1261
+ can_be_edited: boolean;
1262
+ /**
1263
+ * The participant who added this option (poll creator for the initial options;
1264
+ * whoever added later ones). Null when unknown.
1265
+ */
1266
+ creator_handle: Shared.ChatHandle;
1267
+ option_id: string;
1268
+ text: string;
1269
+ voters: Array<Option.Voter>;
1270
+ }
1271
+ namespace Option {
1272
+ interface Voter {
1273
+ handle: string;
1274
+ voted_at: string;
1275
+ }
1276
+ }
1277
+ }
1228
1278
  }
1229
1279
  }
1230
1280
  /**
1231
- * Complete webhook payload for participant.removed events
1281
+ * Complete webhook payload for poll.sent events
1232
1282
  */
1233
- export interface ParticipantRemovedWebhookEvent {
1283
+ export interface PollSentWebhookEvent {
1234
1284
  /**
1235
1285
  * API version for the webhook payload format
1236
1286
  */
@@ -1240,9 +1290,11 @@ export interface ParticipantRemovedWebhookEvent {
1240
1290
  */
1241
1291
  created_at: string;
1242
1292
  /**
1243
- * Payload for participant.removed webhook events
1293
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1294
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1295
+ * +delivered_at; read → +read_at.
1244
1296
  */
1245
- data: ParticipantRemovedWebhookEvent.Data;
1297
+ data: PollSentWebhookEvent.Data;
1246
1298
  /**
1247
1299
  * Unique identifier for this event (for deduplication)
1248
1300
  */
@@ -1270,34 +1322,72 @@ export interface ParticipantRemovedWebhookEvent {
1270
1322
  */
1271
1323
  webhook_version: string;
1272
1324
  }
1273
- export declare namespace ParticipantRemovedWebhookEvent {
1325
+ export declare namespace PollSentWebhookEvent {
1274
1326
  /**
1275
- * Payload for participant.removed webhook events
1327
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1328
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1329
+ * +delivered_at; read → +read_at.
1276
1330
  */
1277
1331
  interface Data {
1278
1332
  /**
1279
- * @deprecated DEPRECATED: Use participant instead. Handle (phone number or email
1280
- * address) of the removed participant.
1281
- */
1282
- handle: string;
1283
- /**
1284
- * Chat identifier (UUID) of the group chat
1333
+ * Chat info for poll webhook events.
1285
1334
  */
1286
- chat_id?: string;
1335
+ chat: Data.Chat;
1336
+ created_at: string;
1337
+ direction: 'inbound' | 'outbound';
1338
+ message_id: string;
1339
+ poll: Data.Poll;
1340
+ service: string;
1341
+ updated_at: string;
1342
+ delivered_at?: string | null;
1343
+ read_at?: string | null;
1287
1344
  /**
1288
- * The removed participant as a full handle object
1345
+ * The handle that sent the poll.
1289
1346
  */
1290
- participant?: Shared.ChatHandle;
1347
+ sender_handle?: Shared.ChatHandle | null;
1348
+ sent_at?: string | null;
1349
+ }
1350
+ namespace Data {
1291
1351
  /**
1292
- * When the participant was removed
1352
+ * Chat info for poll webhook events.
1293
1353
  */
1294
- removed_at?: string;
1354
+ interface Chat {
1355
+ id: string;
1356
+ is_group?: boolean | null;
1357
+ owner_handle?: Shared.ChatHandle | null;
1358
+ }
1359
+ interface Poll {
1360
+ options: Array<Poll.Option>;
1361
+ /**
1362
+ * Distinct participants across the whole poll.
1363
+ */
1364
+ total_voters: number;
1365
+ }
1366
+ namespace Poll {
1367
+ interface Option {
1368
+ can_be_edited: boolean;
1369
+ /**
1370
+ * The participant who added this option (poll creator for the initial options;
1371
+ * whoever added later ones). Null when unknown.
1372
+ */
1373
+ creator_handle: Shared.ChatHandle;
1374
+ option_id: string;
1375
+ text: string;
1376
+ voters: Array<Option.Voter>;
1377
+ }
1378
+ namespace Option {
1379
+ interface Voter {
1380
+ handle: string;
1381
+ voted_at: string;
1382
+ }
1383
+ }
1384
+ }
1295
1385
  }
1296
1386
  }
1297
1387
  /**
1298
- * Complete webhook payload for chat.created events
1388
+ * Complete webhook payload for poll.delivered events
1299
1389
  */
1300
- export interface ChatCreatedWebhookEvent {
1390
+ export interface PollDeliveredWebhookEvent {
1301
1391
  /**
1302
1392
  * API version for the webhook payload format
1303
1393
  */
@@ -1307,10 +1397,11 @@ export interface ChatCreatedWebhookEvent {
1307
1397
  */
1308
1398
  created_at: string;
1309
1399
  /**
1310
- * Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
1311
- * response.
1400
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1401
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1402
+ * +delivered_at; read → +read_at.
1312
1403
  */
1313
- data: ChatCreatedWebhookEvent.Data;
1404
+ data: PollDeliveredWebhookEvent.Data;
1314
1405
  /**
1315
1406
  * Unique identifier for this event (for deduplication)
1316
1407
  */
@@ -1338,108 +1429,72 @@ export interface ChatCreatedWebhookEvent {
1338
1429
  */
1339
1430
  webhook_version: string;
1340
1431
  }
1341
- export declare namespace ChatCreatedWebhookEvent {
1432
+ export declare namespace PollDeliveredWebhookEvent {
1342
1433
  /**
1343
- * Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
1344
- * response.
1434
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1435
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1436
+ * +delivered_at; read → +read_at.
1345
1437
  */
1346
1438
  interface Data {
1347
1439
  /**
1348
- * Unique identifier for the chat
1349
- */
1350
- id: string;
1351
- /**
1352
- * When the chat was created
1440
+ * Chat info for poll webhook events.
1353
1441
  */
1442
+ chat: Data.Chat;
1354
1443
  created_at: string;
1355
- /**
1356
- * Display name for the chat. Defaults to a comma-separated list of recipient
1357
- * handles. Can be updated for group chats.
1358
- */
1359
- display_name: string | null;
1360
- /**
1361
- * List of chat participants with full handle details. Always contains at least two
1362
- * handles (your phone number and the other participant).
1363
- */
1364
- handles: Array<Shared.ChatHandle>;
1365
- /**
1366
- * **[BETA]** Current health for a chat. Always present — chats start at `HEALTHY`
1367
- * and may shift based on engagement and delivery signals on the conversation. Many
1368
- * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
1369
- * flagging.
1370
- *
1371
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
1372
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
1373
- * relevant section of the Chat Health guide.
1374
- *
1375
- * See the [Chat Health guide](/guides/chats/chat-health) for what each status
1376
- * means and how to react.
1377
- */
1378
- health_status: Data.HealthStatus;
1379
- /**
1380
- * Whether this is a group chat
1381
- */
1382
- is_group: boolean;
1383
- /**
1384
- * When the chat was last updated
1385
- */
1444
+ direction: 'inbound' | 'outbound';
1445
+ message_id: string;
1446
+ poll: Data.Poll;
1447
+ service: string;
1386
1448
  updated_at: string;
1449
+ delivered_at?: string | null;
1450
+ read_at?: string | null;
1387
1451
  /**
1388
- * Messaging service type
1452
+ * The handle that sent the poll.
1389
1453
  */
1390
- service?: Shared.ServiceType | null;
1454
+ sender_handle?: Shared.ChatHandle | null;
1455
+ sent_at?: string | null;
1391
1456
  }
1392
1457
  namespace Data {
1393
1458
  /**
1394
- * **[BETA]** Current health for a chat. Always present — chats start at `HEALTHY`
1395
- * and may shift based on engagement and delivery signals on the conversation. Many
1396
- * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
1397
- * flagging.
1398
- *
1399
- * Switch on `status` to gate sends or surface line health in your UI — the enum is
1400
- * the long-term contract. Each status carries a `doc_url` that deep-links to the
1401
- * relevant section of the Chat Health guide.
1402
- *
1403
- * See the [Chat Health guide](/guides/chats/chat-health) for what each status
1404
- * means and how to react.
1459
+ * Chat info for poll webhook events.
1405
1460
  */
1406
- interface HealthStatus {
1407
- /**
1408
- * Deep-link to the relevant section of the Chat Health guide for this status.
1409
- */
1410
- doc_url: string;
1411
- /**
1412
- * Current health bucket for the chat. See the
1413
- * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
1414
- * to react. `doc_url` deep-links to the relevant section.
1415
- *
1416
- * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
1417
- * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
1418
- * longer one: `STOP` counts, `please stop` does not. Most keywords must match
1419
- * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
1420
- * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
1421
- * count. It clears as soon as they reply again: any later message from them that
1422
- * is not itself an opt-out keyword opts them back in immediately — a reply in any
1423
- * conversation with you counts, the same way the block does.
1424
- *
1425
- * Linq enforces this: while a recipient is opted out, every send to them is
1426
- * rejected with `403` (error code `2024`) before the message is queued, across
1427
- * every chat and every line on your account. Nothing is delivered, including a
1428
- * final courtesy message — to send one, set `override_optout: true` on that single
1429
- * request.
1430
- */
1431
- status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
1461
+ interface Chat {
1462
+ id: string;
1463
+ is_group?: boolean | null;
1464
+ owner_handle?: Shared.ChatHandle | null;
1465
+ }
1466
+ interface Poll {
1467
+ options: Array<Poll.Option>;
1432
1468
  /**
1433
- * When this status last changed.
1469
+ * Distinct participants across the whole poll.
1434
1470
  */
1435
- updated_at: string;
1471
+ total_voters: number;
1472
+ }
1473
+ namespace Poll {
1474
+ interface Option {
1475
+ can_be_edited: boolean;
1476
+ /**
1477
+ * The participant who added this option (poll creator for the initial options;
1478
+ * whoever added later ones). Null when unknown.
1479
+ */
1480
+ creator_handle: Shared.ChatHandle;
1481
+ option_id: string;
1482
+ text: string;
1483
+ voters: Array<Option.Voter>;
1484
+ }
1485
+ namespace Option {
1486
+ interface Voter {
1487
+ handle: string;
1488
+ voted_at: string;
1489
+ }
1490
+ }
1436
1491
  }
1437
1492
  }
1438
1493
  }
1439
1494
  /**
1440
- * Complete webhook payload for chat.group_name_updated events
1495
+ * Complete webhook payload for poll.read events
1441
1496
  */
1442
- export interface ChatGroupNameUpdatedWebhookEvent {
1497
+ export interface PollReadWebhookEvent {
1443
1498
  /**
1444
1499
  * API version for the webhook payload format
1445
1500
  */
@@ -1449,9 +1504,11 @@ export interface ChatGroupNameUpdatedWebhookEvent {
1449
1504
  */
1450
1505
  created_at: string;
1451
1506
  /**
1452
- * Payload for chat.group_name_updated webhook events
1507
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1508
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1509
+ * +delivered_at; read → +read_at.
1453
1510
  */
1454
- data: ChatGroupNameUpdatedWebhookEvent.Data;
1511
+ data: PollReadWebhookEvent.Data;
1455
1512
  /**
1456
1513
  * Unique identifier for this event (for deduplication)
1457
1514
  */
@@ -1479,37 +1536,72 @@ export interface ChatGroupNameUpdatedWebhookEvent {
1479
1536
  */
1480
1537
  webhook_version: string;
1481
1538
  }
1482
- export declare namespace ChatGroupNameUpdatedWebhookEvent {
1539
+ export declare namespace PollReadWebhookEvent {
1483
1540
  /**
1484
- * Payload for chat.group_name_updated webhook events
1541
+ * Payload for poll.sent, poll.delivered, and poll.read webhook events. Timestamps
1542
+ * indicate state (null = not yet happened): sent → sent_at; delivered →
1543
+ * +delivered_at; read → +read_at.
1485
1544
  */
1486
1545
  interface Data {
1487
1546
  /**
1488
- * Chat identifier (UUID) of the group chat
1489
- */
1490
- chat_id: string;
1491
- /**
1492
- * When the update occurred
1547
+ * Chat info for poll webhook events.
1493
1548
  */
1549
+ chat: Data.Chat;
1550
+ created_at: string;
1551
+ direction: 'inbound' | 'outbound';
1552
+ message_id: string;
1553
+ poll: Data.Poll;
1554
+ service: string;
1494
1555
  updated_at: string;
1556
+ delivered_at?: string | null;
1557
+ read_at?: string | null;
1495
1558
  /**
1496
- * The handle who made the change.
1497
- */
1498
- changed_by_handle?: Shared.ChatHandle | null;
1499
- /**
1500
- * New group name (null if the name was removed)
1559
+ * The handle that sent the poll.
1501
1560
  */
1502
- new_value?: string | null;
1561
+ sender_handle?: Shared.ChatHandle | null;
1562
+ sent_at?: string | null;
1563
+ }
1564
+ namespace Data {
1503
1565
  /**
1504
- * Previous group name (null if no previous name)
1566
+ * Chat info for poll webhook events.
1505
1567
  */
1506
- old_value?: string | null;
1568
+ interface Chat {
1569
+ id: string;
1570
+ is_group?: boolean | null;
1571
+ owner_handle?: Shared.ChatHandle | null;
1572
+ }
1573
+ interface Poll {
1574
+ options: Array<Poll.Option>;
1575
+ /**
1576
+ * Distinct participants across the whole poll.
1577
+ */
1578
+ total_voters: number;
1579
+ }
1580
+ namespace Poll {
1581
+ interface Option {
1582
+ can_be_edited: boolean;
1583
+ /**
1584
+ * The participant who added this option (poll creator for the initial options;
1585
+ * whoever added later ones). Null when unknown.
1586
+ */
1587
+ creator_handle: Shared.ChatHandle;
1588
+ option_id: string;
1589
+ text: string;
1590
+ voters: Array<Option.Voter>;
1591
+ }
1592
+ namespace Option {
1593
+ interface Voter {
1594
+ handle: string;
1595
+ voted_at: string;
1596
+ }
1597
+ }
1598
+ }
1507
1599
  }
1508
1600
  }
1509
1601
  /**
1510
- * Complete webhook payload for chat.group_icon_updated events
1602
+ * Complete webhook payload for poll.updated events
1511
1603
  */
1512
- export interface ChatGroupIconUpdatedWebhookEvent {
1604
+ export interface PollUpdatedWebhookEvent {
1513
1605
  /**
1514
1606
  * API version for the webhook payload format
1515
1607
  */
@@ -1519,9 +1611,9 @@ export interface ChatGroupIconUpdatedWebhookEvent {
1519
1611
  */
1520
1612
  created_at: string;
1521
1613
  /**
1522
- * Payload for chat.group_icon_updated webhook events
1614
+ * Payload for poll.updated (option(s) added — add-only).
1523
1615
  */
1524
- data: ChatGroupIconUpdatedWebhookEvent.Data;
1616
+ data: PollUpdatedWebhookEvent.Data;
1525
1617
  /**
1526
1618
  * Unique identifier for this event (for deduplication)
1527
1619
  */
@@ -1549,37 +1641,56 @@ export interface ChatGroupIconUpdatedWebhookEvent {
1549
1641
  */
1550
1642
  webhook_version: string;
1551
1643
  }
1552
- export declare namespace ChatGroupIconUpdatedWebhookEvent {
1644
+ export declare namespace PollUpdatedWebhookEvent {
1553
1645
  /**
1554
- * Payload for chat.group_icon_updated webhook events
1646
+ * Payload for poll.updated (option(s) added — add-only).
1555
1647
  */
1556
1648
  interface Data {
1649
+ added_options: Array<Data.AddedOption>;
1557
1650
  /**
1558
- * Chat identifier (UUID) of the group chat
1559
- */
1560
- chat_id: string;
1561
- /**
1562
- * When the update occurred
1563
- */
1564
- updated_at: string;
1565
- /**
1566
- * The handle who made the change.
1651
+ * Chat info for poll webhook events.
1567
1652
  */
1568
- changed_by_handle?: Shared.ChatHandle | null;
1653
+ chat: Data.Chat;
1654
+ direction: 'inbound' | 'outbound';
1655
+ message_id: string;
1569
1656
  /**
1570
- * New icon URL (null if the icon was removed)
1657
+ * The line that added the option(s) — always present.
1571
1658
  */
1572
- new_value?: string | null;
1659
+ sender_handle: Shared.ChatHandle;
1660
+ service: string;
1661
+ }
1662
+ namespace Data {
1663
+ interface AddedOption {
1664
+ can_be_edited: boolean;
1665
+ /**
1666
+ * The participant who added this option (poll creator for the initial options;
1667
+ * whoever added later ones). Null when unknown.
1668
+ */
1669
+ creator_handle: Shared.ChatHandle;
1670
+ option_id: string;
1671
+ text: string;
1672
+ voters: Array<AddedOption.Voter>;
1673
+ }
1674
+ namespace AddedOption {
1675
+ interface Voter {
1676
+ handle: string;
1677
+ voted_at: string;
1678
+ }
1679
+ }
1573
1680
  /**
1574
- * Previous icon URL (null if no previous icon)
1681
+ * Chat info for poll webhook events.
1575
1682
  */
1576
- old_value?: string | null;
1683
+ interface Chat {
1684
+ id: string;
1685
+ is_group?: boolean | null;
1686
+ owner_handle?: Shared.ChatHandle | null;
1687
+ }
1577
1688
  }
1578
1689
  }
1579
1690
  /**
1580
- * Complete webhook payload for chat.group_name_update_failed events
1691
+ * Complete webhook payload for poll.failed events
1581
1692
  */
1582
- export interface ChatGroupNameUpdateFailedWebhookEvent {
1693
+ export interface PollFailedWebhookEvent {
1583
1694
  /**
1584
1695
  * API version for the webhook payload format
1585
1696
  */
@@ -1589,11 +1700,10 @@ export interface ChatGroupNameUpdateFailedWebhookEvent {
1589
1700
  */
1590
1701
  created_at: string;
1591
1702
  /**
1592
- * Error details for chat.group_name_update_failed webhook events. See
1593
- * [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
1594
- * code reference.
1703
+ * Payload for poll.failed — an outbound poll (or poll action) that failed to send.
1704
+ * Carries the poll snapshot at failure time plus the error and when it failed.
1595
1705
  */
1596
- data: ChatGroupNameUpdateFailedWebhookEvent.Data;
1706
+ data: PollFailedWebhookEvent.Data;
1597
1707
  /**
1598
1708
  * Unique identifier for this event (for deduplication)
1599
1709
  */
@@ -1621,40 +1731,765 @@ export interface ChatGroupNameUpdateFailedWebhookEvent {
1621
1731
  */
1622
1732
  webhook_version: string;
1623
1733
  }
1624
- export declare namespace ChatGroupNameUpdateFailedWebhookEvent {
1734
+ export declare namespace PollFailedWebhookEvent {
1625
1735
  /**
1626
- * Error details for chat.group_name_update_failed webhook events. See
1627
- * [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
1628
- * code reference.
1736
+ * Payload for poll.failed — an outbound poll (or poll action) that failed to send.
1737
+ * Carries the poll snapshot at failure time plus the error and when it failed.
1629
1738
  */
1630
1739
  interface Data {
1631
1740
  /**
1632
- * Chat identifier (UUID) of the group chat
1741
+ * Chat info for poll webhook events.
1633
1742
  */
1634
- chat_id: string;
1743
+ chat: Data.Chat;
1744
+ direction: 'inbound' | 'outbound';
1745
+ error: Data.Error;
1746
+ failed_at: string;
1747
+ message_id: string;
1748
+ poll: Data.Poll;
1749
+ service: string;
1635
1750
  /**
1636
- * Error codes in webhook failure events. The possible set varies by event:
1637
- * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
1638
- * update failure events (chat.group_name_update_failed,
1639
- * chat.group_icon_update_failed) carry 3007 or 4001.
1751
+ * Null on failure (the send never landed).
1640
1752
  */
1641
- error_code: number;
1753
+ sender_handle?: Shared.ChatHandle | null;
1754
+ }
1755
+ namespace Data {
1642
1756
  /**
1643
- * When the failure was detected
1757
+ * Chat info for poll webhook events.
1644
1758
  */
1645
- failed_at: string;
1646
- }
1647
- }
1648
- /**
1649
- * Complete webhook payload for chat.group_icon_update_failed events
1650
- */
1651
- export interface ChatGroupIconUpdateFailedWebhookEvent {
1652
- /**
1653
- * API version for the webhook payload format
1654
- */
1655
- api_version: string;
1656
- /**
1657
- * When the event was created
1759
+ interface Chat {
1760
+ id: string;
1761
+ is_group?: boolean | null;
1762
+ owner_handle?: Shared.ChatHandle | null;
1763
+ }
1764
+ interface Error {
1765
+ /**
1766
+ * Error codes in webhook failure events. The possible set varies by event:
1767
+ * message.failed and poll.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or
1768
+ * 4008; the group update failure events (chat.group_name_update_failed,
1769
+ * chat.group_icon_update_failed) carry 3007 or 4001.
1770
+ */
1771
+ code: number;
1772
+ message: string;
1773
+ }
1774
+ interface Poll {
1775
+ options: Array<Poll.Option>;
1776
+ /**
1777
+ * Distinct participants across the whole poll.
1778
+ */
1779
+ total_voters: number;
1780
+ }
1781
+ namespace Poll {
1782
+ interface Option {
1783
+ can_be_edited: boolean;
1784
+ /**
1785
+ * The participant who added this option (poll creator for the initial options;
1786
+ * whoever added later ones). Null when unknown.
1787
+ */
1788
+ creator_handle: Shared.ChatHandle;
1789
+ option_id: string;
1790
+ text: string;
1791
+ voters: Array<Option.Voter>;
1792
+ }
1793
+ namespace Option {
1794
+ interface Voter {
1795
+ handle: string;
1796
+ voted_at: string;
1797
+ }
1798
+ }
1799
+ }
1800
+ }
1801
+ }
1802
+ /**
1803
+ * Complete webhook payload for poll.vote.added events
1804
+ */
1805
+ export interface PollVoteAddedWebhookEvent {
1806
+ /**
1807
+ * API version for the webhook payload format
1808
+ */
1809
+ api_version: string;
1810
+ /**
1811
+ * When the event was created
1812
+ */
1813
+ created_at: string;
1814
+ /**
1815
+ * Payload for poll.vote.added and poll.vote.removed (one option toggled).
1816
+ */
1817
+ data: PollVoteAddedWebhookEvent.Data;
1818
+ /**
1819
+ * Unique identifier for this event (for deduplication)
1820
+ */
1821
+ event_id: string;
1822
+ /**
1823
+ * Valid webhook event types that can be subscribed to.
1824
+ *
1825
+ * **Note:** `message.edited` is only delivered to subscriptions using
1826
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
1827
+ * subscription will not produce any deliveries.
1828
+ */
1829
+ event_type: WebhookEventsAPI.WebhookEventType;
1830
+ /**
1831
+ * Partner identifier. Present on all webhooks for cross-referencing.
1832
+ */
1833
+ partner_id: string;
1834
+ /**
1835
+ * Trace ID for debugging and correlation across systems.
1836
+ */
1837
+ trace_id: string;
1838
+ /**
1839
+ * Date-based webhook payload version. Determined by the `?version=` query
1840
+ * parameter in your webhook subscription URL. If no version parameter is
1841
+ * specified, defaults based on subscription creation date.
1842
+ */
1843
+ webhook_version: string;
1844
+ }
1845
+ export declare namespace PollVoteAddedWebhookEvent {
1846
+ /**
1847
+ * Payload for poll.vote.added and poll.vote.removed (one option toggled).
1848
+ */
1849
+ interface Data {
1850
+ /**
1851
+ * Chat info for poll webhook events.
1852
+ */
1853
+ chat: Data.Chat;
1854
+ direction: 'inbound' | 'outbound';
1855
+ message_id: string;
1856
+ option_id: string;
1857
+ /**
1858
+ * The voter — always present.
1859
+ */
1860
+ sender_handle: Shared.ChatHandle;
1861
+ service: string;
1862
+ }
1863
+ namespace Data {
1864
+ /**
1865
+ * Chat info for poll webhook events.
1866
+ */
1867
+ interface Chat {
1868
+ id: string;
1869
+ is_group?: boolean | null;
1870
+ owner_handle?: Shared.ChatHandle | null;
1871
+ }
1872
+ }
1873
+ }
1874
+ /**
1875
+ * Complete webhook payload for poll.vote.removed events
1876
+ */
1877
+ export interface PollVoteRemovedWebhookEvent {
1878
+ /**
1879
+ * API version for the webhook payload format
1880
+ */
1881
+ api_version: string;
1882
+ /**
1883
+ * When the event was created
1884
+ */
1885
+ created_at: string;
1886
+ /**
1887
+ * Payload for poll.vote.added and poll.vote.removed (one option toggled).
1888
+ */
1889
+ data: PollVoteRemovedWebhookEvent.Data;
1890
+ /**
1891
+ * Unique identifier for this event (for deduplication)
1892
+ */
1893
+ event_id: string;
1894
+ /**
1895
+ * Valid webhook event types that can be subscribed to.
1896
+ *
1897
+ * **Note:** `message.edited` is only delivered to subscriptions using
1898
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
1899
+ * subscription will not produce any deliveries.
1900
+ */
1901
+ event_type: WebhookEventsAPI.WebhookEventType;
1902
+ /**
1903
+ * Partner identifier. Present on all webhooks for cross-referencing.
1904
+ */
1905
+ partner_id: string;
1906
+ /**
1907
+ * Trace ID for debugging and correlation across systems.
1908
+ */
1909
+ trace_id: string;
1910
+ /**
1911
+ * Date-based webhook payload version. Determined by the `?version=` query
1912
+ * parameter in your webhook subscription URL. If no version parameter is
1913
+ * specified, defaults based on subscription creation date.
1914
+ */
1915
+ webhook_version: string;
1916
+ }
1917
+ export declare namespace PollVoteRemovedWebhookEvent {
1918
+ /**
1919
+ * Payload for poll.vote.added and poll.vote.removed (one option toggled).
1920
+ */
1921
+ interface Data {
1922
+ /**
1923
+ * Chat info for poll webhook events.
1924
+ */
1925
+ chat: Data.Chat;
1926
+ direction: 'inbound' | 'outbound';
1927
+ message_id: string;
1928
+ option_id: string;
1929
+ /**
1930
+ * The voter — always present.
1931
+ */
1932
+ sender_handle: Shared.ChatHandle;
1933
+ service: string;
1934
+ }
1935
+ namespace Data {
1936
+ /**
1937
+ * Chat info for poll webhook events.
1938
+ */
1939
+ interface Chat {
1940
+ id: string;
1941
+ is_group?: boolean | null;
1942
+ owner_handle?: Shared.ChatHandle | null;
1943
+ }
1944
+ }
1945
+ }
1946
+ /**
1947
+ * Complete webhook payload for poll.reaction.added events
1948
+ */
1949
+ export interface PollReactionAddedWebhookEvent {
1950
+ /**
1951
+ * API version for the webhook payload format
1952
+ */
1953
+ api_version: string;
1954
+ /**
1955
+ * When the event was created
1956
+ */
1957
+ created_at: string;
1958
+ /**
1959
+ * Payload for poll.reaction.added — a reaction on a poll message. Same shape as
1960
+ * reaction.added; `message_id` is the poll-definition message's ID. Poll reactions
1961
+ * are stickers, which iMessage cannot remove, so there is no removal counterpart.
1962
+ */
1963
+ data: ReactionEventBase;
1964
+ /**
1965
+ * Unique identifier for this event (for deduplication)
1966
+ */
1967
+ event_id: string;
1968
+ /**
1969
+ * Valid webhook event types that can be subscribed to.
1970
+ *
1971
+ * **Note:** `message.edited` is only delivered to subscriptions using
1972
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
1973
+ * subscription will not produce any deliveries.
1974
+ */
1975
+ event_type: WebhookEventsAPI.WebhookEventType;
1976
+ /**
1977
+ * Partner identifier. Present on all webhooks for cross-referencing.
1978
+ */
1979
+ partner_id: string;
1980
+ /**
1981
+ * Trace ID for debugging and correlation across systems.
1982
+ */
1983
+ trace_id: string;
1984
+ /**
1985
+ * Date-based webhook payload version. Determined by the `?version=` query
1986
+ * parameter in your webhook subscription URL. If no version parameter is
1987
+ * specified, defaults based on subscription creation date.
1988
+ */
1989
+ webhook_version: string;
1990
+ }
1991
+ /**
1992
+ * Complete webhook payload for participant.added events
1993
+ */
1994
+ export interface ParticipantAddedWebhookEvent {
1995
+ /**
1996
+ * API version for the webhook payload format
1997
+ */
1998
+ api_version: string;
1999
+ /**
2000
+ * When the event was created
2001
+ */
2002
+ created_at: string;
2003
+ /**
2004
+ * Payload for participant.added webhook events
2005
+ */
2006
+ data: ParticipantAddedWebhookEvent.Data;
2007
+ /**
2008
+ * Unique identifier for this event (for deduplication)
2009
+ */
2010
+ event_id: string;
2011
+ /**
2012
+ * Valid webhook event types that can be subscribed to.
2013
+ *
2014
+ * **Note:** `message.edited` is only delivered to subscriptions using
2015
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2016
+ * subscription will not produce any deliveries.
2017
+ */
2018
+ event_type: WebhookEventsAPI.WebhookEventType;
2019
+ /**
2020
+ * Partner identifier. Present on all webhooks for cross-referencing.
2021
+ */
2022
+ partner_id: string;
2023
+ /**
2024
+ * Trace ID for debugging and correlation across systems.
2025
+ */
2026
+ trace_id: string;
2027
+ /**
2028
+ * Date-based webhook payload version. Determined by the `?version=` query
2029
+ * parameter in your webhook subscription URL. If no version parameter is
2030
+ * specified, defaults based on subscription creation date.
2031
+ */
2032
+ webhook_version: string;
2033
+ }
2034
+ export declare namespace ParticipantAddedWebhookEvent {
2035
+ /**
2036
+ * Payload for participant.added webhook events
2037
+ */
2038
+ interface Data {
2039
+ /**
2040
+ * @deprecated DEPRECATED: Use participant instead. Handle (phone number or email
2041
+ * address) of the added participant.
2042
+ */
2043
+ handle: string;
2044
+ /**
2045
+ * When the participant was added
2046
+ */
2047
+ added_at?: string;
2048
+ /**
2049
+ * Chat identifier (UUID) of the group chat
2050
+ */
2051
+ chat_id?: string;
2052
+ /**
2053
+ * The added participant as a full handle object
2054
+ */
2055
+ participant?: Shared.ChatHandle;
2056
+ }
2057
+ }
2058
+ /**
2059
+ * Complete webhook payload for participant.removed events
2060
+ */
2061
+ export interface ParticipantRemovedWebhookEvent {
2062
+ /**
2063
+ * API version for the webhook payload format
2064
+ */
2065
+ api_version: string;
2066
+ /**
2067
+ * When the event was created
2068
+ */
2069
+ created_at: string;
2070
+ /**
2071
+ * Payload for participant.removed webhook events
2072
+ */
2073
+ data: ParticipantRemovedWebhookEvent.Data;
2074
+ /**
2075
+ * Unique identifier for this event (for deduplication)
2076
+ */
2077
+ event_id: string;
2078
+ /**
2079
+ * Valid webhook event types that can be subscribed to.
2080
+ *
2081
+ * **Note:** `message.edited` is only delivered to subscriptions using
2082
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2083
+ * subscription will not produce any deliveries.
2084
+ */
2085
+ event_type: WebhookEventsAPI.WebhookEventType;
2086
+ /**
2087
+ * Partner identifier. Present on all webhooks for cross-referencing.
2088
+ */
2089
+ partner_id: string;
2090
+ /**
2091
+ * Trace ID for debugging and correlation across systems.
2092
+ */
2093
+ trace_id: string;
2094
+ /**
2095
+ * Date-based webhook payload version. Determined by the `?version=` query
2096
+ * parameter in your webhook subscription URL. If no version parameter is
2097
+ * specified, defaults based on subscription creation date.
2098
+ */
2099
+ webhook_version: string;
2100
+ }
2101
+ export declare namespace ParticipantRemovedWebhookEvent {
2102
+ /**
2103
+ * Payload for participant.removed webhook events
2104
+ */
2105
+ interface Data {
2106
+ /**
2107
+ * @deprecated DEPRECATED: Use participant instead. Handle (phone number or email
2108
+ * address) of the removed participant.
2109
+ */
2110
+ handle: string;
2111
+ /**
2112
+ * Chat identifier (UUID) of the group chat
2113
+ */
2114
+ chat_id?: string;
2115
+ /**
2116
+ * The removed participant as a full handle object
2117
+ */
2118
+ participant?: Shared.ChatHandle;
2119
+ /**
2120
+ * When the participant was removed
2121
+ */
2122
+ removed_at?: string;
2123
+ }
2124
+ }
2125
+ /**
2126
+ * Complete webhook payload for chat.created events
2127
+ */
2128
+ export interface ChatCreatedWebhookEvent {
2129
+ /**
2130
+ * API version for the webhook payload format
2131
+ */
2132
+ api_version: string;
2133
+ /**
2134
+ * When the event was created
2135
+ */
2136
+ created_at: string;
2137
+ /**
2138
+ * Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
2139
+ * response.
2140
+ */
2141
+ data: ChatCreatedWebhookEvent.Data;
2142
+ /**
2143
+ * Unique identifier for this event (for deduplication)
2144
+ */
2145
+ event_id: string;
2146
+ /**
2147
+ * Valid webhook event types that can be subscribed to.
2148
+ *
2149
+ * **Note:** `message.edited` is only delivered to subscriptions using
2150
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2151
+ * subscription will not produce any deliveries.
2152
+ */
2153
+ event_type: WebhookEventsAPI.WebhookEventType;
2154
+ /**
2155
+ * Partner identifier. Present on all webhooks for cross-referencing.
2156
+ */
2157
+ partner_id: string;
2158
+ /**
2159
+ * Trace ID for debugging and correlation across systems.
2160
+ */
2161
+ trace_id: string;
2162
+ /**
2163
+ * Date-based webhook payload version. Determined by the `?version=` query
2164
+ * parameter in your webhook subscription URL. If no version parameter is
2165
+ * specified, defaults based on subscription creation date.
2166
+ */
2167
+ webhook_version: string;
2168
+ }
2169
+ export declare namespace ChatCreatedWebhookEvent {
2170
+ /**
2171
+ * Payload for chat.created webhook events. Matches GET /v3/chats/{chatId}
2172
+ * response.
2173
+ */
2174
+ interface Data {
2175
+ /**
2176
+ * Unique identifier for the chat
2177
+ */
2178
+ id: string;
2179
+ /**
2180
+ * When the chat was created
2181
+ */
2182
+ created_at: string;
2183
+ /**
2184
+ * Display name for the chat. Defaults to a comma-separated list of recipient
2185
+ * handles. Can be updated for group chats.
2186
+ */
2187
+ display_name: string | null;
2188
+ /**
2189
+ * List of chat participants with full handle details. Always contains at least two
2190
+ * handles (your phone number and the other participant).
2191
+ */
2192
+ handles: Array<Shared.ChatHandle>;
2193
+ /**
2194
+ * **[BETA]** Current health for a chat. Always present — chats start at `HEALTHY`
2195
+ * and may shift based on engagement and delivery signals on the conversation. Many
2196
+ * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
2197
+ * flagging.
2198
+ *
2199
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
2200
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
2201
+ * relevant section of the Chat Health guide. To gate a send, act on the response
2202
+ * rather than the status: a `403` is the authoritative answer.
2203
+ *
2204
+ * See the [Chat Health guide](/guides/chats/chat-health) for what each status
2205
+ * means and how to react.
2206
+ */
2207
+ health_status: Data.HealthStatus;
2208
+ /**
2209
+ * Whether this is a group chat
2210
+ */
2211
+ is_group: boolean;
2212
+ /**
2213
+ * When the chat was last updated
2214
+ */
2215
+ updated_at: string;
2216
+ /**
2217
+ * Messaging service type
2218
+ */
2219
+ service?: Shared.ServiceType | null;
2220
+ }
2221
+ namespace Data {
2222
+ /**
2223
+ * **[BETA]** Current health for a chat. Always present — chats start at `HEALTHY`
2224
+ * and may shift based on engagement and delivery signals on the conversation. Many
2225
+ * `AT_RISK` or `CRITICAL` chats on a single line increase the risk of line
2226
+ * flagging.
2227
+ *
2228
+ * Switch on `status` to surface chat and line health in your UI — the enum is the
2229
+ * long-term contract. Each status carries a `doc_url` that deep-links to the
2230
+ * relevant section of the Chat Health guide. To gate a send, act on the response
2231
+ * rather than the status: a `403` is the authoritative answer.
2232
+ *
2233
+ * See the [Chat Health guide](/guides/chats/chat-health) for what each status
2234
+ * means and how to react.
2235
+ */
2236
+ interface HealthStatus {
2237
+ /**
2238
+ * Deep-link to the relevant section of the Chat Health guide for this status.
2239
+ */
2240
+ doc_url: string;
2241
+ /**
2242
+ * Current health bucket for the chat. See the
2243
+ * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
2244
+ * to react. `doc_url` deep-links to the relevant section.
2245
+ *
2246
+ * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
2247
+ * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
2248
+ * longer one: `STOP` counts, `please stop` does not. Most keywords must match
2249
+ * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
2250
+ * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
2251
+ * count. It clears as soon as they reply again: any later message from them that
2252
+ * is not itself an opt-out keyword opts them back in immediately — a reply in any
2253
+ * conversation with you counts, the same way the block does.
2254
+ *
2255
+ * `OPTED_OUT` marks only the conversation the keyword arrived in. The block below
2256
+ * is wider than the mark, so a conversation still reading `HEALTHY` can be blocked
2257
+ * as well — gate on the `403`, not on the status. Group threads are never marked
2258
+ * and are never blocked.
2259
+ *
2260
+ * Linq enforces this: while a recipient is opted out, every send to them is
2261
+ * rejected with `403` (error code `2024`) before the message is queued, across
2262
+ * every chat and every line on your account. Nothing is delivered, including a
2263
+ * final courtesy message — to send one, set `override_optout: true` on that single
2264
+ * request.
2265
+ */
2266
+ status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
2267
+ /**
2268
+ * When this status last changed.
2269
+ */
2270
+ updated_at: string;
2271
+ }
2272
+ }
2273
+ }
2274
+ /**
2275
+ * Complete webhook payload for chat.group_name_updated events
2276
+ */
2277
+ export interface ChatGroupNameUpdatedWebhookEvent {
2278
+ /**
2279
+ * API version for the webhook payload format
2280
+ */
2281
+ api_version: string;
2282
+ /**
2283
+ * When the event was created
2284
+ */
2285
+ created_at: string;
2286
+ /**
2287
+ * Payload for chat.group_name_updated webhook events
2288
+ */
2289
+ data: ChatGroupNameUpdatedWebhookEvent.Data;
2290
+ /**
2291
+ * Unique identifier for this event (for deduplication)
2292
+ */
2293
+ event_id: string;
2294
+ /**
2295
+ * Valid webhook event types that can be subscribed to.
2296
+ *
2297
+ * **Note:** `message.edited` is only delivered to subscriptions using
2298
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2299
+ * subscription will not produce any deliveries.
2300
+ */
2301
+ event_type: WebhookEventsAPI.WebhookEventType;
2302
+ /**
2303
+ * Partner identifier. Present on all webhooks for cross-referencing.
2304
+ */
2305
+ partner_id: string;
2306
+ /**
2307
+ * Trace ID for debugging and correlation across systems.
2308
+ */
2309
+ trace_id: string;
2310
+ /**
2311
+ * Date-based webhook payload version. Determined by the `?version=` query
2312
+ * parameter in your webhook subscription URL. If no version parameter is
2313
+ * specified, defaults based on subscription creation date.
2314
+ */
2315
+ webhook_version: string;
2316
+ }
2317
+ export declare namespace ChatGroupNameUpdatedWebhookEvent {
2318
+ /**
2319
+ * Payload for chat.group_name_updated webhook events
2320
+ */
2321
+ interface Data {
2322
+ /**
2323
+ * Chat identifier (UUID) of the group chat
2324
+ */
2325
+ chat_id: string;
2326
+ /**
2327
+ * When the update occurred
2328
+ */
2329
+ updated_at: string;
2330
+ /**
2331
+ * The handle who made the change.
2332
+ */
2333
+ changed_by_handle?: Shared.ChatHandle | null;
2334
+ /**
2335
+ * New group name (null if the name was removed)
2336
+ */
2337
+ new_value?: string | null;
2338
+ /**
2339
+ * Previous group name (null if no previous name)
2340
+ */
2341
+ old_value?: string | null;
2342
+ }
2343
+ }
2344
+ /**
2345
+ * Complete webhook payload for chat.group_icon_updated events
2346
+ */
2347
+ export interface ChatGroupIconUpdatedWebhookEvent {
2348
+ /**
2349
+ * API version for the webhook payload format
2350
+ */
2351
+ api_version: string;
2352
+ /**
2353
+ * When the event was created
2354
+ */
2355
+ created_at: string;
2356
+ /**
2357
+ * Payload for chat.group_icon_updated webhook events
2358
+ */
2359
+ data: ChatGroupIconUpdatedWebhookEvent.Data;
2360
+ /**
2361
+ * Unique identifier for this event (for deduplication)
2362
+ */
2363
+ event_id: string;
2364
+ /**
2365
+ * Valid webhook event types that can be subscribed to.
2366
+ *
2367
+ * **Note:** `message.edited` is only delivered to subscriptions using
2368
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2369
+ * subscription will not produce any deliveries.
2370
+ */
2371
+ event_type: WebhookEventsAPI.WebhookEventType;
2372
+ /**
2373
+ * Partner identifier. Present on all webhooks for cross-referencing.
2374
+ */
2375
+ partner_id: string;
2376
+ /**
2377
+ * Trace ID for debugging and correlation across systems.
2378
+ */
2379
+ trace_id: string;
2380
+ /**
2381
+ * Date-based webhook payload version. Determined by the `?version=` query
2382
+ * parameter in your webhook subscription URL. If no version parameter is
2383
+ * specified, defaults based on subscription creation date.
2384
+ */
2385
+ webhook_version: string;
2386
+ }
2387
+ export declare namespace ChatGroupIconUpdatedWebhookEvent {
2388
+ /**
2389
+ * Payload for chat.group_icon_updated webhook events
2390
+ */
2391
+ interface Data {
2392
+ /**
2393
+ * Chat identifier (UUID) of the group chat
2394
+ */
2395
+ chat_id: string;
2396
+ /**
2397
+ * When the update occurred
2398
+ */
2399
+ updated_at: string;
2400
+ /**
2401
+ * The handle who made the change.
2402
+ */
2403
+ changed_by_handle?: Shared.ChatHandle | null;
2404
+ /**
2405
+ * New icon URL (null if the icon was removed)
2406
+ */
2407
+ new_value?: string | null;
2408
+ /**
2409
+ * Previous icon URL (null if no previous icon)
2410
+ */
2411
+ old_value?: string | null;
2412
+ }
2413
+ }
2414
+ /**
2415
+ * Complete webhook payload for chat.group_name_update_failed events
2416
+ */
2417
+ export interface ChatGroupNameUpdateFailedWebhookEvent {
2418
+ /**
2419
+ * API version for the webhook payload format
2420
+ */
2421
+ api_version: string;
2422
+ /**
2423
+ * When the event was created
2424
+ */
2425
+ created_at: string;
2426
+ /**
2427
+ * Error details for chat.group_name_update_failed webhook events. See
2428
+ * [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
2429
+ * code reference.
2430
+ */
2431
+ data: ChatGroupNameUpdateFailedWebhookEvent.Data;
2432
+ /**
2433
+ * Unique identifier for this event (for deduplication)
2434
+ */
2435
+ event_id: string;
2436
+ /**
2437
+ * Valid webhook event types that can be subscribed to.
2438
+ *
2439
+ * **Note:** `message.edited` is only delivered to subscriptions using
2440
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2441
+ * subscription will not produce any deliveries.
2442
+ */
2443
+ event_type: WebhookEventsAPI.WebhookEventType;
2444
+ /**
2445
+ * Partner identifier. Present on all webhooks for cross-referencing.
2446
+ */
2447
+ partner_id: string;
2448
+ /**
2449
+ * Trace ID for debugging and correlation across systems.
2450
+ */
2451
+ trace_id: string;
2452
+ /**
2453
+ * Date-based webhook payload version. Determined by the `?version=` query
2454
+ * parameter in your webhook subscription URL. If no version parameter is
2455
+ * specified, defaults based on subscription creation date.
2456
+ */
2457
+ webhook_version: string;
2458
+ }
2459
+ export declare namespace ChatGroupNameUpdateFailedWebhookEvent {
2460
+ /**
2461
+ * Error details for chat.group_name_update_failed webhook events. See
2462
+ * [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
2463
+ * code reference.
2464
+ */
2465
+ interface Data {
2466
+ /**
2467
+ * Chat identifier (UUID) of the group chat
2468
+ */
2469
+ chat_id: string;
2470
+ /**
2471
+ * Error codes in webhook failure events. The possible set varies by event:
2472
+ * message.failed and poll.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or
2473
+ * 4008; the group update failure events (chat.group_name_update_failed,
2474
+ * chat.group_icon_update_failed) carry 3007 or 4001.
2475
+ */
2476
+ error_code: number;
2477
+ /**
2478
+ * When the failure was detected
2479
+ */
2480
+ failed_at: string;
2481
+ }
2482
+ }
2483
+ /**
2484
+ * Complete webhook payload for chat.group_icon_update_failed events
2485
+ */
2486
+ export interface ChatGroupIconUpdateFailedWebhookEvent {
2487
+ /**
2488
+ * API version for the webhook payload format
2489
+ */
2490
+ api_version: string;
2491
+ /**
2492
+ * When the event was created
1658
2493
  */
1659
2494
  created_at: string;
1660
2495
  /**
@@ -1703,8 +2538,8 @@ export declare namespace ChatGroupIconUpdateFailedWebhookEvent {
1703
2538
  chat_id: string;
1704
2539
  /**
1705
2540
  * Error codes in webhook failure events. The possible set varies by event:
1706
- * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
1707
- * update failure events (chat.group_name_update_failed,
2541
+ * message.failed and poll.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or
2542
+ * 4008; the group update failure events (chat.group_name_update_failed,
1708
2543
  * chat.group_icon_update_failed) carry 3007 or 4001.
1709
2544
  */
1710
2545
  error_code: number;
@@ -1822,6 +2657,113 @@ export declare namespace ChatTypingIndicatorStoppedWebhookEvent {
1822
2657
  chat_id: string;
1823
2658
  }
1824
2659
  }
2660
+ /**
2661
+ * Complete webhook payload for chat.background_updated events
2662
+ */
2663
+ export interface ChatBackgroundUpdatedWebhookEvent {
2664
+ /**
2665
+ * API version for the webhook payload format
2666
+ */
2667
+ api_version: string;
2668
+ /**
2669
+ * When the event was created
2670
+ */
2671
+ created_at: string;
2672
+ /**
2673
+ * Payload for chat.background_updated webhook events.
2674
+ */
2675
+ data: ChatBackgroundUpdatedWebhookEvent.Data;
2676
+ /**
2677
+ * Unique identifier for this event (for deduplication)
2678
+ */
2679
+ event_id: string;
2680
+ /**
2681
+ * Valid webhook event types that can be subscribed to.
2682
+ *
2683
+ * **Note:** `message.edited` is only delivered to subscriptions using
2684
+ * `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
2685
+ * subscription will not produce any deliveries.
2686
+ */
2687
+ event_type: WebhookEventsAPI.WebhookEventType;
2688
+ /**
2689
+ * Partner identifier. Present on all webhooks for cross-referencing.
2690
+ */
2691
+ partner_id: string;
2692
+ /**
2693
+ * Trace ID for debugging and correlation across systems.
2694
+ */
2695
+ trace_id: string;
2696
+ /**
2697
+ * Date-based webhook payload version. Determined by the `?version=` query
2698
+ * parameter in your webhook subscription URL. If no version parameter is
2699
+ * specified, defaults based on subscription creation date.
2700
+ */
2701
+ webhook_version: string;
2702
+ }
2703
+ export declare namespace ChatBackgroundUpdatedWebhookEvent {
2704
+ /**
2705
+ * Payload for chat.background_updated webhook events.
2706
+ */
2707
+ interface Data {
2708
+ /**
2709
+ * Chat information
2710
+ */
2711
+ chat: Data.Chat;
2712
+ /**
2713
+ * Who changed it. `is_me` is true when your own number set it.
2714
+ */
2715
+ actor_handle?: Shared.ChatHandle | null;
2716
+ /**
2717
+ * A chat transcript background. Fields are populated per `type`.
2718
+ */
2719
+ background?: Data.Background | null;
2720
+ }
2721
+ namespace Data {
2722
+ /**
2723
+ * Chat information
2724
+ */
2725
+ interface Chat {
2726
+ /**
2727
+ * Chat identifier
2728
+ */
2729
+ id: string;
2730
+ /**
2731
+ * Whether this is a group chat
2732
+ */
2733
+ is_group?: boolean | null;
2734
+ /**
2735
+ * Your phone number's handle. Always has is_me=true.
2736
+ */
2737
+ owner_handle?: Shared.ChatHandle | null;
2738
+ }
2739
+ /**
2740
+ * A chat transcript background. Fields are populated per `type`.
2741
+ */
2742
+ interface Background {
2743
+ /**
2744
+ * The background family.
2745
+ */
2746
+ type: 'color' | 'dynamic' | 'photo';
2747
+ /**
2748
+ * Photo: the image URL.
2749
+ */
2750
+ image_url?: string | null;
2751
+ /**
2752
+ * Color: the two gradient stops as hex, top then bottom.
2753
+ */
2754
+ shades?: Array<string> | null;
2755
+ /**
2756
+ * Dynamic: the animated style.
2757
+ */
2758
+ style?: 'sky' | 'water' | 'aurora' | 'glitter' | null;
2759
+ /**
2760
+ * Color: `custom` (the stored two colors) or a named swatch. Dynamic: the variant
2761
+ * within the `style` (e.g. `sunrise`).
2762
+ */
2763
+ variant?: string | null;
2764
+ }
2765
+ }
2766
+ }
1825
2767
  /**
1826
2768
  * Complete webhook payload for phone_number.status_updated events
1827
2769
  */
@@ -1895,8 +2837,8 @@ export declare namespace PhoneNumberStatusUpdatedWebhookEvent {
1895
2837
  /**
1896
2838
  * Complete webhook payload for message.sent events (2026-02-03 format)
1897
2839
  */
1898
- export type UnwrapWebhookEvent = MessageSentWebhookEvent | MessageReceivedWebhookEvent | MessageReadWebhookEvent | MessageDeliveredWebhookEvent | MessageFailedWebhookEvent | MessageEditedWebhookEvent | ReactionAddedWebhookEvent | ReactionRemovedWebhookEvent | ParticipantAddedWebhookEvent | ParticipantRemovedWebhookEvent | ChatCreatedWebhookEvent | ChatGroupNameUpdatedWebhookEvent | ChatGroupIconUpdatedWebhookEvent | ChatGroupNameUpdateFailedWebhookEvent | ChatGroupIconUpdateFailedWebhookEvent | ChatTypingIndicatorStartedWebhookEvent | ChatTypingIndicatorStoppedWebhookEvent | PhoneNumberStatusUpdatedWebhookEvent;
2840
+ export type UnwrapWebhookEvent = MessageSentWebhookEvent | MessageReceivedWebhookEvent | MessageReadWebhookEvent | MessageDeliveredWebhookEvent | MessageFailedWebhookEvent | MessageEditedWebhookEvent | ReactionAddedWebhookEvent | ReactionRemovedWebhookEvent | PollReceivedWebhookEvent | PollSentWebhookEvent | PollDeliveredWebhookEvent | PollReadWebhookEvent | PollUpdatedWebhookEvent | PollFailedWebhookEvent | PollVoteAddedWebhookEvent | PollVoteRemovedWebhookEvent | PollReactionAddedWebhookEvent | ParticipantAddedWebhookEvent | ParticipantRemovedWebhookEvent | ChatCreatedWebhookEvent | ChatGroupNameUpdatedWebhookEvent | ChatGroupIconUpdatedWebhookEvent | ChatGroupNameUpdateFailedWebhookEvent | ChatGroupIconUpdateFailedWebhookEvent | ChatTypingIndicatorStartedWebhookEvent | ChatTypingIndicatorStoppedWebhookEvent | ChatBackgroundUpdatedWebhookEvent | PhoneNumberStatusUpdatedWebhookEvent;
1899
2841
  export declare namespace Webhooks {
1900
- export { type MessageEventV2 as MessageEventV2, type MessagePayload as MessagePayload, type ReactionEventBase as ReactionEventBase, type SchemasMediaPartResponse as SchemasMediaPartResponse, type SchemasMessageEffect as SchemasMessageEffect, type SchemasTextPartResponse as SchemasTextPartResponse, type MessageSentWebhookEvent as MessageSentWebhookEvent, type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent, type MessageReadWebhookEvent as MessageReadWebhookEvent, type MessageDeliveredWebhookEvent as MessageDeliveredWebhookEvent, type MessageFailedWebhookEvent as MessageFailedWebhookEvent, type MessageEditedWebhookEvent as MessageEditedWebhookEvent, type ReactionAddedWebhookEvent as ReactionAddedWebhookEvent, type ReactionRemovedWebhookEvent as ReactionRemovedWebhookEvent, type ParticipantAddedWebhookEvent as ParticipantAddedWebhookEvent, type ParticipantRemovedWebhookEvent as ParticipantRemovedWebhookEvent, type ChatCreatedWebhookEvent as ChatCreatedWebhookEvent, type ChatGroupNameUpdatedWebhookEvent as ChatGroupNameUpdatedWebhookEvent, type ChatGroupIconUpdatedWebhookEvent as ChatGroupIconUpdatedWebhookEvent, type ChatGroupNameUpdateFailedWebhookEvent as ChatGroupNameUpdateFailedWebhookEvent, type ChatGroupIconUpdateFailedWebhookEvent as ChatGroupIconUpdateFailedWebhookEvent, type ChatTypingIndicatorStartedWebhookEvent as ChatTypingIndicatorStartedWebhookEvent, type ChatTypingIndicatorStoppedWebhookEvent as ChatTypingIndicatorStoppedWebhookEvent, type PhoneNumberStatusUpdatedWebhookEvent as PhoneNumberStatusUpdatedWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, };
2842
+ export { type MessageEventV2 as MessageEventV2, type MessagePayload as MessagePayload, type ReactionEventBase as ReactionEventBase, type SchemasMediaPartResponse as SchemasMediaPartResponse, type SchemasMessageEffect as SchemasMessageEffect, type SchemasTextPartResponse as SchemasTextPartResponse, type MessageSentWebhookEvent as MessageSentWebhookEvent, type MessageReceivedWebhookEvent as MessageReceivedWebhookEvent, type MessageReadWebhookEvent as MessageReadWebhookEvent, type MessageDeliveredWebhookEvent as MessageDeliveredWebhookEvent, type MessageFailedWebhookEvent as MessageFailedWebhookEvent, type MessageEditedWebhookEvent as MessageEditedWebhookEvent, type ReactionAddedWebhookEvent as ReactionAddedWebhookEvent, type ReactionRemovedWebhookEvent as ReactionRemovedWebhookEvent, type PollReceivedWebhookEvent as PollReceivedWebhookEvent, type PollSentWebhookEvent as PollSentWebhookEvent, type PollDeliveredWebhookEvent as PollDeliveredWebhookEvent, type PollReadWebhookEvent as PollReadWebhookEvent, type PollUpdatedWebhookEvent as PollUpdatedWebhookEvent, type PollFailedWebhookEvent as PollFailedWebhookEvent, type PollVoteAddedWebhookEvent as PollVoteAddedWebhookEvent, type PollVoteRemovedWebhookEvent as PollVoteRemovedWebhookEvent, type PollReactionAddedWebhookEvent as PollReactionAddedWebhookEvent, type ParticipantAddedWebhookEvent as ParticipantAddedWebhookEvent, type ParticipantRemovedWebhookEvent as ParticipantRemovedWebhookEvent, type ChatCreatedWebhookEvent as ChatCreatedWebhookEvent, type ChatGroupNameUpdatedWebhookEvent as ChatGroupNameUpdatedWebhookEvent, type ChatGroupIconUpdatedWebhookEvent as ChatGroupIconUpdatedWebhookEvent, type ChatGroupNameUpdateFailedWebhookEvent as ChatGroupNameUpdateFailedWebhookEvent, type ChatGroupIconUpdateFailedWebhookEvent as ChatGroupIconUpdateFailedWebhookEvent, type ChatTypingIndicatorStartedWebhookEvent as ChatTypingIndicatorStartedWebhookEvent, type ChatTypingIndicatorStoppedWebhookEvent as ChatTypingIndicatorStoppedWebhookEvent, type ChatBackgroundUpdatedWebhookEvent as ChatBackgroundUpdatedWebhookEvent, type PhoneNumberStatusUpdatedWebhookEvent as PhoneNumberStatusUpdatedWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, };
1901
2843
  }
1902
2844
  //# sourceMappingURL=webhooks.d.mts.map