@talqing/sdk 0.13.2 → 0.14.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.
@@ -1855,6 +1855,10 @@ export type CatalogResponse = {
1855
1855
  * Turn Detector Languages
1856
1856
  */
1857
1857
  turn_detector_languages: Array<LanguageOption>;
1858
+ /**
1859
+ * Whatsapp Template Languages
1860
+ */
1861
+ whatsapp_template_languages: Array<string>;
1858
1862
  };
1859
1863
  /**
1860
1864
  * ChatDetailResponse
@@ -3624,6 +3628,63 @@ export type CreateWhatsAppBatchRequest = {
3624
3628
  };
3625
3629
  window?: TimeWindow | null;
3626
3630
  };
3631
+ /**
3632
+ * CreateWhatsAppTemplateRequest
3633
+ */
3634
+ export type CreateWhatsAppTemplateRequest = {
3635
+ /**
3636
+ * Body
3637
+ *
3638
+ * Variables are named: `{{first_name}}`.
3639
+ */
3640
+ body: string;
3641
+ /**
3642
+ * Buttons
3643
+ */
3644
+ buttons?: Array<WhatsAppTemplateQuickReplyButtonInput | WhatsAppTemplateUrlButtonInput | WhatsAppTemplatePhoneButtonInput | WhatsAppTemplateVoiceCallButtonInput | WhatsAppTemplateCopyCodeButtonInput>;
3645
+ /**
3646
+ * Category
3647
+ */
3648
+ category: 'marketing' | 'utility';
3649
+ /**
3650
+ * Examples
3651
+ *
3652
+ * A realistic sample for every variable; WhatsApp reviews them.
3653
+ */
3654
+ examples?: {
3655
+ [key: string]: string;
3656
+ };
3657
+ /**
3658
+ * Footer
3659
+ */
3660
+ footer?: string | null;
3661
+ /**
3662
+ * Header
3663
+ */
3664
+ header?: ({
3665
+ type: 'text';
3666
+ } & WhatsAppTemplateTextHeaderInput) | ({
3667
+ type: 'document' | 'image' | 'video';
3668
+ } & WhatsAppTemplateMediaHeaderInput) | null;
3669
+ /**
3670
+ * Integration Id
3671
+ *
3672
+ * A Twilio WhatsApp sender; the template is account-wide.
3673
+ */
3674
+ integration_id: string;
3675
+ /**
3676
+ * Language
3677
+ *
3678
+ * One of the catalog's `whatsapp_template_languages`.
3679
+ */
3680
+ language: string;
3681
+ /**
3682
+ * Name
3683
+ *
3684
+ * Lowercase letters, digits and `_`.
3685
+ */
3686
+ name: string;
3687
+ };
3627
3688
  /**
3628
3689
  * CreditBalanceResponse
3629
3690
  *
@@ -13222,7 +13283,7 @@ export type WhatsAppBatchResponse = {
13222
13283
  * Status
13223
13284
  */
13224
13285
  status: 'draft' | 'scheduled' | 'sending' | 'paused' | 'completed' | 'canceled' | 'failed';
13225
- template: WhatsAppTemplate;
13286
+ template: WhatsAppTemplateSnapshot;
13226
13287
  /**
13227
13288
  * Timezone
13228
13289
  */
