@talqing/sdk 0.4.5 → 0.5.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.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  // This file is auto-generated by @hey-api/openapi-ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Tools2 = exports.Versions3 = exports.Tasks2 = exports.Versions2 = exports.Runs = exports.Telephony = exports.Providers = exports.PhoneNumbers = exports.Accounts = exports.Streams = exports.Secrets = exports.Schemas = exports.Functions = exports.Observability = exports.Knowledge2 = exports.Pages = exports.Nodes = exports.Integrations = exports.Triggers = exports.McpTools = exports.Email = exports.Senders = exports.Batches2 = exports.Sends = exports.Recipients2 = exports.Copilot = exports.Tools = exports.Tasks = exports.Knowledge = exports.Agents2 = exports.Conversations = exports.Sessions = exports.Items = exports.Messages = exports.Catalog = exports.Voices = exports.Elevenlabs = exports.Models = exports.Avatars = exports.Calls = exports.ScreenRecording = exports.Recording = exports.Batches = exports.Recipients = exports.Analysis = exports.ProviderKeys = exports.Billing = exports.Credits = exports.Agents = exports.Versions = void 0;
5
- exports.TalqingApi = exports.Webhooks = void 0;
4
+ exports.Versions2 = exports.Runs = exports.Telephony = exports.Providers = exports.PhoneNumbers = exports.Accounts = exports.Streams = exports.Secrets = exports.Schemas = exports.Functions = exports.Observability = exports.Knowledge2 = exports.Pages = exports.Nodes = exports.Integrations = exports.Triggers = exports.McpTools = exports.Email = exports.Senders = exports.Batches2 = exports.Sends = exports.Recipients2 = exports.Copilot = exports.Tools = exports.Tasks = exports.Knowledge = exports.Agents2 = exports.Conversations = exports.Sessions = exports.Items2 = exports.Chats = exports.Tokens = exports.Messages = exports.Items = exports.Catalog = exports.Voices = exports.Elevenlabs = exports.Models = exports.Avatars = exports.Calls = exports.ScreenRecording = exports.Recording = exports.Batches = exports.Recipients = exports.Analysis = exports.ProviderKeys = exports.Billing = exports.Credits = exports.Agents = exports.Versions = void 0;
5
+ exports.TalqingApi = exports.Whatsapp = exports.TwilioSenders = exports.Templates = exports.Batches3 = exports.Recipients3 = exports.Webhooks = exports.Tools2 = exports.Versions3 = exports.Tasks2 = void 0;
6
6
  const client_gen_js_1 = require("./client.gen.js");
7
7
  const index_js_1 = require("./client/index.js");
8
8
  class HeyApiClient {
@@ -134,7 +134,7 @@ class Agents extends HeyApiClient {
134
134
  /**
135
135
  * Delete Agent
136
136
  *
137
- * Delete an agent and its published versions permanently.
137
+ * Delete an agent and its versions permanently; 409 while anything still points at it.
138
138
  */
139
139
  delete(parameters, options) {
140
140
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'agent_id' }] }]);
@@ -594,7 +594,9 @@ class Batches extends HeyApiClient {
594
594
  *
595
595
  * Two things you would otherwise learn from an invoice:
596
596
  *
597
- * - **Answering machines are not detected.** Voicemail is answered and billed.
597
+ * - **Voicemail is answered and billed** unless the agent has
598
+ * `voicemail_detection` on; then it hangs up (optionally after a message),
599
+ * and the recipient is retried like a missed call.
598
600
  * - **Calls run your agent's current published version.** Republishing changes
599
601
  * every call placed after that moment.
600
602
  */
@@ -617,6 +619,27 @@ class Batches extends HeyApiClient {
617
619
  }
618
620
  });
619
621
  }
