@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.
@@ -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,118 @@ export class Catalog extends HeyApiClient {
1269
1292
  return this._voices ?? (this._voices = new Voices({ client: this.client }));
1270
1293
  }
1271
1294
  }
1295
+ export class Items extends HeyApiClient {
1296
+ /**
1297
+ * List Chat Items
1298
+ *
1299
+ * The messages, tool calls and handoffs of one chat.
1300
+ */
1301
+ list(parameters, options) {
1302
+ const params = buildClientParams([parameters], [{ args: [
1303
+ { in: 'path', key: 'chat_id' },
1304
+ { in: 'query', key: 'limit' },
1305
+ { in: 'query', key: 'offset' },
1306
+ { in: 'query', key: 'order' }
1307
+ ] }]);
1308
+ return (options?.client ?? this.client).get({
1309
+ responseStyle: 'data',
1310
+ security: [{ scheme: 'bearer', type: 'http' }, {
1311
+ in: 'cookie',
1312
+ name: 'talqing_session',
1313
+ type: 'apiKey'
1314
+ }],
1315
+ url: '/v1/chats/{chat_id}/items',
1316
+ ...options,
1317
+ ...params
1318
+ });
1319
+ }
1320
+ }
1272
1321
  export class Messages extends HeyApiClient {
1273
1322
  /**
1274
- * Create Text Message
1323
+ * Create Chat Message
1324
+ *
1325
+ * Send a message and get the agent's reply back on this request.
1326
+ *
1327
+ * A newer message supersedes one still being answered: the older request
1328
+ * returns `status: canceled` with `superseded_by_item_id`.
1329
+ */
1330
+ create(parameters, options) {
1331
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }, { key: 'chatMessageRequest', map: 'body' }] }]);
1332
+ return (options?.client ?? this.client).post({
1333
+ responseStyle: 'data',
1334
+ security: [{ scheme: 'bearer', type: 'http' }, {
1335
+ in: 'cookie',
1336
+ name: 'talqing_session',
1337
+ type: 'apiKey'
1338
+ }],
1339
+ url: '/v1/chats/{chat_id}/messages',
1340
+ ...options,
1341
+ ...params,
1342
+ headers: {
1343
+ 'Content-Type': 'application/json',
1344
+ ...options?.headers,
1345
+ ...params.headers
1346
+ }
1347
+ });
1348
+ }
1349
+ }
1350
+ export class Tokens extends HeyApiClient {
1351
+ /**
1352
+ * Create Chat Token
1353
+ *
1354
+ * Mint a one-hour browser token for this chat. Mint another to refresh.
1355
+ */
1356
+ create(parameters, options) {
1357
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1358
+ return (options?.client ?? this.client).post({
1359
+ responseStyle: 'data',
1360
+ security: [{ scheme: 'bearer', type: 'http' }, {
1361
+ in: 'cookie',
1362
+ name: 'talqing_session',
1363
+ type: 'apiKey'
1364
+ }],
1365
+ url: '/v1/chats/{chat_id}/token',
1366
+ ...options,
1367
+ ...params
1368
+ });
1369
+ }
1370
+ }
1371
+ export class Chats extends HeyApiClient {
1372
+ /**
1373
+ * List Chats
1275
1374
  *
1276
- * Send a message to a text agent — the way to actually talk to one.
1375
+ * List chats, newest first.
1376
+ */
1377
+ list(parameters, options) {
1378
+ const params = buildClientParams([parameters], [{ args: [
1379
+ { in: 'query', key: 'limit' },
1380
+ { in: 'query', key: 'offset' },
1381
+ { in: 'query', key: 'agent_id' },
1382
+ { in: 'query', key: 'contact_key' },
1383
+ { in: 'query', key: 'status' }
1384
+ ] }]);
1385
+ return (options?.client ?? this.client).get({
1386
+ responseStyle: 'data',
1387
+ security: [{ scheme: 'bearer', type: 'http' }, {
1388
+ in: 'cookie',
1389
+ name: 'talqing_session',
1390
+ type: 'apiKey'
1391
+ }],
1392
+ url: '/v1/chats',
1393
+ ...options,
1394
+ ...params
1395
+ });
1396
+ }
1397
+ /**
1398
+ * Create Chat
1277
1399
  *
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.
1400
+ * Start a chat with a text agent. Send it messages with `create_chat_message`.
1281
1401
  *
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.
1402
+ * It stays open until the agent's `end_call` tool or `end_chat` ends it. Starting
1403
+ * one ends the contact's open chat with the same agent.
1284
1404
  */
1285
1405
  create(parameters, options) {
1286
- const params = buildClientParams([parameters], [{ args: [{ key: 'textMessageRequest', map: 'body' }] }]);
1406
+ const params = buildClientParams([parameters], [{ args: [{ key: 'createChatRequest', map: 'body' }] }]);
1287
1407
  return (options?.client ?? this.client).post({
1288
1408
  responseStyle: 'data',
1289
1409
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -1291,7 +1411,7 @@ export class Messages extends HeyApiClient {
1291
1411
  name: 'talqing_session',
1292
1412
  type: 'apiKey'
1293
1413
  }],
1294
- url: '/v1/conversations/messages',
1414
+ url: '/v1/chats',
1295
1415
  ...options,
1296
1416
  ...params,
1297
1417
  headers: {
@@ -1301,8 +1421,74 @@ export class Messages extends HeyApiClient {
1301
1421
  }
1302
1422
  });
1303
1423
  }
1424
+ /**
1425
+ * Delete Chat
1426
+ *
1427
+ * Erase an ended chat's content; the chat and its cost stay. Cannot be undone.
1428
+ */
1429
+ delete(parameters, options) {
1430
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1431
+ return (options?.client ?? this.client).delete({
1432
+ responseStyle: 'data',
1433
+ security: [{ scheme: 'bearer', type: 'http' }, {
1434
+ in: 'cookie',
1435
+ name: 'talqing_session',
1436
+ type: 'apiKey'
1437
+ }],
1438
+ url: '/v1/chats/{chat_id}',
1439
+ ...options,
1440
+ ...params
1441
+ });
1442
+ }
1443
+ /**
1444
+ * Get Chat
1445
+ *
1446
+ * Read one chat: its status, cost so far and, once ended, its analysis.
1447
+ */
1448
+ get(parameters, options) {
1449
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1450
+ return (options?.client ?? this.client).get({
1451
+ responseStyle: 'data',
1452
+ security: [{ scheme: 'bearer', type: 'http' }, {
1453
+ in: 'cookie',
1454
+ name: 'talqing_session',
1455
+ type: 'apiKey'
1456
+ }],
1457
+ url: '/v1/chats/{chat_id}',
1458
+ ...options,
1459
+ ...params
1460
+ });
1461
+ }
1462
+ /**
1463
+ * End Chat
1464
+ *
1465
+ * End a chat. Its analysis and `session.completed` webhook follow.
1466
+ */
1467
+ end(parameters, options) {
1468
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'chat_id' }] }]);
1469
+ return (options?.client ?? this.client).post({
1470
+ responseStyle: 'data',
1471
+ security: [{ scheme: 'bearer', type: 'http' }, {
1472
+ in: 'cookie',
1473
+ name: 'talqing_session',
1474
+ type: 'apiKey'
1475
+ }],
1476
+ url: '/v1/chats/{chat_id}/end',
1477
+ ...options,
1478
+ ...params
1479
+ });
1480
+ }
1481
+ get items() {
1482
+ return this._items ?? (this._items = new Items({ client: this.client }));
1483
+ }
1484
+ get messages() {
1485
+ return this._messages ?? (this._messages = new Messages({ client: this.client }));
1486
+ }
1487
+ get tokens() {
1488
+ return this._tokens ?? (this._tokens = new Tokens({ client: this.client }));
1489
+ }
1304
1490
  }
