@talqing/sdk 0.4.5 → 0.6.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.
@@ -129,7 +129,7 @@ export class Agents extends HeyApiClient {
129
129
  /**
130
130
  * Delete Agent
131
131
  *
132
- * Delete an agent and its published versions permanently.
132
+ * Delete an agent and its versions permanently; 409 while anything still points at it.
133
133
  */
134
134
  delete(parameters, options) {
135
135
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }] }]);
@@ -583,7 +583,9 @@ export class Batches extends HeyApiClient {
583
583
  *
584
584
  * Two things you would otherwise learn from an invoice:
585
585
  *
586
- * - **Answering machines are not detected.** Voicemail is answered and billed.
586
+ * - **Voicemail is answered and billed** unless the agent has
587
+ * `voicemail_detection` on; then it hangs up (optionally after a message),
588
+ * and the recipient is retried like a missed call.
587
589
  * - **Calls run your agent's current published version.** Republishing changes
588
590
  * every call placed after that moment.
589
591
  */
@@ -606,6 +608,27 @@ export class Batches extends HeyApiClient {
606
608
  }
607
609
  });
608
610
  }
611
+ /**
612
+ * Delete Call Batch
613
+ *
614
+ * Delete a finished batch and its recipient list for good. Its calls stay.
615
+ *
616
+ * Refused while it is live or a call of it is still in progress; cancel it first.
617
+ */
618
+ delete(parameters, options) {
619
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
620
+ return (options?.client ?? this.client).delete({
621
+ responseStyle: 'data',
622
+ security: [{ scheme: 'bearer', type: 'http' }, {
623
+ in: 'cookie',
624
+ name: 'talqing_session',
625
+ type: 'apiKey'
626
+ }],
627
+ url: '/v1/calls/batches/{batch_id}',
628
+ ...options,
629
+ ...params
630
+ });
631
+ }
609
632
  /**
610
633
  * Get Call Batch
611
634
  *
@@ -661,7 +684,7 @@ export class Batches extends HeyApiClient {
661
684
  /**
662
685
  * Cancel Call Batch
663
686
  *
664
- * Stop a batch for good. There is no undo, and a batch cannot be deleted.
687
+ * Stop a batch for good. There is no undo.
665
688
  *
666
689
  * Everyone not yet called immediately reads as `canceled`. Calls already
667
690
  * ringing or in progress are **not** dropped — they run to their natural end,
@@ -1269,21 +1292,165 @@ export class Catalog extends HeyApiClient {
1269
1292
  return this._voices ?? (this._voices = new Voices({ client: this.client }));
1270
1293
  }
1271
1294
  }
1295
+ export class Analysis2 extends HeyApiClient {
1296
+ /**
1297
+ * Rerun Chat Analysis
1298
+ *
1299
+ * Analyse an ended chat again with its agent's saved definition.
1300
+ *
1301
+ * A real model call: the workspace is charged and the chat re-priced.
1302
+ */
1303
+ rerun(parameters, options) {
1304
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1305
+ return (options?.client ?? this.client).post({
1306
+ responseStyle: 'data',
1307
+ security: [{ scheme: 'bearer', type: 'http' }, {
1308
+ in: 'cookie',
1309
+ name: 'talqing_session',
1310
+ type: 'apiKey'
1311
+ }],
1312
+ url: '/v1/chats/{chat_id}/analysis',
1313
+ ...options,
1314
+ ...params
1315
+ });
1316
+ }
1317
+ /**
1318
+ * Preview Chat Analysis
1319
+ *
1320
+ * Try an analysis definition against an ended chat. Nothing is saved; costs one model call.
1321
+ */
1322
+ preview(parameters, options) {
1323
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }, { key: 'previewAnalysisRequest', map: 'body' }] }]);
1324
+ return (options?.client ?? this.client).post({
1325
+ responseStyle: 'data',
1326
+ security: [{ scheme: 'bearer', type: 'http' }, {
1327
+ in: 'cookie',
1328
+ name: 'talqing_session',
1329
+ type: 'apiKey'
1330
+ }],
1331
+ url: '/v1/chats/{chat_id}/analysis/preview',
1332
+ ...options,
1333
+ ...params,
1334
+ headers: {
1335
+ 'Content-Type': 'application/json',
1336
+ ...options?.headers,
1337
+ ...params.headers
1338
+ }
1339
+ });
1340
+ }
1341
+ }
1342
+ export class Items extends HeyApiClient {
1343
+ /**
1344
+ * List Chat Items
1345
+ *
1346
+ * The messages, tool calls and handoffs of one chat.
1347
+ */
1348
+ list(parameters, options) {
1349
+ const params = buildClientParams([parameters], [{ args: [
1350
+ { in: 'path', key: 'chat_id' },
1351
+ { in: 'query', key: 'limit' },
1352
+ { in: 'query', key: 'offset' },
1353
+ { in: 'query', key: 'order' }
1354
+ ] }]);
1355
+ return (options?.client ?? this.client).get({
1356
+ responseStyle: 'data',
1357
+ security: [{ scheme: 'bearer', type: 'http' }, {
1358
+ in: 'cookie',
1359
+ name: 'talqing_session',
1360
+ type: 'apiKey'
1361
+ }],
1362
+ url: '/v1/chats/{chat_id}/items',
1363
+ ...options,
1364
+ ...params
1365
+ });
1366
+ }
1367
+ }
1272
1368
  export class Messages extends HeyApiClient {
1273
1369
  /**
1274
- * Create Text Message
1370
+ * Create Chat Message
1371
+ *
1372
+ * Send a message and get the agent's reply back on this request.
1373
+ *
1374
+ * A newer message supersedes one still being answered: the older request
1375
+ * returns `status: canceled` with `superseded_by_item_id`.
1376
+ */
1377
+ create(parameters, options) {
1378
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }, { key: 'chatMessageRequest', map: 'body' }] }]);
1379
+ return (options?.client ?? this.client).post({
1380
+ responseStyle: 'data',
1381
+ security: [{ scheme: 'bearer', type: 'http' }, {
1382
+ in: 'cookie',
1383
+ name: 'talqing_session',
1384
+ type: 'apiKey'
1385
+ }],
1386
+ url: '/v1/chats/{chat_id}/messages',
1387
+ ...options,
1388
+ ...params,
1389
+ headers: {
1390
+ 'Content-Type': 'application/json',
1391
+ ...options?.headers,
1392
+ ...params.headers
1393
+ }
1394
+ });
1395
+ }
1396
+ }
1397
+ export class Tokens extends HeyApiClient {
1398
+ /**
1399
+ * Create Chat Token
1400
+ *
1401
+ * Mint a one-hour browser token for this chat. Mint another to refresh.
1402
+ */
1403
+ create(parameters, options) {
1404
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1405
+ return (options?.client ?? this.client).post({
1406
+ responseStyle: 'data',
1407
+ security: [{ scheme: 'bearer', type: 'http' }, {
1408
+ in: 'cookie',
1409
+ name: 'talqing_session',
1410
+ type: 'apiKey'
1411
+ }],
1412
+ url: '/v1/chats/{chat_id}/token',
1413
+ ...options,
1414
+ ...params
1415
+ });
1416
+ }
1417
+ }
1418
+ export class Chats extends HeyApiClient {
1419
+ /**
1420
+ * List Chats
1275
1421
  *
1276
- * Send a message to a text agent — the way to actually talk to one.
1422
+ * List chats, newest first.
1423
+ */
1424
+ list(parameters, options) {
1425
+ const params = buildClientParams([parameters], [{ args: [
1426
+ { in: 'query', key: 'limit' },
1427
+ { in: 'query', key: 'offset' },
1428
+ { in: 'query', key: 'agent_id' },
1429
+ { in: 'query', key: 'contact_key' },
1430
+ { in: 'query', key: 'status' }
1431
+ ] }]);
1432
+ return (options?.client ?? this.client).get({
1433
+ responseStyle: 'data',
1434
+ security: [{ scheme: 'bearer', type: 'http' }, {
1435
+ in: 'cookie',
1436
+ name: 'talqing_session',
1437
+ type: 'apiKey'
1438
+ }],
1439
+ url: '/v1/chats',
1440
+ ...options,
1441
+ ...params
1442
+ });
1443
+ }
1444
+ /**
1445
+ * Create Chat
1277
1446
  *
1278
- * Addressed by `contact_key`, not by id, so the same key always reaches the
1279
- * same thread. `client_message_id` is a UUID you generate; re-sending with the
1280
- * same one is ignored rather than duplicated.
1447
+ * Start a chat with a text agent. Send it messages with `create_chat_message`.
1281
1448
  *
1282
- * Returns as soon as the message is accepted, carrying only the user's own
1283
- * item — poll `list_conversation_items` for the agent's reply.
1449
+ * It stays open until the agent's `end_call` tool or `end_chat` ends it. Starting
1450
+ * one ends the contact's open chat with the same agent.
1284
1451
  */
1285
1452
  create(parameters, options) {
1286
- const params = buildClientParams([parameters], [{ args: [{ key: 'textMessageRequest', map: 'body' }] }]);
1453
+ const params = buildClientParams([parameters], [{ args: [{ key: 'createChatRequest', map: 'body' }] }]);
1287
1454
  return (options?.client ?? this.client).post({
1288
1455
  responseStyle: 'data',
1289
1456
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -1291,7 +1458,7 @@ export class Messages extends HeyApiClient {
1291
1458
  name: 'talqing_session',
1292
1459
  type: 'apiKey'
1293
1460
  }],
1294
- url: '/v1/conversations/messages',
1461
+ url: '/v1/chats',
1295
1462
  ...options,
1296
1463
  ...params,
1297
1464
  headers: {
@@ -1301,8 +1468,96 @@ export class Messages extends HeyApiClient {
1301
1468
  }
1302
1469
  });
1303
1470
  }
1471
+ /**
1472
+ * Delete Chat
1473
+ *
1474
+ * Erase an ended chat's content; the chat and its cost stay. Cannot be undone.
1475
+ */
1476
+ delete(parameters, options) {
1477
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1478
+ return (options?.client ?? this.client).delete({
1479
+ responseStyle: 'data',
1480
+ security: [{ scheme: 'bearer', type: 'http' }, {
1481
+ in: 'cookie',
1482
+ name: 'talqing_session',
1483
+ type: 'apiKey'
1484
+ }],
1485
+ url: '/v1/chats/{chat_id}',
1486
+ ...options,
1487
+ ...params
1488
+ });
1489
+ }
1490
+ /**
1491
+ * Get Chat
1492
+ *
1493
+ * Read one chat: its status, cost so far and, once ended, its analysis.
1494
+ */
1495
+ get(parameters, options) {
1496
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1497
+ return (options?.client ?? this.client).get({
1498
+ responseStyle: 'data',
1499
+ security: [{ scheme: 'bearer', type: 'http' }, {
1500
+ in: 'cookie',
1501
+ name: 'talqing_session',
1502
+ type: 'apiKey'
1503
+ }],
1504
+ url: '/v1/chats/{chat_id}',
1505
+ ...options,
1506
+ ...params
1507
+ });
1508
+ }
1509
+ /**
1510
+ * Get Chat Detail
1511
+ *
1512
+ * One chat with its health snapshot, cost lines, vars and event trace.
1513
+ */
1514
+ detail(parameters, options) {
1515
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1516
+ return (options?.client ?? this.client).get({
1517
+ responseStyle: 'data',
1518
+ security: [{ scheme: 'bearer', type: 'http' }, {
1519
+ in: 'cookie',
1520
+ name: 'talqing_session',
1521
+ type: 'apiKey'
1522
+ }],
1523
+ url: '/v1/chats/{chat_id}/detail',
1524
+ ...options,
1525
+ ...params
1526
+ });
1527
+ }
1528
+ /**
1529
+ * End Chat
1530
+ *
1531
+ * End a chat. Its analysis and `session.completed` webhook follow.
1532
+ */
1533
+ end(parameters, options) {
1534
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1535
+ return (options?.client ?? this.client).post({
1536
+ responseStyle: 'data',
1537
+ security: [{ scheme: 'bearer', type: 'http' }, {
1538
+ in: 'cookie',
1539
+ name: 'talqing_session',
1540
+ type: 'apiKey'
1541
+ }],
1542
+ url: '/v1/chats/{chat_id}/end',
1543
+ ...options,
1544
+ ...params
1545
+ });
1546
+ }
1547
+ get analysis() {
1548
+ return this._analysis ?? (this._analysis = new Analysis2({ client: this.client }));
1549
+ }
1550
+ get items() {
1551
+ return this._items ?? (this._items = new Items({ client: this.client }));
1552
+ }
1553
+ get messages() {
1554
+ return this._messages ?? (this._messages = new Messages({ client: this.client }));
1555
+ }
1556
+ get tokens() {
1557
+ return this._tokens ?? (this._tokens = new Tokens({ client: this.client }));
1558
+ }
1304
1559
  }