622
+ /**
623
+ * Delete Call Batch
624
+ *
625
+ * Delete a finished batch and its recipient list for good. Its calls stay.
626
+ *
627
+ * Refused while it is live or a call of it is still in progress; cancel it first.
628
+ */
629
+ delete(parameters, options) {
630
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
631
+ return (options?.client ?? this.client).delete({
632
+ responseStyle: 'data',
633
+ security: [{ scheme: 'bearer', type: 'http' }, {
634
+ in: 'cookie',
635
+ name: 'talqing_session',
636
+ type: 'apiKey'
637
+ }],
638
+ url: '/v1/calls/batches/{batch_id}',
639
+ ...options,
640
+ ...params
641
+ });
642
+ }
620
643
  /**
621
644
  * Get Call Batch
622
645
  *
@@ -672,7 +695,7 @@ class Batches extends HeyApiClient {
672
695
  /**
673
696
  * Cancel Call Batch
674
697
  *
675
- * Stop a batch for good. There is no undo, and a batch cannot be deleted.
698
+ * Stop a batch for good. There is no undo.
676
699
  *
677
700
  * Everyone not yet called immediately reads as `canceled`. Calls already
678
701
  * ringing or in progress are **not** dropped — they run to their natural end,
@@ -1289,21 +1312,44 @@ class Catalog extends HeyApiClient {
1289
1312
  }
1290
1313
  }
1291
1314
  exports.Catalog = Catalog;
1292
- class Messages extends HeyApiClient {
1315
+ class Items extends HeyApiClient {
1293
1316
  /**
1294
- * Create Text Message
1317
+ * List Chat Items
1295
1318
  *
1296
- * Send a message to a text agent — the way to actually talk to one.
1319
+ * The messages, tool calls and handoffs of one chat.
1320
+ */
1321
+ list(parameters, options) {
1322
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
1323
+ { in: 'path', key: 'chat_id' },
1324
+ { in: 'query', key: 'limit' },
1325
+ { in: 'query', key: 'offset' },
1326
+ { in: 'query', key: 'order' }
1327
+ ] }]);
1328
+ return (options?.client ?? this.client).get({
1329
+ responseStyle: 'data',
1330
+ security: [{ scheme: 'bearer', type: 'http' }, {
1331
+ in: 'cookie',
1332
+ name: 'talqing_session',
1333
+ type: 'apiKey'
1334
+ }],
1335
+ url: '/v1/chats/{chat_id}/items',
1336
+ ...options,
1337
+ ...params
1338
+ });
1339
+ }
1340
+ }
1341
+ exports.Items = Items;
1342
+ class Messages extends HeyApiClient {
1343
+ /**
1344
+ * Create Chat Message
1297
1345
  *
1298
- * Addressed by `contact_key`, not by id, so the same key always reaches the
1299
- * same thread. `client_message_id` is a UUID you generate; re-sending with the
1300
- * same one is ignored rather than duplicated.
1346
+ * Send a message and get the agent's reply back on this request.
1301
1347
  *
1302
- * Returns as soon as the message is accepted, carrying only the user's own
1303
- * item — poll `list_conversation_items` for the agent's reply.
1348
+ * A newer message supersedes one still being answered: the older request
1349
+ * returns `status: canceled` with `superseded_by_item_id`.
1304
1350
  */
1305
1351
  create(parameters, options) {
1306
- const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'textMessageRequest', map: 'body' }] }]);
1352
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'chat_id' }, { key: 'chatMessageRequest', map: 'body' }] }]);
1307
1353
  return (options?.client ?? this.client).post({
1308
1354
  responseStyle: 'data',
1309
1355
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -1311,7 +1357,7 @@ class Messages extends HeyApiClient {
1311
1357
  name: 'talqing_session',
1312
1358
  type: 'apiKey'
1313
1359
  }],
1314
- url: '/v1/conversations/messages',
1360
+ url: '/v1/chats/{chat_id}/messages',
1315
1361
  ...options,
1316
1362
  ...params,
1317
1363
  headers: {
@@ -1323,7 +1369,150 @@ class Messages extends HeyApiClient {
1323
1369
  }
1324
1370
  }
1325
1371
  exports.Messages = Messages;
1326
- class Items extends HeyApiClient {
1372
+ class Tokens extends HeyApiClient {
1373
+ /**
1374
+ * Create Chat Token
1375
+ *
1376
+ * Mint a one-hour browser token for this chat. Mint another to refresh.
1377
+ */
1378
+ create(parameters, options) {
1379
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1380
+ return (options?.client ?? this.client).post({
1381
+ responseStyle: 'data',
1382
+ security: [{ scheme: 'bearer', type: 'http' }, {
1383
+ in: 'cookie',
1384
+ name: 'talqing_session',
1385
+ type: 'apiKey'
1386
+ }],
1387
+ url: '/v1/chats/{chat_id}/token',
1388
+ ...options,
1389
+ ...params
1390
+ });
1391
+ }
1392
+ }
1393
+ exports.Tokens = Tokens;
1394
+ class Chats extends HeyApiClient {
1395
+ /**
1396
+ * List Chats
1397
+ *
1398
+ * List chats, newest first.
1399
+ */
1400
+ list(parameters, options) {
1401
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
1402
+ { in: 'query', key: 'limit' },
1403
+ { in: 'query', key: 'offset' },
1404
+ { in: 'query', key: 'agent_id' },
1405
+ { in: 'query', key: 'contact_key' },
1406
+ { in: 'query', key: 'status' }
1407
+ ] }]);
1408
+ return (options?.client ?? this.client).get({
1409
+ responseStyle: 'data',
1410
+ security: [{ scheme: 'bearer', type: 'http' }, {
1411
+ in: 'cookie',
1412
+ name: 'talqing_session',
1413
+ type: 'apiKey'
1414
+ }],
1415
+ url: '/v1/chats',
1416
+ ...options,
1417
+ ...params
1418
+ });
1419
+ }
1420
+ /**
1421
+ * Create Chat
1422
+ *
1423
+ * Start a chat with a text agent. Send it messages with `create_chat_message`.
1424
+ *
1425
+ * It stays open until the agent's `end_call` tool or `end_chat` ends it. Starting
1426
+ * one ends the contact's open chat with the same agent.
1427
+ */
1428
+ create(parameters, options) {
1429
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'createChatRequest', map: 'body' }] }]);
1430
+ return (options?.client ?? this.client).post({
1431
+ responseStyle: 'data',
1432
+ security: [{ scheme: 'bearer', type: 'http' }, {
1433
+ in: 'cookie',
1434
+ name: 'talqing_session',
1435
+ type: 'apiKey'
1436
+ }],
1437
+ url: '/v1/chats',
1438
+ ...options,
1439
+ ...params,
1440
+ headers: {
1441
+ 'Content-Type': 'application/json',
1442
+ ...options?.headers,
1443
+ ...params.headers
1444
+ }
1445
+ });
1446
+ }
1447
+ /**
1448
+ * Delete Chat
1449
+ *
1450
+ * Erase an ended chat's content; the chat and its cost stay. Cannot be undone.
1451
+ */
1452
+ delete(parameters, options) {
1453
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1454
+ return (options?.client ?? this.client).delete({
1455
+ responseStyle: 'data',
1456
+ security: [{ scheme: 'bearer', type: 'http' }, {
1457
+ in: 'cookie',
1458
+ name: 'talqing_session',
1459
+ type: 'apiKey'
1460
+ }],
1461
+ url: '/v1/chats/{chat_id}',
1462
+ ...options,
1463
+ ...params
1464
+ });
1465
+ }
1466
+ /**
1467
+ * Get Chat
1468
+ *
1469
+ * Read one chat: its status, cost so far and, once ended, its analysis.
1470
+ */
1471
+ get(parameters, options) {
1472
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1473
+ return (options?.client ?? this.client).get({
1474
+ responseStyle: 'data',
1475
+ security: [{ scheme: 'bearer', type: 'http' }, {
1476
+ in: 'cookie',
1477
+ name: 'talqing_session',
1478
+ type: 'apiKey'
1479
+ }],
1480
+ url: '/v1/chats/{chat_id}',
1481
+ ...options,
1482
+ ...params
1483
+ });
1484
+ }
1485
+ /**
1486
+ * End Chat
1487
+ *
1488
+ * End a chat. Its analysis and `session.completed` webhook follow.
1489
+ */
1490
+ end(parameters, options) {
1491
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1492
+ return (options?.client ?? this.client).post({
1493
+ responseStyle: 'data',
1494
+ security: [{ scheme: 'bearer', type: 'http' }, {
1495
+ in: 'cookie',
1496
+ name: 'talqing_session',
1497
+ type: 'apiKey'
1498
+ }],
1499
+ url: '/v1/chats/{chat_id}/end',
1500
+ ...options,
1501
+ ...params
1502
+ });
1503
+ }
1504
+ get items() {
1505
+ return this._items ?? (this._items = new Items({ client: this.client }));
1506
+ }
1507
+ get messages() {
1508
+ return this._messages ?? (this._messages = new Messages({ client: this.client }));
1509
+ }
1510
+ get tokens() {
1511
+ return this._tokens ?? (this._tokens = new Tokens({ client: this.client }));
1512
+ }
1513
+ }
1514
+ exports.Chats = Chats;
1515
+ class Items2 extends HeyApiClient {
1327
1516
  /**
1328
1517
  * List Conversation Items
1329
1518
  *
@@ -1354,17 +1543,17 @@ class Items extends HeyApiClient {
1354
1543
  });
1355
1544
  }
1356
1545
  }
1357
- exports.Items = Items;
1546
+ exports.Items2 = Items2;
1358
1547
  class Sessions extends HeyApiClient {
1359
1548
  /**
1360
1549
  * List Conversation Sessions
1361
1550
  *
1362
1551
  * The agent sessions behind a conversation, newest first.
1363
1552
  *
1364
- * A thread can be handled many times — each phone call, each text window,
1365
- * each trigger firing is one session, recording which agent version ran and
1366
- * how it finished. Use it to find out *which* version answered, and to reach
1367
- * the matching `session_id` for `get_call`.
1553
+ * A thread can be handled many times — each phone call and each chat is one
1554
+ * session, recording which agent version ran and how it finished. Use it to
1555
+ * find out *which* version answered; a session's id is its `get_call` or
1556
+ * `get_chat` id.
1368
1557
  */
1369
1558
  list(parameters, options) {
1370
1559
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
@@ -1392,8 +1581,8 @@ class Conversations extends HeyApiClient {
1392
1581
  *
1393
1582
  * List conversations across every channel, most recently active first.
1394
1583
  *
1395
- * One conversation is one bounded stretch of talking — a web chat, a Telegram
1396
- * thread, or a single phone call — with `surface` saying which. Several of them
1584
+ * One conversation is one thread — a web chat, a Telegram thread, or a single
1585
+ * phone call — with `surface` saying which. Several of them
1397
1586
  * can belong to the same person: pass `contact_key` to list only theirs.
1398
1587
  */
1399
1588
  list(parameters, options) {
@@ -1401,7 +1590,8 @@ class Conversations extends HeyApiClient {
1401
1590
  { in: 'query', key: 'limit' },
1402
1591
  { in: 'query', key: 'offset' },
1403
1592
  { in: 'query', key: 'agent_id' },
1404
- { in: 'query', key: 'contact_key' }
1593
+ { in: 'query', key: 'contact_key' },
1594
+ { in: 'query', key: 'status' }
1405
1595
  ] }]);
1406
1596
  return (options?.client ?? this.client).get({
1407
1597
  responseStyle: 'data',
@@ -1415,38 +1605,6 @@ class Conversations extends HeyApiClient {
1415
1605
  ...params
1416
1606
  });
1417
1607
  }
1418
- /**
1419
- * Create Text Conversation
1420
- *
1421
- * Open a text conversation with a published text agent.
1422
- *
1423
- * `contact_key` is your own stable id for the person you are talking to —
1424
- * unique in the workspace, and how you reach them again. `userdata` seeds what
1425
- * the agent knows about them, readable as `{{userdata.field}}` from the
1426
- * agent's tools.
1427
- *
1428
- * Creating the conversation does not send anything; call `create_text_message`
1429
- * to say something.
1430
- */
1431
- create(parameters, options) {
1432
- const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'createTextConversationRequest', map: 'body' }] }]);
1433
- return (options?.client ?? this.client).post({
1434
- responseStyle: 'data',
1435
- security: [{ scheme: 'bearer', type: 'http' }, {
1436
- in: 'cookie',
1437
- name: 'talqing_session',
1438
- type: 'apiKey'
1439
- }],
1440
- url: '/v1/conversations',
1441
- ...options,
1442
- ...params,
1443
- headers: {
1444
- 'Content-Type': 'application/json',
1445
- ...options?.headers,
1446
- ...params.headers
1447
- }
1448
- });
1449
- }
1450
1608
  /**
1451
1609
  * Get Conversation
1452
1610
  *
@@ -1552,11 +1710,8 @@ class Conversations extends HeyApiClient {
1552
1710
  ...params
1553
1711
  });
1554
1712
  }
1555
- get messages() {
1556
- return this._messages ?? (this._messages = new Messages({ client: this.client }));
1557
- }
1558
1713
  get items() {
1559
- return this._items ?? (this._items = new Items({ client: this.client }));
1714
+ return this._items ?? (this._items = new Items2({ client: this.client }));
1560
1715
  }
1561
1716
  get sessions() {
1562
1717
  return this._sessions ?? (this._sessions = new Sessions({ client: this.client }));
@@ -2187,6 +2342,27 @@ class Batches2 extends HeyApiClient {
2187
2342
  }
2188
2343
  });
2189
2344
  }
2345
+ /**
2346
+ * Delete Email Batch
2347
+ *
2348
+ * Delete a batch, its rows and its sends for good. **The record of what was sent goes too.**
2349
+ *
2350
+ * Refused while it is still drafting or a send has not finished; cancel those first.
2351
+ */
2352
+ delete(parameters, options) {
2353
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
2354
+ return (options?.client ?? this.client).delete({
2355
+ responseStyle: 'data',
2356
+ security: [{ scheme: 'bearer', type: 'http' }, {
2357
+ in: 'cookie',
2358
+ name: 'talqing_session',
2359
+ type: 'apiKey'
2360
+ }],
2361
+ url: '/v1/email/batches/{batch_id}',
2362
+ ...options,
2363
+ ...params
2364
+ });
2365
+ }
2190
2366
  /**
2191
2367
  * Get Email Batch
2192
2368
  *
@@ -2243,8 +2419,7 @@ class Batches2 extends HeyApiClient {
2243
2419
  /**
2244
2420
  * Cancel Email Batch
2245
2421
  *
2246
- * Stop drafting for good. A batch cannot be deleted, because it is the
2247
- * record of what was sent to whom.
2422
+ * Stop drafting for good.
2248
2423
  *
2249
2424
  * Rows already drafted are **not** touched and neither is any send: cancelling
2250
2425
  * stops drafting, and drafts already produced are still worth reviewing and
@@ -3120,8 +3295,8 @@ class Secrets extends HeyApiClient {
3120
3295
  /**
3121
3296
  * Delete Secret
3122
3297
  *
3123
- * Delete a secret permanently. Anything still referencing it will fail to
3124
- * resolve at runtime. Organization admins only.
3298
+ * Delete a secret permanently. Refused with 409 while a tool, integration or
3299
+ * carrier account references it. Organization admins only.
3125
3300
  */