1305
- export class Items extends HeyApiClient {
1491
+ export class Items2 extends HeyApiClient {
1306
1492
  /**
1307
1493
  * List Conversation Items
1308
1494
  *
@@ -1339,10 +1525,10 @@ export class Sessions extends HeyApiClient {
1339
1525
  *
1340
1526
  * The agent sessions behind a conversation, newest first.
1341
1527
  *
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`.
1528
+ * A thread can be handled many times — each phone call and each chat is one
1529
+ * session, recording which agent version ran and how it finished. Use it to
1530
+ * find out *which* version answered; a session's id is its `get_call` or
1531
+ * `get_chat` id.
1346
1532
  */
1347
1533
  list(parameters, options) {
1348
1534
  const params = buildClientParams([parameters], [{ args: [
@@ -1369,8 +1555,8 @@ export class Conversations extends HeyApiClient {
1369
1555
  *
1370
1556
  * List conversations across every channel, most recently active first.
1371
1557
  *
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
1558
+ * One conversation is one thread — a web chat, a Telegram thread, or a single
1559
+ * phone call — with `surface` saying which. Several of them
1374
1560
  * can belong to the same person: pass `contact_key` to list only theirs.
1375
1561
  */
1376
1562
  list(parameters, options) {
@@ -1378,7 +1564,8 @@ export class Conversations extends HeyApiClient {
1378
1564
  { in: 'query', key: 'limit' },
1379
1565
  { in: 'query', key: 'offset' },
1380
1566
  { in: 'query', key: 'agent_id' },
1381
- { in: 'query', key: 'contact_key' }
1567
+ { in: 'query', key: 'contact_key' },
1568
+ { in: 'query', key: 'status' }
1382
1569
  ] }]);
1383
1570
  return (options?.client ?? this.client).get({
1384
1571
  responseStyle: 'data',
@@ -1392,38 +1579,6 @@ export class Conversations extends HeyApiClient {
1392
1579
  ...params
1393
1580
  });
1394
1581
  }
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
1582
  /**
1428
1583
  * Get Conversation
1429
1584
  *
@@ -1529,11 +1684,8 @@ export class Conversations extends HeyApiClient {
1529
1684
  ...params
1530
1685
  });
1531
1686
  }
1532
- get messages() {
1533
- return this._messages ?? (this._messages = new Messages({ client: this.client }));
1534
- }
1535
1687
  get items() {
1536
- return this._items ?? (this._items = new Items({ client: this.client }));
1688
+ return this._items ?? (this._items = new Items2({ client: this.client }));
1537
1689
  }
1538
1690
  get sessions() {
1539
1691
  return this._sessions ?? (this._sessions = new Sessions({ client: this.client }));
@@ -2156,6 +2308,27 @@ export class Batches2 extends HeyApiClient {
2156
2308
  }
2157
2309
  });
2158
2310
  }
2311
+ /**
2312
+ * Delete Email Batch
2313
+ *
2314
+ * Delete a batch, its rows and its sends for good. **The record of what was sent goes too.**
2315
+ *
2316
+ * Refused while it is still drafting or a send has not finished; cancel those first.
2317
+ */
2318
+ delete(parameters, options) {
2319
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
2320
+ return (options?.client ?? this.client).delete({
2321
+ responseStyle: 'data',
2322
+ security: [{ scheme: 'bearer', type: 'http' }, {
2323
+ in: 'cookie',
2324
+ name: 'talqing_session',
2325
+ type: 'apiKey'
2326
+ }],
2327
+ url: '/v1/email/batches/{batch_id}',
2328
+ ...options,
2329
+ ...params
2330
+ });
2331
+ }
2159
2332
  /**
2160
2333
  * Get Email Batch
2161
2334
  *
@@ -2212,8 +2385,7 @@ export class Batches2 extends HeyApiClient {
2212
2385
  /**
2213
2386
  * Cancel Email Batch
2214
2387
  *
2215
- * Stop drafting for good. A batch cannot be deleted, because it is the
2216
- * record of what was sent to whom.
2388
+ * Stop drafting for good.
2217
2389
  *
2218
2390
  * Rows already drafted are **not** touched and neither is any send: cancelling
2219
2391
  * stops drafting, and drafts already produced are still worth reviewing and
@@ -3077,8 +3249,8 @@ export class Secrets extends HeyApiClient {
3077
3249
  /**
3078
3250
  * Delete Secret
3079
3251
  *
3080
- * Delete a secret permanently. Anything still referencing it will fail to
3081
- * resolve at runtime. Organization admins only.
3252
+ * Delete a secret permanently. Refused with 409 while a tool, integration or
3253
+ * carrier account references it. Organization admins only.
3082
3254
  */
3083
3255
  delete(parameters, options) {
3084
3256
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'secret_id' }] }]);
@@ -4359,6 +4531,379 @@ export class Webhooks extends HeyApiClient {
4359
4531
  });
4360
4532
  }