1305
- export class Items extends HeyApiClient {
1560
+ export class Items2 extends HeyApiClient {
1306
1561
  /**
1307
1562
  * List Conversation Items
1308
1563
  *
@@ -1339,10 +1594,9 @@ export class Sessions extends HeyApiClient {
1339
1594
  *
1340
1595
  * The agent sessions behind a conversation, newest first.
1341
1596
  *
1342
- * A thread can be handled many times — each phone call, each text window,
1343
- * each trigger firing is one session, recording which agent version ran and
1344
- * how it finished. Use it to find out *which* version answered, and to reach
1345
- * the matching `session_id` for `get_call`.
1597
+ * A thread can be handled many times — each phone call and each chat is one
1598
+ * session, recording which agent version ran, how it finished and what its
1599
+ * analysis concluded. A session's id is its `get_call` or `get_chat` id.
1346
1600
  */
1347
1601
  list(parameters, options) {
1348
1602
  const params = buildClientParams([parameters], [{ args: [
@@ -1369,8 +1623,8 @@ export class Conversations extends HeyApiClient {
1369
1623
  *
1370
1624
  * List conversations across every channel, most recently active first.
1371
1625
  *
1372
- * One conversation is one bounded stretch of talking — a web chat, a Telegram
1373
- * thread, or a single phone call — with `surface` saying which. Several of them
1626
+ * One conversation is one thread — a web chat, a Telegram thread, or a single
1627
+ * phone call — with `surface` saying which. Several of them
1374
1628
  * can belong to the same person: pass `contact_key` to list only theirs.
1375
1629
  */
1376
1630
  list(parameters, options) {
@@ -1378,7 +1632,8 @@ export class Conversations extends HeyApiClient {
1378
1632
  { in: 'query', key: 'limit' },
1379
1633
  { in: 'query', key: 'offset' },
1380
1634
  { in: 'query', key: 'agent_id' },
1381
- { in: 'query', key: 'contact_key' }
1635
+ { in: 'query', key: 'contact_key' },
1636
+ { in: 'query', key: 'status' }
1382
1637
  ] }]);
1383
1638
  return (options?.client ?? this.client).get({
1384
1639
  responseStyle: 'data',
@@ -1392,38 +1647,6 @@ export class Conversations extends HeyApiClient {
1392
1647
  ...params
1393
1648
  });
1394
1649
  }
1395
- /**
1396
- * Create Text Conversation
1397
- *
1398
- * Open a text conversation with a published text agent.
1399
- *
1400
- * `contact_key` is your own stable id for the person you are talking to —
1401
- * unique in the workspace, and how you reach them again. `userdata` seeds what
1402
- * the agent knows about them, readable as `{{userdata.field}}` from the
1403
- * agent's tools.
1404
- *
1405
- * Creating the conversation does not send anything; call `create_text_message`
1406
- * to say something.
1407
- */
1408
- create(parameters, options) {
1409
- const params = buildClientParams([parameters], [{ args: [{ key: 'createTextConversationRequest', map: 'body' }] }]);
1410
- return (options?.client ?? this.client).post({
1411
- responseStyle: 'data',
1412
- security: [{ scheme: 'bearer', type: 'http' }, {
1413
- in: 'cookie',
1414
- name: 'talqing_session',
1415
- type: 'apiKey'
1416
- }],
1417
- url: '/v1/conversations',
1418
- ...options,
1419
- ...params,
1420
- headers: {
1421
- 'Content-Type': 'application/json',
1422
- ...options?.headers,
1423
- ...params.headers
1424
- }
1425
- });
1426
- }
1427
1650
  /**
1428
1651
  * Get Conversation
1429
1652
  *
@@ -1529,11 +1752,31 @@ export class Conversations extends HeyApiClient {
1529
1752
  ...params
1530
1753
  });
1531
1754
  }
1532
- get messages() {
1533
- return this._messages ?? (this._messages = new Messages({ client: this.client }));
1755
+ /**
1756
+ * List Conversation Trace
1757
+ *
1758
+ * What the platform did during this conversation's sessions, oldest first.
1759
+ */
1760
+ trace(parameters, options) {
1761
+ const params = buildClientParams([parameters], [{ args: [
1762
+ { in: 'path', key: 'conversation_id' },
1763
+ { in: 'query', key: 'after' },
1764
+ { in: 'query', key: 'before' }
1765
+ ] }]);
1766
+ return (options?.client ?? this.client).get({
1767
+ responseStyle: 'data',
1768
+ security: [{ scheme: 'bearer', type: 'http' }, {
1769
+ in: 'cookie',
1770
+ name: 'talqing_session',
1771
+ type: 'apiKey'
1772
+ }],
1773
+ url: '/v1/conversations/{conversation_id}/trace',
1774
+ ...options,
1775
+ ...params
1776
+ });
1534
1777
  }
1535
1778
  get items() {
1536
- return this._items ?? (this._items = new Items({ client: this.client }));
1779
+ return this._items ?? (this._items = new Items2({ client: this.client }));
1537
1780
  }
1538
1781
  get sessions() {
1539
1782
  return this._sessions ?? (this._sessions = new Sessions({ client: this.client }));
@@ -2157,16 +2400,15 @@ export class Batches2 extends HeyApiClient {
2157
2400
  });
2158
2401
  }
2159
2402
  /**
2160
- * Get Email Batch
2403
+ * Delete Email Batch
2161
2404
  *
2162
- * One batch: its policy, its per-status counts and what drafting has cost.
2405
+ * Delete a batch, its rows and its sends for good. **The record of what was sent goes too.**
2163
2406
  *
2164
- * `drafted_versions` says which published version of the task wrote how many
2165
- * rows, and `sent_today` how much of `send_daily_cap` is left today.
2407
+ * Refused while it is still drafting or a send has not finished; cancel those first.
2166
2408
  */
2167
- get(parameters, options) {
2409
+ delete(parameters, options) {
2168
2410
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
2169
- return (options?.client ?? this.client).get({
2411
+ return (options?.client ?? this.client).delete({
2170
2412
  responseStyle: 'data',
2171
2413
  security: [{ scheme: 'bearer', type: 'http' }, {
2172
2414
  in: 'cookie',
@@ -2179,7 +2421,29 @@ export class Batches2 extends HeyApiClient {
2179
2421
  });
2180
2422
  }
2181
2423
  /**
2182
- * Patch Email Batch
2424
+ * Get Email Batch
2425
+ *
2426
+ * One batch: its policy, its per-status counts and what drafting has cost.
2427
+ *
2428
+ * `drafted_versions` says which published version of the task wrote how many
2429
+ * rows, and `sent_today` how much of `send_daily_cap` is left today.
2430
+ */
2431
+ get(parameters, options) {
2432
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
2433
+ return (options?.client ?? this.client).get({
2434
+ responseStyle: 'data',
2435
+ security: [{ scheme: 'bearer', type: 'http' }, {
2436
+ in: 'cookie',
2437
+ name: 'talqing_session',
2438
+ type: 'apiKey'
2439
+ }],
2440
+ url: '/v1/email/batches/{batch_id}',
2441
+ ...options,
2442
+ ...params
2443
+ });
2444
+ }
2445
+ /**
2446
+ * Patch Email Batch
2183
2447
  *
2184
2448
  * Edit a batch's policy. The next drafting pass reads the new row.
2185
2449
  *
@@ -2212,8 +2476,7 @@ export class Batches2 extends HeyApiClient {
2212
2476
  /**
2213
2477
  * Cancel Email Batch
2214
2478
  *
2215
- * Stop drafting for good. A batch cannot be deleted, because it is the
2216
- * record of what was sent to whom.
2479
+ * Stop drafting for good.
2217
2480
  *
2218
2481
  * Rows already drafted are **not** touched and neither is any send: cancelling
2219
2482
  * stops drafting, and drafts already produced are still worth reviewing and
@@ -3077,8 +3340,8 @@ export class Secrets extends HeyApiClient {
3077
3340
  /**
3078
3341
  * Delete Secret
3079
3342
  *
3080
- * Delete a secret permanently. Anything still referencing it will fail to
3081
- * resolve at runtime. Organization admins only.
3343
+ * Delete a secret permanently. Refused with 409 while a tool, integration or
3344
+ * carrier account references it. Organization admins only.
3082
3345
  */
3083
3346
  delete(parameters, options) {
3084
3347
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'secret_id' }] }]);
@@ -4359,6 +4622,379 @@ export class Webhooks extends HeyApiClient {
4359
4622
  });
4360
4623
  }
4361
4624
  }
4625
+ export class Recipients3 extends HeyApiClient {
4626
+ /**
4627
+ * List Whatsapp Batch Recipients
4628
+ *
4629
+ * A batch's rows in upload order, each with its rendered message.
4630
+ *
4631
+ * `status` may repeat; a row matching any of them is returned.
4632
+ */
4633
+ list(parameters, options) {
4634
+ const params = buildClientParams([parameters], [{ args: [
4635
+ { in: 'path', key: 'batch_id' },
4636
+ { in: 'query', key: 'limit' },
4637
+ { in: 'query', key: 'offset' },
4638
+ { in: 'query', key: 'status' }
4639
+ ] }]);
4640
+ return (options?.client ?? this.client).get({
4641
+ responseStyle: 'data',
4642
+ security: [{ scheme: 'bearer', type: 'http' }, {
4643
+ in: 'cookie',
4644
+ name: 'talqing_session',
4645
+ type: 'apiKey'
4646
+ }],
4647
+ url: '/v1/whatsapp/batches/{batch_id}/recipients',
4648
+ ...options,
4649
+ ...params
4650
+ });
4651
+ }
4652
+ /**
4653
+ * Restore Whatsapp Batch Recipients
4654
+ *
4655
+ * Put rows a person skipped back. A row skipped for its cells returns when they are fixed.
4656
+ */
4657
+ restore(parameters, options) {
4658
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
4659
+ return (options?.client ?? this.client).post({
4660
+ responseStyle: 'data',
4661
+ security: [{ scheme: 'bearer', type: 'http' }, {
4662
+ in: 'cookie',
4663
+ name: 'talqing_session',
4664
+ type: 'apiKey'
4665
+ }],
4666
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/restore',
4667
+ ...options,
4668
+ ...params,
4669
+ headers: {
4670
+ 'Content-Type': 'application/json',
4671
+ ...options?.headers,
4672
+ ...params.headers
4673
+ }
4674
+ });
4675
+ }
4676
+ /**
4677
+ * Skip Whatsapp Batch Recipients
4678
+ *
4679
+ * Take ready rows out of the send. Reversible with restore.
4680
+ */
4681
+ skip(parameters, options) {
4682
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
4683
+ return (options?.client ?? this.client).post({
4684
+ responseStyle: 'data',
4685
+ security: [{ scheme: 'bearer', type: 'http' }, {
4686
+ in: 'cookie',
4687
+ name: 'talqing_session',
4688
+ type: 'apiKey'
4689
+ }],
4690
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/skip',
4691
+ ...options,
4692
+ ...params,
4693
+ headers: {
4694
+ 'Content-Type': 'application/json',
4695
+ ...options?.headers,
4696
+ ...params.headers
4697
+ }
4698
+ });
4699
+ }
4700
+ /**
4701
+ * Patch Whatsapp Batch Recipient
4702
+ *
4703
+ * Edit cells on a row not yet sent, its phone included. An empty value clears the edit.
4704
+ */
4705
+ update(parameters, options) {
4706
+ const params = buildClientParams([parameters], [{ args: [
4707
+ { in: 'path', key: 'batch_id' },
4708
+ { in: 'path', key: 'recipient_id' },
4709
+ { key: 'patchWhatsAppRecipientRequest', map: 'body' }
4710
+ ] }]);
4711
+ return (options?.client ?? this.client).patch({
4712
+ responseStyle: 'data',
4713
+ security: [{ scheme: 'bearer', type: 'http' }, {
4714
+ in: 'cookie',
4715
+ name: 'talqing_session',
4716
+ type: 'apiKey'
4717
+ }],
4718
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/{recipient_id}',
4719
+ ...options,
4720
+ ...params,
4721
+ headers: {
4722
+ 'Content-Type': 'application/json',
4723
+ ...options?.headers,
4724
+ ...params.headers
4725
+ }
4726
+ });
4727
+ }
4728
+ }
4729
+ export class Batches3 extends HeyApiClient {
4730
+ /**
4731
+ * List Whatsapp Batches
4732
+ *
4733
+ * List WhatsApp batches, newest first.
4734
+ */
4735
+ list(parameters, options) {
4736
+ const params = buildClientParams([parameters], [{ args: [
4737
+ { in: 'query', key: 'limit' },
4738
+ { in: 'query', key: 'offset' },
4739
+ { in: 'query', key: 'status' }
4740
+ ] }]);
4741
+ return (options?.client ?? this.client).get({
4742
+ responseStyle: 'data',
4743
+ security: [{ scheme: 'bearer', type: 'http' }, {
4744
+ in: 'cookie',
4745
+ name: 'talqing_session',
4746
+ type: 'apiKey'
4747
+ }],
4748
+ url: '/v1/whatsapp/batches',
4749
+ ...options,
4750
+ ...params
4751
+ });
4752
+ }
4753
+ /**
4754
+ * Create Whatsapp Batch
4755
+ *
4756
+ * Create a WhatsApp batch: one approved template, sent once per CSV row. Sends nothing yet.
4757
+ *
4758
+ * Only message people who opted in to hear from you on WhatsApp. A row with an
4759
+ * invalid or repeated phone, or a blank or line-broken mapped cell, is kept and
4760
+ * skipped with the reason. Replies go to the sender's assigned agent, which
4761
+ * sees the row's cells as `{{userdata.<column>}}`.
4762
+ */
4763
+ create(parameters, options) {
4764
+ const params = buildClientParams([parameters], [{ args: [{ key: 'createWhatsAppBatchRequest', map: 'body' }] }]);
4765
+ return (options?.client ?? this.client).post({
4766
+ responseStyle: 'data',
4767
+ security: [{ scheme: 'bearer', type: 'http' }, {
4768
+ in: 'cookie',
4769
+ name: 'talqing_session',
4770
+ type: 'apiKey'
4771
+ }],
4772
+ url: '/v1/whatsapp/batches',
4773
+ ...options,
4774
+ ...params,
4775
+ headers: {
4776
+ 'Content-Type': 'application/json',
4777
+ ...options?.headers,
4778
+ ...params.headers
4779
+ }
4780
+ });
4781
+ }
4782
+ /**
4783
+ * Delete Whatsapp Batch
4784
+ *
4785
+ * Delete a batch and its rows for good. A live batch must be canceled first.
4786
+ *
4787
+ * The conversations it started stay; its delivery and reply counts do not.
4788
+ */
4789
+ delete(parameters, options) {
4790
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4791
+ return (options?.client ?? this.client).delete({
4792
+ responseStyle: 'data',
4793
+ security: [{ scheme: 'bearer', type: 'http' }, {
4794
+ in: 'cookie',
4795
+ name: 'talqing_session',
4796
+ type: 'apiKey'
4797
+ }],
4798
+ url: '/v1/whatsapp/batches/{batch_id}',
4799
+ ...options,
4800
+ ...params
4801
+ });
4802
+ }
4803
+ /**
4804
+ * Get Whatsapp Batch
4805
+ *
4806
+ * One batch: its template, schedule and per-status counts, `replied` included.
4807
+ */
4808
+ get(parameters, options) {
4809
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4810
+ return (options?.client ?? this.client).get({
4811
+ responseStyle: 'data',
4812
+ security: [{ scheme: 'bearer', type: 'http' }, {
4813
+ in: 'cookie',
4814
+ name: 'talqing_session',
4815
+ type: 'apiKey'
4816
+ }],
4817
+ url: '/v1/whatsapp/batches/{batch_id}',
4818
+ ...options,
4819
+ ...params
4820
+ });
4821
+ }
4822
+ /**
4823
+ * Patch Whatsapp Batch
4824
+ *
4825
+ * Edit a batch. Pacing and the window reach a live send within minutes.
4826
+ *
4827
+ * `variable_map` changes only before sending, `start_at` only before it begins;
4828
+ * a finished batch takes `name` alone.
4829
+ */
4830
+ update(parameters, options) {
4831
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'patchWhatsAppBatchRequest', map: 'body' }] }]);
4832
+ return (options?.client ?? this.client).patch({
4833
+ responseStyle: 'data',
4834
+ security: [{ scheme: 'bearer', type: 'http' }, {
4835
+ in: 'cookie',
4836
+ name: 'talqing_session',
4837
+ type: 'apiKey'
4838
+ }],
4839
+ url: '/v1/whatsapp/batches/{batch_id}',
4840
+ ...options,
4841
+ ...params,
4842
+ headers: {
4843
+ 'Content-Type': 'application/json',
4844
+ ...options?.headers,
4845
+ ...params.headers
4846
+ }
4847
+ });
4848
+ }
4849
+ /**
4850
+ * Cancel Whatsapp Batch
4851
+ *
4852
+ * Stop for good. Messages already sent stay sent, and replies are still answered.
4853
+ */
4854
+ cancel(parameters, options) {
4855
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4856
+ return (options?.client ?? this.client).post({
4857
+ responseStyle: 'data',
4858
+ security: [{ scheme: 'bearer', type: 'http' }, {
4859
+ in: 'cookie',
4860
+ name: 'talqing_session',
4861
+ type: 'apiKey'
4862
+ }],
4863
+ url: '/v1/whatsapp/batches/{batch_id}/cancel',
4864
+ ...options,
4865
+ ...params
4866
+ });
4867
+ }
4868
+ /**
4869
+ * Pause Whatsapp Batch
4870
+ *
4871
+ * Stop sending before the next message. Nothing is lost.
4872
+ */
4873
+ pause(parameters, options) {
4874
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4875
+ return (options?.client ?? this.client).post({
4876
+ responseStyle: 'data',
4877
+ security: [{ scheme: 'bearer', type: 'http' }, {
4878
+ in: 'cookie',
4879
+ name: 'talqing_session',
4880
+ type: 'apiKey'
4881
+ }],
4882
+ url: '/v1/whatsapp/batches/{batch_id}/pause',
4883
+ ...options,
4884
+ ...params
4885
+ });
4886
+ }
4887
+ /**
4888
+ * Resume Whatsapp Batch
4889
+ *
4890
+ * Carry on sending from where the batch stopped.
4891
+ */
4892
+ resume(parameters, options) {
4893
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4894
+ return (options?.client ?? this.client).post({
4895
+ responseStyle: 'data',
4896
+ security: [{ scheme: 'bearer', type: 'http' }, {
4897
+ in: 'cookie',
4898
+ name: 'talqing_session',
4899
+ type: 'apiKey'
4900
+ }],
4901
+ url: '/v1/whatsapp/batches/{batch_id}/resume',
4902
+ ...options,
4903
+ ...params
4904
+ });
4905
+ }
4906
+ /**
4907
+ * Send Whatsapp Batch
4908
+ *
4909
+ * Send every ready row. **This messages real people and cannot be undone.**
4910
+ *
4911
+ * `start_at` schedules it, `window` holds it to business hours, and
4912
+ * `send_daily_cap` (default 250, Meta's lowest tier) and `send_gap_seconds`
4913
+ * pace it.
4914
+ */
4915
+ send(parameters, options) {
4916
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'sendWhatsAppBatchRequest', map: 'body' }] }]);
4917
+ return (options?.client ?? this.client).post({
4918
+ responseStyle: 'data',
4919
+ security: [{ scheme: 'bearer', type: 'http' }, {
4920
+ in: 'cookie',
4921
+ name: 'talqing_session',
4922
+ type: 'apiKey'
4923
+ }],
4924
+ url: '/v1/whatsapp/batches/{batch_id}/send',
4925
+ ...options,
4926
+ ...params,
4927
+ headers: {
4928
+ 'Content-Type': 'application/json',
4929
+ ...options?.headers,
4930
+ ...params.headers
4931
+ }
4932
+ });
4933
+ }
4934
+ get recipients() {
4935
+ return this._recipients ?? (this._recipients = new Recipients3({ client: this.client }));
4936
+ }
4937
+ }
4938
+ export class Templates extends HeyApiClient {
4939
+ /**
4940
+ * List Whatsapp Templates
4941
+ *
4942
+ * List a WhatsApp sender's approved templates, read live from its BSP.
4943
+ *
4944
+ * One with `unsupported_reason` set cannot be sent from a batch.
4945
+ */
4946
+ list(parameters, options) {
4947
+ const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'integration_id' }] }]);
4948
+ return (options?.client ?? this.client).get({
4949
+ responseStyle: 'data',
4950
+ security: [{ scheme: 'bearer', type: 'http' }, {
4951
+ in: 'cookie',
4952
+ name: 'talqing_session',
4953
+ type: 'apiKey'
4954
+ }],
4955
+ url: '/v1/whatsapp/templates',
4956
+ ...options,
4957
+ ...params
4958
+ });
4959
+ }
4960
+ }
4961
+ export class TwilioSenders extends HeyApiClient {
4962
+ /**
4963
+ * List Twilio Whatsapp Senders
4964
+ *
4965
+ * List the WhatsApp senders on a Twilio account, before connecting one. Stores nothing.
4966
+ */
4967
+ list(parameters, options) {
4968
+ const params = buildClientParams([parameters], [{ args: [{ key: 'twilioSendersRequest', map: 'body' }] }]);
4969
+ return (options?.client ?? this.client).post({
4970
+ responseStyle: 'data',
4971
+ security: [{ scheme: 'bearer', type: 'http' }, {
4972
+ in: 'cookie',
4973
+ name: 'talqing_session',
4974
+ type: 'apiKey'
4975
+ }],
4976
+ url: '/v1/whatsapp/twilio-senders',
4977
+ ...options,
4978
+ ...params,
4979
+ headers: {
4980
+ 'Content-Type': 'application/json',
4981
+ ...options?.headers,
4982
+ ...params.headers
4983
+ }
4984
+ });
4985
+ }
4986
+ }
4987
+ export class Whatsapp extends HeyApiClient {
4988
+ get batches() {
4989
+ return this._batches ?? (this._batches = new Batches3({ client: this.client }));
4990
+ }
4991
+ get templates() {
4992
+ return this._templates ?? (this._templates = new Templates({ client: this.client }));
4993
+ }
4994
+ get twilioSenders() {
4995
+ return this._twilioSenders ?? (this._twilioSenders = new TwilioSenders({ client: this.client }));
4996
+ }
4997
+ }
4362
4998
  export class TalqingApi extends HeyApiClient {
4363
4999
  constructor(args) {
4364
5000
  super(args);
@@ -4396,6 +5032,9 @@ export class TalqingApi extends HeyApiClient {
4396
5032
  get catalog() {
4397
5033
  return this._catalog ?? (this._catalog = new Catalog({ client: this.client }));
4398
5034
  }
5035
+ get chats() {
5036
+ return this._chats ?? (this._chats = new Chats({ client: this.client }));
5037
+ }
4399
5038
  get conversations() {
4400
5039
  return this._conversations ?? (this._conversations = new Conversations({ client: this.client }));
4401
5040
  }
@@ -4432,6 +5071,9 @@ export class TalqingApi extends HeyApiClient {
4432
5071
  get webhooks() {
4433
5072
  return this._webhooks ?? (this._webhooks = new Webhooks({ client: this.client }));
4434
5073
  }
5074
+ get whatsapp() {
5075
+ return this._whatsapp ?? (this._whatsapp = new Whatsapp({ client: this.client }));
5076
+ }
4435
5077
  }
4436
5078
  TalqingApi.__registry = new HeyApiRegistry();
4437
5079
  //# sourceMappingURL=sdk.gen.js.map