3126
3301
  delete(parameters, options) {
3127
3302
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'secret_id' }] }]);
@@ -4414,6 +4589,384 @@ class Webhooks extends HeyApiClient {
4414
4589
  }
4415
4590
  }
4416
4591
  exports.Webhooks = Webhooks;
4592
+ class Recipients3 extends HeyApiClient {
4593
+ /**
4594
+ * List Whatsapp Batch Recipients
4595
+ *
4596
+ * A batch's rows in upload order, each with its rendered message.
4597
+ *
4598
+ * `status` may repeat; a row matching any of them is returned.
4599
+ */
4600
+ list(parameters, options) {
4601
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
4602
+ { in: 'path', key: 'batch_id' },
4603
+ { in: 'query', key: 'limit' },
4604
+ { in: 'query', key: 'offset' },
4605
+ { in: 'query', key: 'status' }
4606
+ ] }]);
4607
+ return (options?.client ?? this.client).get({
4608
+ responseStyle: 'data',
4609
+ security: [{ scheme: 'bearer', type: 'http' }, {
4610
+ in: 'cookie',
4611
+ name: 'talqing_session',
4612
+ type: 'apiKey'
4613
+ }],
4614
+ url: '/v1/whatsapp/batches/{batch_id}/recipients',
4615
+ ...options,
4616
+ ...params
4617
+ });
4618
+ }
4619
+ /**
4620
+ * Restore Whatsapp Batch Recipients
4621
+ *
4622
+ * Put rows a person skipped back. A row skipped for its cells returns when they are fixed.
4623
+ */
4624
+ restore(parameters, options) {
4625
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
4626
+ return (options?.client ?? this.client).post({
4627
+ responseStyle: 'data',
4628
+ security: [{ scheme: 'bearer', type: 'http' }, {
4629
+ in: 'cookie',
4630
+ name: 'talqing_session',
4631
+ type: 'apiKey'
4632
+ }],
4633
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/restore',
4634
+ ...options,
4635
+ ...params,
4636
+ headers: {
4637
+ 'Content-Type': 'application/json',
4638
+ ...options?.headers,
4639
+ ...params.headers
4640
+ }
4641
+ });
4642
+ }
4643
+ /**
4644
+ * Skip Whatsapp Batch Recipients
4645
+ *
4646
+ * Take ready rows out of the send. Reversible with restore.
4647
+ */
4648
+ skip(parameters, options) {
4649
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
4650
+ return (options?.client ?? this.client).post({
4651
+ responseStyle: 'data',
4652
+ security: [{ scheme: 'bearer', type: 'http' }, {
4653
+ in: 'cookie',
4654
+ name: 'talqing_session',
4655
+ type: 'apiKey'
4656
+ }],
4657
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/skip',
4658
+ ...options,
4659
+ ...params,
4660
+ headers: {
4661
+ 'Content-Type': 'application/json',
4662
+ ...options?.headers,
4663
+ ...params.headers
4664
+ }
4665
+ });
4666
+ }
4667
+ /**
4668
+ * Patch Whatsapp Batch Recipient
4669
+ *
4670
+ * Edit cells on a row not yet sent, its phone included. An empty value clears the edit.
4671
+ */
4672
+ update(parameters, options) {
4673
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
4674
+ { in: 'path', key: 'batch_id' },
4675
+ { in: 'path', key: 'recipient_id' },
4676
+ { key: 'patchWhatsAppRecipientRequest', map: 'body' }
4677
+ ] }]);
4678
+ return (options?.client ?? this.client).patch({
4679
+ responseStyle: 'data',
4680
+ security: [{ scheme: 'bearer', type: 'http' }, {
4681
+ in: 'cookie',
4682
+ name: 'talqing_session',
4683
+ type: 'apiKey'
4684
+ }],
4685
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/{recipient_id}',
4686
+ ...options,
4687
+ ...params,
4688
+ headers: {
4689
+ 'Content-Type': 'application/json',
4690
+ ...options?.headers,
4691
+ ...params.headers
4692
+ }
4693
+ });
4694
+ }
4695
+ }
4696
+ exports.Recipients3 = Recipients3;
4697
+ class Batches3 extends HeyApiClient {
4698
+ /**
4699
+ * List Whatsapp Batches
4700
+ *
4701
+ * List WhatsApp batches, newest first.
4702
+ */
4703
+ list(parameters, options) {
4704
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
4705
+ { in: 'query', key: 'limit' },
4706
+ { in: 'query', key: 'offset' },
4707
+ { in: 'query', key: 'status' }
4708
+ ] }]);
4709
+ return (options?.client ?? this.client).get({
4710
+ responseStyle: 'data',
4711
+ security: [{ scheme: 'bearer', type: 'http' }, {
4712
+ in: 'cookie',
4713
+ name: 'talqing_session',
4714
+ type: 'apiKey'
4715
+ }],
4716
+ url: '/v1/whatsapp/batches',
4717
+ ...options,
4718
+ ...params
4719
+ });
4720
+ }
4721
+ /**
4722
+ * Create Whatsapp Batch
4723
+ *
4724
+ * Create a WhatsApp batch: one approved template, sent once per CSV row. Sends nothing yet.
4725
+ *
4726
+ * Only message people who opted in to hear from you on WhatsApp. A row with an
4727
+ * invalid or repeated phone, or a blank or line-broken mapped cell, is kept and
4728
+ * skipped with the reason. Replies go to the sender's assigned agent, which
4729
+ * sees the row's cells as `{{userdata.<column>}}`.
4730
+ */
4731
+ create(parameters, options) {
4732
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'createWhatsAppBatchRequest', map: 'body' }] }]);
4733
+ return (options?.client ?? this.client).post({
4734
+ responseStyle: 'data',
4735
+ security: [{ scheme: 'bearer', type: 'http' }, {
4736
+ in: 'cookie',
4737
+ name: 'talqing_session',
4738
+ type: 'apiKey'
4739
+ }],
4740
+ url: '/v1/whatsapp/batches',
4741
+ ...options,
4742
+ ...params,
4743
+ headers: {
4744
+ 'Content-Type': 'application/json',
4745
+ ...options?.headers,
4746
+ ...params.headers
4747
+ }
4748
+ });
4749
+ }
4750
+ /**
4751
+ * Delete Whatsapp Batch
4752
+ *
4753
+ * Delete a batch and its rows for good. A live batch must be canceled first.
4754
+ *
4755
+ * The conversations it started stay; its delivery and reply counts do not.
4756
+ */
4757
+ delete(parameters, options) {
4758
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4759
+ return (options?.client ?? this.client).delete({
4760
+ responseStyle: 'data',
4761
+ security: [{ scheme: 'bearer', type: 'http' }, {
4762
+ in: 'cookie',
4763
+ name: 'talqing_session',
4764
+ type: 'apiKey'
4765
+ }],
4766
+ url: '/v1/whatsapp/batches/{batch_id}',
4767
+ ...options,
4768
+ ...params
4769
+ });
4770
+ }
4771
+ /**
4772
+ * Get Whatsapp Batch
4773
+ *
4774
+ * One batch: its template, schedule and per-status counts, `replied` included.
4775
+ */
4776
+ get(parameters, options) {
4777
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4778
+ return (options?.client ?? this.client).get({
4779
+ responseStyle: 'data',
4780
+ security: [{ scheme: 'bearer', type: 'http' }, {
4781
+ in: 'cookie',
4782
+ name: 'talqing_session',
4783
+ type: 'apiKey'
4784
+ }],
4785
+ url: '/v1/whatsapp/batches/{batch_id}',
4786
+ ...options,
4787
+ ...params
4788
+ });
4789
+ }
4790
+ /**
4791
+ * Patch Whatsapp Batch
4792
+ *
4793
+ * Edit a batch. Pacing and the window reach a live send within minutes.
4794
+ *
4795
+ * `variable_map` changes only before sending, `start_at` only before it begins;
4796
+ * a finished batch takes `name` alone.
4797
+ */
4798
+ update(parameters, options) {
4799
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'patchWhatsAppBatchRequest', map: 'body' }] }]);
4800
+ return (options?.client ?? this.client).patch({
4801
+ responseStyle: 'data',
4802
+ security: [{ scheme: 'bearer', type: 'http' }, {
4803
+ in: 'cookie',
4804
+ name: 'talqing_session',
4805
+ type: 'apiKey'
4806
+ }],
4807
+ url: '/v1/whatsapp/batches/{batch_id}',
4808
+ ...options,
4809
+ ...params,
4810
+ headers: {
4811
+ 'Content-Type': 'application/json',
4812
+ ...options?.headers,
4813
+ ...params.headers
4814
+ }
4815
+ });
4816
+ }
4817
+ /**
4818
+ * Cancel Whatsapp Batch
4819
+ *
4820
+ * Stop for good. Messages already sent stay sent, and replies are still answered.
4821
+ */
4822
+ cancel(parameters, options) {
4823
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4824
+ return (options?.client ?? this.client).post({
4825
+ responseStyle: 'data',
4826
+ security: [{ scheme: 'bearer', type: 'http' }, {
4827
+ in: 'cookie',
4828
+ name: 'talqing_session',
4829
+ type: 'apiKey'
4830
+ }],
4831
+ url: '/v1/whatsapp/batches/{batch_id}/cancel',
4832
+ ...options,
4833
+ ...params
4834
+ });
4835
+ }
4836
+ /**
4837
+ * Pause Whatsapp Batch
4838
+ *
4839
+ * Stop sending before the next message. Nothing is lost.
4840
+ */
4841
+ pause(parameters, options) {
4842
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4843
+ return (options?.client ?? this.client).post({
4844
+ responseStyle: 'data',
4845
+ security: [{ scheme: 'bearer', type: 'http' }, {
4846
+ in: 'cookie',
4847
+ name: 'talqing_session',
4848
+ type: 'apiKey'
4849
+ }],
4850
+ url: '/v1/whatsapp/batches/{batch_id}/pause',
4851
+ ...options,
4852
+ ...params
4853
+ });
4854
+ }
4855
+ /**
4856
+ * Resume Whatsapp Batch
4857
+ *
4858
+ * Carry on sending from where the batch stopped.
4859
+ */
4860
+ resume(parameters, options) {
4861
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4862
+ return (options?.client ?? this.client).post({
4863
+ responseStyle: 'data',
4864
+ security: [{ scheme: 'bearer', type: 'http' }, {
4865
+ in: 'cookie',
4866
+ name: 'talqing_session',
4867
+ type: 'apiKey'
4868
+ }],
4869
+ url: '/v1/whatsapp/batches/{batch_id}/resume',
4870
+ ...options,
4871
+ ...params
4872
+ });
4873
+ }
4874
+ /**
4875
+ * Send Whatsapp Batch
4876
+ *
4877
+ * Send every ready row. **This messages real people and cannot be undone.**
4878
+ *
4879
+ * `start_at` schedules it, `window` holds it to business hours, and
4880
+ * `send_daily_cap` (default 250, Meta's lowest tier) and `send_gap_seconds`
4881
+ * pace it.
4882
+ */
4883
+ send(parameters, options) {
4884
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'sendWhatsAppBatchRequest', map: 'body' }] }]);
4885
+ return (options?.client ?? this.client).post({
4886
+ responseStyle: 'data',
4887
+ security: [{ scheme: 'bearer', type: 'http' }, {
4888
+ in: 'cookie',
4889
+ name: 'talqing_session',
4890
+ type: 'apiKey'
4891
+ }],
4892
+ url: '/v1/whatsapp/batches/{batch_id}/send',
4893
+ ...options,
4894
+ ...params,
4895
+ headers: {
4896
+ 'Content-Type': 'application/json',
4897
+ ...options?.headers,
4898
+ ...params.headers
4899
+ }
4900
+ });
4901
+ }
4902
+ get recipients() {
4903
+ return this._recipients ?? (this._recipients = new Recipients3({ client: this.client }));
4904
+ }
4905
+ }
4906
+ exports.Batches3 = Batches3;
4907
+ class Templates extends HeyApiClient {
4908
+ /**
4909
+ * List Whatsapp Templates
4910
+ *
4911
+ * List a WhatsApp sender's approved templates, read live from its BSP.
4912
+ *
4913
+ * One with `unsupported_reason` set cannot be sent from a batch.
4914
+ */
4915
+ list(parameters, options) {
4916
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'query', key: 'integration_id' }] }]);
4917
+ return (options?.client ?? this.client).get({
4918
+ responseStyle: 'data',
4919
+ security: [{ scheme: 'bearer', type: 'http' }, {
4920
+ in: 'cookie',
4921
+ name: 'talqing_session',
4922
+ type: 'apiKey'
4923
+ }],
4924
+ url: '/v1/whatsapp/templates',
4925
+ ...options,
4926
+ ...params
4927
+ });
4928
+ }
4929
+ }
4930
+ exports.Templates = Templates;
4931
+ class TwilioSenders extends HeyApiClient {
4932
+ /**
4933
+ * List Twilio Whatsapp Senders
4934
+ *
4935
+ * List the WhatsApp senders on a Twilio account, before connecting one. Stores nothing.
4936
+ */
4937
+ list(parameters, options) {
4938
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'twilioSendersRequest', map: 'body' }] }]);
4939
+ return (options?.client ?? this.client).post({
4940
+ responseStyle: 'data',
4941
+ security: [{ scheme: 'bearer', type: 'http' }, {
4942
+ in: 'cookie',
4943
+ name: 'talqing_session',
4944
+ type: 'apiKey'
4945
+ }],
4946
+ url: '/v1/whatsapp/twilio-senders',
4947
+ ...options,
4948
+ ...params,
4949
+ headers: {
4950
+ 'Content-Type': 'application/json',
4951
+ ...options?.headers,
4952
+ ...params.headers
4953
+ }
4954
+ });
4955
+ }
4956
+ }
4957
+ exports.TwilioSenders = TwilioSenders;
4958
+ class Whatsapp extends HeyApiClient {
4959
+ get batches() {
4960
+ return this._batches ?? (this._batches = new Batches3({ client: this.client }));
4961
+ }
4962
+ get templates() {
4963
+ return this._templates ?? (this._templates = new Templates({ client: this.client }));
4964
+ }
4965
+ get twilioSenders() {
4966
+ return this._twilioSenders ?? (this._twilioSenders = new TwilioSenders({ client: this.client }));
4967
+ }
4968
+ }
4969
+ exports.Whatsapp = Whatsapp;
4417
4970
  class TalqingApi extends HeyApiClient {
4418
4971
  constructor(args) {
4419
4972
  super(args);
@@ -4451,6 +5004,9 @@ class TalqingApi extends HeyApiClient {
4451
5004
  get catalog() {
4452
5005
  return this._catalog ?? (this._catalog = new Catalog({ client: this.client }));
4453
5006
  }
5007
+ get chats() {
5008
+ return this._chats ?? (this._chats = new Chats({ client: this.client }));
5009
+ }
4454
5010
  get conversations() {
4455
5011
  return this._conversations ?? (this._conversations = new Conversations({ client: this.client }));
4456
5012
  }
@@ -4487,6 +5043,9 @@ class TalqingApi extends HeyApiClient {
4487
5043
  get webhooks() {
4488
5044
  return this._webhooks ?? (this._webhooks = new Webhooks({ client: this.client }));
4489
5045
  }
5046
+ get whatsapp() {
5047
+ return this._whatsapp ?? (this._whatsapp = new Whatsapp({ client: this.client }));
5048
+ }
4490
5049
  }
4491
5050
  exports.TalqingApi = TalqingApi;
4492
5051
  TalqingApi.__registry = new HeyApiRegistry();