4361
4533
  }
4534
+ export class Recipients3 extends HeyApiClient {
4535
+ /**
4536
+ * List Whatsapp Batch Recipients
4537
+ *
4538
+ * A batch's rows in upload order, each with its rendered message.
4539
+ *
4540
+ * `status` may repeat; a row matching any of them is returned.
4541
+ */
4542
+ list(parameters, options) {
4543
+ const params = buildClientParams([parameters], [{ args: [
4544
+ { in: 'path', key: 'batch_id' },
4545
+ { in: 'query', key: 'limit' },
4546
+ { in: 'query', key: 'offset' },
4547
+ { in: 'query', key: 'status' }
4548
+ ] }]);
4549
+ return (options?.client ?? this.client).get({
4550
+ responseStyle: 'data',
4551
+ security: [{ scheme: 'bearer', type: 'http' }, {
4552
+ in: 'cookie',
4553
+ name: 'talqing_session',
4554
+ type: 'apiKey'
4555
+ }],
4556
+ url: '/v1/whatsapp/batches/{batch_id}/recipients',
4557
+ ...options,
4558
+ ...params
4559
+ });
4560
+ }
4561
+ /**
4562
+ * Restore Whatsapp Batch Recipients
4563
+ *
4564
+ * Put rows a person skipped back. A row skipped for its cells returns when they are fixed.
4565
+ */
4566
+ restore(parameters, options) {
4567
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
4568
+ return (options?.client ?? this.client).post({
4569
+ responseStyle: 'data',
4570
+ security: [{ scheme: 'bearer', type: 'http' }, {
4571
+ in: 'cookie',
4572
+ name: 'talqing_session',
4573
+ type: 'apiKey'
4574
+ }],
4575
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/restore',
4576
+ ...options,
4577
+ ...params,
4578
+ headers: {
4579
+ 'Content-Type': 'application/json',
4580
+ ...options?.headers,
4581
+ ...params.headers
4582
+ }
4583
+ });
4584
+ }
4585
+ /**
4586
+ * Skip Whatsapp Batch Recipients
4587
+ *
4588
+ * Take ready rows out of the send. Reversible with restore.
4589
+ */
4590
+ skip(parameters, options) {
4591
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
4592
+ return (options?.client ?? this.client).post({
4593
+ responseStyle: 'data',
4594
+ security: [{ scheme: 'bearer', type: 'http' }, {
4595
+ in: 'cookie',
4596
+ name: 'talqing_session',
4597
+ type: 'apiKey'
4598
+ }],
4599
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/skip',
4600
+ ...options,
4601
+ ...params,
4602
+ headers: {
4603
+ 'Content-Type': 'application/json',
4604
+ ...options?.headers,
4605
+ ...params.headers
4606
+ }
4607
+ });
4608
+ }
4609
+ /**
4610
+ * Patch Whatsapp Batch Recipient
4611
+ *
4612
+ * Edit cells on a row not yet sent, its phone included. An empty value clears the edit.
4613
+ */
4614
+ update(parameters, options) {
4615
+ const params = buildClientParams([parameters], [{ args: [
4616
+ { in: 'path', key: 'batch_id' },
4617
+ { in: 'path', key: 'recipient_id' },
4618
+ { key: 'patchWhatsAppRecipientRequest', map: 'body' }
4619
+ ] }]);
4620
+ return (options?.client ?? this.client).patch({
4621
+ responseStyle: 'data',
4622
+ security: [{ scheme: 'bearer', type: 'http' }, {
4623
+ in: 'cookie',
4624
+ name: 'talqing_session',
4625
+ type: 'apiKey'
4626
+ }],
4627
+ url: '/v1/whatsapp/batches/{batch_id}/recipients/{recipient_id}',
4628
+ ...options,
4629
+ ...params,
4630
+ headers: {
4631
+ 'Content-Type': 'application/json',
4632
+ ...options?.headers,
4633
+ ...params.headers
4634
+ }
4635
+ });
4636
+ }
4637
+ }
4638
+ export class Batches3 extends HeyApiClient {
4639
+ /**
4640
+ * List Whatsapp Batches
4641
+ *
4642
+ * List WhatsApp batches, newest first.
4643
+ */
4644
+ list(parameters, options) {
4645
+ const params = buildClientParams([parameters], [{ args: [
4646
+ { in: 'query', key: 'limit' },
4647
+ { in: 'query', key: 'offset' },
4648
+ { in: 'query', key: 'status' }
4649
+ ] }]);
4650
+ return (options?.client ?? this.client).get({
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',
4658
+ ...options,
4659
+ ...params
4660
+ });
4661
+ }
4662
+ /**
4663
+ * Create Whatsapp Batch
4664
+ *
4665
+ * Create a WhatsApp batch: one approved template, sent once per CSV row. Sends nothing yet.
4666
+ *
4667
+ * Only message people who opted in to hear from you on WhatsApp. A row with an
4668
+ * invalid or repeated phone, or a blank or line-broken mapped cell, is kept and
4669
+ * skipped with the reason. Replies go to the sender's assigned agent, which
4670
+ * sees the row's cells as `{{userdata.<column>}}`.
4671
+ */
4672
+ create(parameters, options) {
4673
+ const params = buildClientParams([parameters], [{ args: [{ key: 'createWhatsAppBatchRequest', map: 'body' }] }]);
4674
+ return (options?.client ?? this.client).post({
4675
+ responseStyle: 'data',
4676
+ security: [{ scheme: 'bearer', type: 'http' }, {
4677
+ in: 'cookie',
4678
+ name: 'talqing_session',
4679
+ type: 'apiKey'
4680
+ }],
4681
+ url: '/v1/whatsapp/batches',
4682
+ ...options,
4683
+ ...params,
4684
+ headers: {
4685
+ 'Content-Type': 'application/json',
4686
+ ...options?.headers,
4687
+ ...params.headers
4688
+ }
4689
+ });
4690
+ }
4691
+ /**
4692
+ * Delete Whatsapp Batch
4693
+ *
4694
+ * Delete a batch and its rows for good. A live batch must be canceled first.
4695
+ *
4696
+ * The conversations it started stay; its delivery and reply counts do not.
4697
+ */
4698
+ delete(parameters, options) {
4699
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4700
+ return (options?.client ?? this.client).delete({
4701
+ responseStyle: 'data',
4702
+ security: [{ scheme: 'bearer', type: 'http' }, {
4703
+ in: 'cookie',
4704
+ name: 'talqing_session',
4705
+ type: 'apiKey'
4706
+ }],
4707
+ url: '/v1/whatsapp/batches/{batch_id}',
4708
+ ...options,
4709
+ ...params
4710
+ });
4711
+ }
4712
+ /**
4713
+ * Get Whatsapp Batch
4714
+ *
4715
+ * One batch: its template, schedule and per-status counts, `replied` included.
4716
+ */
4717
+ get(parameters, options) {
4718
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4719
+ return (options?.client ?? this.client).get({
4720
+ responseStyle: 'data',
4721
+ security: [{ scheme: 'bearer', type: 'http' }, {
4722
+ in: 'cookie',
4723
+ name: 'talqing_session',
4724
+ type: 'apiKey'
4725
+ }],
4726
+ url: '/v1/whatsapp/batches/{batch_id}',
4727
+ ...options,
4728
+ ...params
4729
+ });
4730
+ }
4731
+ /**
4732
+ * Patch Whatsapp Batch
4733
+ *
4734
+ * Edit a batch. Pacing and the window reach a live send within minutes.
4735
+ *
4736
+ * `variable_map` changes only before sending, `start_at` only before it begins;
4737
+ * a finished batch takes `name` alone.
4738
+ */
4739
+ update(parameters, options) {
4740
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'patchWhatsAppBatchRequest', map: 'body' }] }]);
4741
+ return (options?.client ?? this.client).patch({
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/{batch_id}',
4749
+ ...options,
4750
+ ...params,
4751
+ headers: {
4752
+ 'Content-Type': 'application/json',
4753
+ ...options?.headers,
4754
+ ...params.headers
4755
+ }
4756
+ });
4757
+ }
4758
+ /**
4759
+ * Cancel Whatsapp Batch
4760
+ *
4761
+ * Stop for good. Messages already sent stay sent, and replies are still answered.
4762
+ */
4763
+ cancel(parameters, options) {
4764
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
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/{batch_id}/cancel',
4773
+ ...options,
4774
+ ...params
4775
+ });
4776
+ }
4777
+ /**
4778
+ * Pause Whatsapp Batch
4779
+ *
4780
+ * Stop sending before the next message. Nothing is lost.
4781
+ */
4782
+ pause(parameters, options) {
4783
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4784
+ return (options?.client ?? this.client).post({
4785
+ responseStyle: 'data',
4786
+ security: [{ scheme: 'bearer', type: 'http' }, {
4787
+ in: 'cookie',
4788
+ name: 'talqing_session',
4789
+ type: 'apiKey'
4790
+ }],
4791
+ url: '/v1/whatsapp/batches/{batch_id}/pause',
4792
+ ...options,
4793
+ ...params
4794
+ });
4795
+ }
4796
+ /**
4797
+ * Resume Whatsapp Batch
4798
+ *
4799
+ * Carry on sending from where the batch stopped.
4800
+ */
4801
+ resume(parameters, options) {
4802
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
4803
+ return (options?.client ?? this.client).post({
4804
+ responseStyle: 'data',
4805
+ security: [{ scheme: 'bearer', type: 'http' }, {
4806
+ in: 'cookie',
4807
+ name: 'talqing_session',
4808
+ type: 'apiKey'
4809
+ }],
4810
+ url: '/v1/whatsapp/batches/{batch_id}/resume',
4811
+ ...options,
4812
+ ...params
4813
+ });
4814
+ }
4815
+ /**
4816
+ * Send Whatsapp Batch
4817
+ *
4818
+ * Send every ready row. **This messages real people and cannot be undone.**
4819
+ *
4820
+ * `start_at` schedules it, `window` holds it to business hours, and
4821
+ * `send_daily_cap` (default 250, Meta's lowest tier) and `send_gap_seconds`
4822
+ * pace it.
4823
+ */
4824
+ send(parameters, options) {
4825
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'sendWhatsAppBatchRequest', map: 'body' }] }]);
4826
+ return (options?.client ?? this.client).post({
4827
+ responseStyle: 'data',
4828
+ security: [{ scheme: 'bearer', type: 'http' }, {
4829
+ in: 'cookie',
4830
+ name: 'talqing_session',
4831
+ type: 'apiKey'
4832
+ }],
4833
+ url: '/v1/whatsapp/batches/{batch_id}/send',
4834
+ ...options,
4835
+ ...params,
4836
+ headers: {
4837
+ 'Content-Type': 'application/json',
4838
+ ...options?.headers,
4839
+ ...params.headers
4840
+ }
4841
+ });
4842
+ }
4843
+ get recipients() {
4844
+ return this._recipients ?? (this._recipients = new Recipients3({ client: this.client }));
4845
+ }
4846
+ }
4847
+ export class Templates extends HeyApiClient {
4848
+ /**
4849
+ * List Whatsapp Templates
4850
+ *
4851
+ * List a WhatsApp sender's approved templates, read live from its BSP.
4852
+ *
4853
+ * One with `unsupported_reason` set cannot be sent from a batch.
4854
+ */
4855
+ list(parameters, options) {
4856
+ const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'integration_id' }] }]);
4857
+ return (options?.client ?? this.client).get({
4858
+ responseStyle: 'data',
4859
+ security: [{ scheme: 'bearer', type: 'http' }, {
4860
+ in: 'cookie',
4861
+ name: 'talqing_session',
4862
+ type: 'apiKey'
4863
+ }],
4864
+ url: '/v1/whatsapp/templates',
4865
+ ...options,
4866
+ ...params
4867
+ });
4868
+ }
4869
+ }
4870
+ export class TwilioSenders extends HeyApiClient {
4871
+ /**
4872
+ * List Twilio Whatsapp Senders
4873
+ *
4874
+ * List the WhatsApp senders on a Twilio account, before connecting one. Stores nothing.
4875
+ */
4876
+ list(parameters, options) {
4877
+ const params = buildClientParams([parameters], [{ args: [{ key: 'twilioSendersRequest', map: 'body' }] }]);
4878
+ return (options?.client ?? this.client).post({
4879
+ responseStyle: 'data',
4880
+ security: [{ scheme: 'bearer', type: 'http' }, {
4881
+ in: 'cookie',
4882
+ name: 'talqing_session',
4883
+ type: 'apiKey'
4884
+ }],
4885
+ url: '/v1/whatsapp/twilio-senders',
4886
+ ...options,
4887
+ ...params,
4888
+ headers: {
4889
+ 'Content-Type': 'application/json',
4890
+ ...options?.headers,
4891
+ ...params.headers
4892
+ }
4893
+ });
4894
+ }
4895
+ }
4896
+ export class Whatsapp extends HeyApiClient {
4897
+ get batches() {
4898
+ return this._batches ?? (this._batches = new Batches3({ client: this.client }));
4899
+ }
4900
+ get templates() {
4901
+ return this._templates ?? (this._templates = new Templates({ client: this.client }));
4902
+ }
4903
+ get twilioSenders() {
4904
+ return this._twilioSenders ?? (this._twilioSenders = new TwilioSenders({ client: this.client }));
4905
+ }
4906
+ }
4362
4907
  export class TalqingApi extends HeyApiClient {
4363
4908
  constructor(args) {
4364
4909
  super(args);
@@ -4396,6 +4941,9 @@ export class TalqingApi extends HeyApiClient {
4396
4941
  get catalog() {
4397
4942
  return this._catalog ?? (this._catalog = new Catalog({ client: this.client }));
4398
4943
  }
4944
+ get chats() {
4945
+ return this._chats ?? (this._chats = new Chats({ client: this.client }));
4946
+ }
4399
4947
  get conversations() {
4400
4948
  return this._conversations ?? (this._conversations = new Conversations({ client: this.client }));
4401
4949
  }
@@ -4432,6 +4980,9 @@ export class TalqingApi extends HeyApiClient {
4432
4980
  get webhooks() {
4433
4981
  return this._webhooks ?? (this._webhooks = new Webhooks({ client: this.client }));
4434
4982
  }
4983
+ get whatsapp() {
4984
+ return this._whatsapp ?? (this._whatsapp = new Whatsapp({ client: this.client }));
4985
+ }
4435
4986
  }
4436
4987
  TalqingApi.__registry = new HeyApiRegistry();
4437
4988
  //# sourceMappingURL=sdk.gen.js.map