@@ -13340,7 +13401,7 @@ export type WhatsAppRecipientResponse = {
13340
13401
  /**
13341
13402
  * WhatsAppTemplate
13342
13403
  *
13343
- * The whole message: header, body, footer and buttons.
13404
+ * A template and where WhatsApp's review of it stands. Only `approved` can be sent.
13344
13405
  */
13345
13406
  export type WhatsAppTemplate = {
13346
13407
  /**
@@ -13354,7 +13415,17 @@ export type WhatsAppTemplate = {
13354
13415
  /**
13355
13416
  * Category
13356
13417
  */
13357
- category: string;
13418
+ category: 'marketing' | 'utility' | 'authentication';
13419
+ /**
13420
+ * Created At
13421
+ */
13422
+ created_at: string;
13423
+ /**
13424
+ * Examples
13425
+ */
13426
+ examples: {
13427
+ [key: string]: string;
13428
+ };
13358
13429
  /**
13359
13430
  * Footer
13360
13431
  */
@@ -13372,6 +13443,14 @@ export type WhatsAppTemplate = {
13372
13443
  * Name
13373
13444
  */
13374
13445
  name: string;
13446
+ /**
13447
+ * Rejection Reason
13448
+ */
13449
+ rejection_reason: string | null;
13450
+ /**
13451
+ * Status
13452
+ */
13453
+ status: 'pending' | 'approved' | 'rejected' | 'paused' | 'disabled';
13375
13454
  /**
13376
13455
  * Unsupported Reason
13377
13456
  */
@@ -13397,6 +13476,10 @@ export type WhatsAppTemplateButton = {
13397
13476
  * Text
13398
13477
  */
13399
13478
  text: string;
13479
+ /**
13480
+ * Ttl Minutes
13481
+ */
13482
+ ttl_minutes: number | null;
13400
13483
  /**
13401
13484
  * Type
13402
13485
  */
@@ -13406,6 +13489,21 @@ export type WhatsAppTemplateButton = {
13406
13489
  */
13407
13490
  url: string | null;
13408
13491
  };
13492
+ /**
13493
+ * WhatsAppTemplateCopyCodeButtonInput
13494
+ *
13495
+ * WhatsApp labels it "Copy Code".
13496
+ */
13497
+ export type WhatsAppTemplateCopyCodeButtonInput = {
13498
+ /**
13499
+ * Code
13500
+ */
13501
+ code: string;
13502
+ /**
13503
+ * Type
13504
+ */
13505
+ type: 'copy_code';
13506
+ };
13409
13507
  /**
13410
13508
  * WhatsAppTemplateHeader
13411
13509
  */
@@ -13423,6 +13521,144 @@ export type WhatsAppTemplateHeader = {
13423
13521
  */
13424
13522
  url: string | null;
13425
13523
  };
13524
+ /**
13525
+ * WhatsAppTemplateMediaHeaderInput
13526
+ */
13527
+ export type WhatsAppTemplateMediaHeaderInput = {
13528
+ /**
13529
+ * Type
13530
+ */
13531
+ type: 'image' | 'video' | 'document';
13532
+ /**
13533
+ * Url
13534
+ *
13535
+ * A public https file; WhatsApp downloads it.
13536
+ */
13537
+ url: string;
13538
+ };
13539
+ /**
13540
+ * WhatsAppTemplatePhoneButtonInput
13541
+ */
13542
+ export type WhatsAppTemplatePhoneButtonInput = {
13543
+ /**
13544
+ * Phone Number
13545
+ */
13546
+ phone_number: string;
13547
+ /**
13548
+ * Text
13549
+ */
13550
+ text: string;
13551
+ /**
13552
+ * Type
13553
+ */
13554
+ type: 'phone_number';
13555
+ };
13556
+ /**
13557
+ * WhatsAppTemplateQuickReplyButtonInput
13558
+ */
13559
+ export type WhatsAppTemplateQuickReplyButtonInput = {
13560
+ /**
13561
+ * Text
13562
+ */
13563
+ text: string;
13564
+ /**
13565
+ * Type
13566
+ */
13567
+ type: 'quick_reply';
13568
+ };
13569
+ /**
13570
+ * WhatsAppTemplateSnapshot
13571
+ *
13572
+ * The whole message as a batch sends it: header, body, footer and buttons.
13573
+ */
13574
+ export type WhatsAppTemplateSnapshot = {
13575
+ /**
13576
+ * Body
13577
+ */
13578
+ body: string;
13579
+ /**
13580
+ * Buttons
13581
+ */
13582
+ buttons: Array<WhatsAppTemplateButton>;
13583
+ /**
13584
+ * Category
13585
+ */
13586
+ category: 'marketing' | 'utility' | 'authentication';
13587
+ /**
13588
+ * Footer
13589
+ */
13590
+ footer: string | null;
13591
+ header: WhatsAppTemplateHeader | null;
13592
+ /**
13593
+ * Id
13594
+ */
13595
+ id: string;
13596
+ /**
13597
+ * Language
13598
+ */
13599
+ language: string;
13600
+ /**
13601
+ * Name
13602
+ */
13603
+ name: string;
13604
+ /**
13605
+ * Variables
13606
+ */
13607
+ variables: Array<string>;
13608
+ };
13609
+ /**
13610
+ * WhatsAppTemplateTextHeaderInput
13611
+ */
13612
+ export type WhatsAppTemplateTextHeaderInput = {
13613
+ /**
13614
+ * Text
13615
+ */
13616
+ text: string;
13617
+ /**
13618
+ * Type
13619
+ */
13620
+ type: 'text';
13621
+ };
13622
+ /**
13623
+ * WhatsAppTemplateUrlButtonInput
13624
+ */
13625
+ export type WhatsAppTemplateUrlButtonInput = {
13626
+ /**
13627
+ * Text
13628
+ */
13629
+ text: string;
13630
+ /**
13631
+ * Type
13632
+ */
13633
+ type: 'url';
13634
+ /**
13635
+ * Url
13636
+ *
13637
+ * May end in one variable, after a `/`.
13638
+ */
13639
+ url: string;
13640
+ };
13641
+ /**
13642
+ * WhatsAppTemplateVoiceCallButtonInput
13643
+ *
13644
+ * Starts a WhatsApp call to the sending number.
13645
+ */
13646
+ export type WhatsAppTemplateVoiceCallButtonInput = {
13647
+ /**
13648
+ * Text
13649
+ */
13650
+ text: string;
13651
+ /**
13652
+ * Ttl Minutes
13653
+ *
13654
+ * How long the button works after sending. Default 7 days.
13655
+ */
13656
+ ttl_minutes?: number | null;
13657
+ /**
13658
+ * Type
13659
+ */
13660
+ type: 'voice_call';
13661
+ };
13426
13662
  /**
13427
13663
  * WhatsAppTemplatesResponse
13428
13664
  */
@@ -22164,6 +22400,10 @@ export type WhatsappTemplatesListData = {
22164
22400
  * A connected WhatsApp sender.
22165
22401
  */
22166
22402
  integration_id: string;
22403
+ /**
22404
+ * Status
22405
+ */
22406
+ status?: Array<'pending' | 'approved' | 'rejected' | 'paused' | 'disabled'> | null;
22167
22407
  };
22168
22408
  url: '/v1/whatsapp/templates';
22169
22409
  };
@@ -22189,6 +22429,102 @@ export type WhatsappTemplatesListResults = {
22189
22429
  200: WhatsAppTemplatesResponse;
22190
22430
  };
22191
22431
  export type WhatsappTemplatesListResult = WhatsappTemplatesListResults[keyof WhatsappTemplatesListResults];
22432
+ export type WhatsappTemplatesCreateData = {
22433
+ body: CreateWhatsAppTemplateRequest;
22434
+ path?: never;
22435
+ query?: never;
22436
+ url: '/v1/whatsapp/templates';
22437
+ };
22438
+ export type WhatsappTemplatesCreateErrors = {
22439
+ /**
22440
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
22441
+ */
22442
+ 400: ErrorResponse;
22443
+ /**
22444
+ * Missing credential, or one that is revoked or no longer a member of this organization.
22445
+ */
22446
+ 401: ErrorResponse;
22447
+ /**
22448
+ * Authenticated, but this organization role may not perform the operation.
22449
+ */
22450
+ 403: ErrorResponse;
22451
+ /**
22452
+ * The resource's current state forbids this — a name already taken, a job already running.
22453
+ */
22454
+ 409: ErrorResponse;
22455
+ /**
22456
+ * The request did not match this operation's schema; `detail.errors` lists each field.
22457
+ */
22458
+ 422: ErrorResponse;
22459
+ /**
22460
+ * Unexpected error. Every error this API returns carries this body.
22461
+ */
22462
+ default: ErrorResponse;
22463
+ };
22464
+ export type WhatsappTemplatesCreateError = WhatsappTemplatesCreateErrors[keyof WhatsappTemplatesCreateErrors];
22465
+ export type WhatsappTemplatesCreateResults = {
22466
+ /**
22467
+ * Successful Response
22468
+ */
22469
+ 201: WhatsAppTemplate;
22470
+ };
22471
+ export type WhatsappTemplatesCreateResult = WhatsappTemplatesCreateResults[keyof WhatsappTemplatesCreateResults];
22472
+ export type WhatsappTemplatesDeleteData = {
22473
+ body?: never;
22474
+ path: {
22475
+ /**
22476
+ * Template Id
22477
+ */
22478
+ template_id: string;
22479
+ };
22480
+ query: {
22481
+ /**
22482
+ * Integration Id
22483
+ *
22484
+ * A WhatsApp sender on the template's account.
22485
+ */
22486
+ integration_id: string;
22487
+ };
22488
+ url: '/v1/whatsapp/templates/{template_id}';
22489
+ };
22490
+ export type WhatsappTemplatesDeleteErrors = {
22491
+ /**
22492
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
22493
+ */
22494
+ 400: ErrorResponse;
22495
+ /**
22496
+ * Missing credential, or one that is revoked or no longer a member of this organization.
22497
+ */
22498
+ 401: ErrorResponse;
22499
+ /**
22500
+ * Authenticated, but this organization role may not perform the operation.
22501
+ */
22502
+ 403: ErrorResponse;
22503
+ /**
22504
+ * No such resource in this organization.
22505
+ */
22506
+ 404: ErrorResponse;
22507
+ /**
22508
+ * The resource's current state forbids this — a name already taken, a job already running.
22509
+ */
22510
+ 409: ErrorResponse;
22511
+ /**
22512
+ * The request did not match this operation's schema; `detail.errors` lists each field.
22513
+ */
22514
+ 422: ErrorResponse;
22515
+ /**
22516
+ * Unexpected error. Every error this API returns carries this body.
22517
+ */
22518
+ default: ErrorResponse;
22519
+ };
22520
+ export type WhatsappTemplatesDeleteError = WhatsappTemplatesDeleteErrors[keyof WhatsappTemplatesDeleteErrors];
22521
+ export type WhatsappTemplatesDeleteResults = {
22522
+ /**
22523
+ * Successful Response
22524
+ */
22525
+ 200: OkResponse;
22526
+ };
22527
+ export type WhatsappTemplatesDeleteResult = WhatsappTemplatesDeleteResults[keyof WhatsappTemplatesDeleteResults];
22192
22528
  export type WhatsappTwilioSendersListData = {
22193
22529
  body: TwilioSendersRequest;
22194
22530
  path?: never;