getricky 0.1.10 → 0.1.11

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.
@@ -734,6 +734,19 @@ export type BroadcastRecipient = {
734
734
  */
735
735
  status_updated_at: string | null;
736
736
  };
737
+ /**
738
+ * How many numbers an audience resolves to now.
739
+ */
740
+ export type BroadcastAudiencePreview = {
741
+ /**
742
+ * Numbers a broadcast to this audience would go to now, at most 5,000.
743
+ */
744
+ recipients: number;
745
+ /**
746
+ * Contacts or numbers left out because they have no valid WhatsApp number.
747
+ */
748
+ skipped: number;
749
+ };
737
750
  /**
738
751
  * A branch or place the agents can send as a WhatsApp location.
739
752
  */
@@ -2264,111 +2277,146 @@ export type ResolutionsReport = {
2264
2277
  generated_at: string;
2265
2278
  };
2266
2279
  /**
2267
- * The result of checking a template draft without submitting it.
2280
+ * The Odoo appointments a reminder workflow would message on a coming day.
2268
2281
  */
2269
- export type TemplateValidation = {
2282
+ export type ReminderPreview = {
2270
2283
  /**
2271
- * Whether `POST /templates` would submit this draft to Meta.
2284
+ * Day the workflow sends these reminders, in its time zone.
2272
2285
  */
2273
- valid: boolean;
2286
+ date: string;
2274
2287
  /**
2275
- * Every problem found; empty when the draft is valid.
2288
+ * IANA time zone of the workflow.
2276
2289
  */
2277
- errors: Array<{
2290
+ timezone: string;
2291
+ /**
2292
+ * When Ricky read the appointments from Odoo.
2293
+ */
2294
+ checked_at: string;
2295
+ /**
2296
+ * Every appointment state the Odoo installation has.
2297
+ */
2298
+ appointment_states: Array<{
2278
2299
  /**
2279
- * The request field the problem is in.
2300
+ * State as Odoo stores it.
2280
2301
  */
2281
- param: string;
2302
+ value: string;
2282
2303
  /**
2283
- * What to change.
2304
+ * State as Odoo shows it.
2284
2305
  */
2285
- message: string;
2306
+ label: string;
2286
2307
  }>;
2287
2308
  /**
2288
- * The components Ricky would submit, in the WhatsApp Cloud API format; null when the draft is invalid.
2289
- */
2290
- components: Array<{
2291
- [key: string]: unknown;
2292
- }> | null;
2293
- };
2294
- /**
2295
- * A template Meta deleted.
2296
- */
2297
- export type DeletedTemplate = {
2298
- /**
2299
- * Template ID at Meta.
2309
+ * Each appointment of that day in Odoo, in start order.
2300
2310
  */
2301
- id: string;
2302
- deleted: true;
2311
+ reminders: Array<{
2312
+ /**
2313
+ * Appointment ID in Odoo.
2314
+ */
2315
+ appointment_id: string;
2316
+ /**
2317
+ * Appointment state in Odoo.
2318
+ */
2319
+ appointment_state: string;
2320
+ /**
2321
+ * Customer first name in Odoo.
2322
+ */
2323
+ customer_first_name: string | null;
2324
+ /**
2325
+ * Phone in Odoo.
2326
+ */
2327
+ phone: string | null;
2328
+ /**
2329
+ * Branch in Odoo.
2330
+ */
2331
+ branch_name: string | null;
2332
+ /**
2333
+ * When the appointment starts.
2334
+ */
2335
+ starts_at: string;
2336
+ /**
2337
+ * Why it is not sent: its Odoo state is not one the workflow reminds (`state`), or it has no customer name (`name`), branch (`branch`) or valid phone (`phone`); null when it is sent.
2338
+ */
2339
+ excluded_because: 'state' | 'name' | 'branch' | 'phone' | null;
2340
+ /**
2341
+ * The message the template would send, with this appointment’s values.
2342
+ */
2343
+ message: string;
2344
+ /**
2345
+ * The send already recorded for this appointment and day; null if none.
2346
+ */
2347
+ delivery: {
2348
+ /**
2349
+ * `pending` or `processing` while queued; `accepted` once WhatsApp took it; then `sent`, `delivered` and `read` as WhatsApp reports them; `failed` for good; `superseded` when a newer send replaced it; `unknown` when Ricky cannot tell.
2350
+ */
2351
+ status: 'pending' | 'processing' | 'accepted' | 'sent' | 'delivered' | 'read' | 'failed' | 'superseded' | 'unknown';
2352
+ /**
2353
+ * Why it failed; null otherwise.
2354
+ */
2355
+ error: string | null;
2356
+ } | null;
2357
+ }>;
2303
2358
  };
2304
2359
  /**
2305
- * A WhatsApp number, with its status, quality and messaging limit at Meta.
2360
+ * What a reminder workflow checked and sent on a past day.
2306
2361
  */
2307
- export type WhatsAppNumber = {
2308
- /**
2309
- * Channel ID.
2310
- */
2311
- id: string;
2312
- /**
2313
- * Name shown in Ricky.
2314
- */
2315
- name: string;
2316
- /**
2317
- * Phone in E.164.
2318
- */
2319
- phone_number: string | null;
2320
- /**
2321
- * Business name Meta approved for the number.
2322
- */
2323
- verified_name: string | null;
2324
- /**
2325
- * Phone number ID at Meta.
2326
- */
2327
- phone_number_id: string | null;
2328
- /**
2329
- * WhatsApp Business Account that owns the number.
2330
- */
2331
- whatsapp_business_account_id: string | null;
2332
- /**
2333
- * `coexistence` when the number also stays on the WhatsApp Business app; `dedicated` otherwise.
2334
- */
2335
- connection_mode: 'dedicated' | 'coexistence' | null;
2336
- /**
2337
- * Status of the number at Meta, as Meta reports it, for example `CONNECTED`.
2338
- */
2339
- status: string | null;
2340
- /**
2341
- * When the number was disconnected from Ricky; null while connected.
2342
- */
2343
- disconnected_at: string | null;
2344
- /**
2345
- * Whether Meta lets the number send: `available`, `limited` or `blocked`.
2346
- */
2347
- messaging_health: 'available' | 'limited' | 'blocked';
2348
- /**
2349
- * Quality rating at Meta: `green`, `yellow`, `red`, `not_yet_determined` or `unknown`.
2350
- */
2351
- quality_rating: string | null;
2352
- /**
2353
- * Messaging limit tier at Meta, for example `TIER_1K` or `TIER_UNLIMITED`; `UNKNOWN` when Meta has not reported it.
2354
- */
2355
- messaging_limit: string | null;
2362
+ export type ReminderHistory = {
2356
2363
  /**
2357
- * Whether Ricky receives the messages sent to the number.
2364
+ * Day the workflow ran, in its time zone.
2358
2365
  */
2359
- inbound_processing_enabled: boolean | null;
2366
+ date: string;
2360
2367
  /**
2361
- * Whether customers can call the number and reach the AI agent.
2368
+ * IANA time zone of the workflow.
2362
2369
  */
2363
- calls_enabled: boolean | null;
2370
+ timezone: string;
2364
2371
  /**
2365
- * When it was connected.
2372
+ * Times the workflow checked Odoo that day; 0 for days before Ricky recorded them.
2366
2373
  */
2367
- connected_at: string | null;
2374
+ evaluations_recorded: number;
2368
2375
  /**
2369
- * When Ricky last read its details from Meta.
2376
+ * Each appointment the workflow checked or sent that day, oldest first.
2370
2377
  */
2371
- last_synced_at: string | null;
2378
+ reminders: Array<{
2379
+ /**
2380
+ * Customer first name in Odoo.
2381
+ */
2382
+ customer_first_name: string | null;
2383
+ /**
2384
+ * Phone in Odoo.
2385
+ */
2386
+ phone: string | null;
2387
+ /**
2388
+ * Branch in Odoo.
2389
+ */
2390
+ branch_name: string | null;
2391
+ /**
2392
+ * When the appointment started; null if not recorded.
2393
+ */
2394
+ starts_at: string | null;
2395
+ /**
2396
+ * Why it is not sent: its Odoo state is not one the workflow reminds (`state`), or it has no customer name (`name`), branch (`branch`) or valid phone (`phone`); null when it is sent.
2397
+ */
2398
+ excluded_because: 'state' | 'name' | 'branch' | 'phone' | null;
2399
+ /**
2400
+ * The message sent; null when nothing was sent.
2401
+ */
2402
+ message: string | null;
2403
+ /**
2404
+ * When the workflow last checked the appointment before sending; null if not recorded.
2405
+ */
2406
+ evaluated_at: string | null;
2407
+ /**
2408
+ * When the send was queued; null when nothing was sent.
2409
+ */
2410
+ queued_at: string | null;
2411
+ /**
2412
+ * Where the send stands, with the values of a preview’s `delivery.status`; null when nothing was sent.
2413
+ */
2414
+ status: 'pending' | 'processing' | 'accepted' | 'sent' | 'delivered' | 'read' | 'failed' | 'superseded' | 'unknown' | null;
2415
+ /**
2416
+ * Why it failed; null otherwise.
2417
+ */
2418
+ error: string | null;
2419
+ }>;
2372
2420
  };
2373
2421
  /**
2374
2422
  * An automation Ricky runs for the organization.
@@ -2693,6 +2741,113 @@ export type WorkflowExecution = {
2693
2741
  */
2694
2742
  processed_at: string | null;
2695
2743
  };
2744
+ /**
2745
+ * The result of checking a template draft without submitting it.
2746
+ */
2747
+ export type TemplateValidation = {
2748
+ /**
2749
+ * Whether `POST /templates` would submit this draft to Meta.
2750
+ */
2751
+ valid: boolean;
2752
+ /**
2753
+ * Every problem found; empty when the draft is valid.
2754
+ */
2755
+ errors: Array<{
2756
+ /**
2757
+ * The request field the problem is in.
2758
+ */
2759
+ param: string;
2760
+ /**
2761
+ * What to change.
2762
+ */
2763
+ message: string;
2764
+ }>;
2765
+ /**
2766
+ * The components Ricky would submit, in the WhatsApp Cloud API format; null when the draft is invalid.
2767
+ */
2768
+ components: Array<{
2769
+ [key: string]: unknown;
2770
+ }> | null;
2771
+ };
2772
+ /**
2773
+ * A template Meta deleted.
2774
+ */
2775
+ export type DeletedTemplate = {
2776
+ /**
2777
+ * Template ID at Meta.
2778
+ */
2779
+ id: string;
2780
+ deleted: true;
2781
+ };
2782
+ /**
2783
+ * A WhatsApp number, with its status, quality and messaging limit at Meta.
2784
+ */
2785
+ export type WhatsAppNumber = {
2786
+ /**
2787
+ * Channel ID.
2788
+ */
2789
+ id: string;
2790
+ /**
2791
+ * Name shown in Ricky.
2792
+ */
2793
+ name: string;
2794
+ /**
2795
+ * Phone in E.164.
2796
+ */
2797
+ phone_number: string | null;
2798
+ /**
2799
+ * Business name Meta approved for the number.
2800
+ */
2801
+ verified_name: string | null;
2802
+ /**
2803
+ * Phone number ID at Meta.
2804
+ */
2805
+ phone_number_id: string | null;
2806
+ /**
2807
+ * WhatsApp Business Account that owns the number.
2808
+ */
2809
+ whatsapp_business_account_id: string | null;
2810
+ /**
2811
+ * `coexistence` when the number also stays on the WhatsApp Business app; `dedicated` otherwise.
2812
+ */
2813
+ connection_mode: 'dedicated' | 'coexistence' | null;
2814
+ /**
2815
+ * Status of the number at Meta, as Meta reports it, for example `CONNECTED`.
2816
+ */
2817
+ status: string | null;
2818
+ /**
2819
+ * When the number was disconnected from Ricky; null while connected.
2820
+ */
2821
+ disconnected_at: string | null;
2822
+ /**
2823
+ * Whether Meta lets the number send: `available`, `limited` or `blocked`.
2824
+ */
2825
+ messaging_health: 'available' | 'limited' | 'blocked';
2826
+ /**
2827
+ * Quality rating at Meta: `green`, `yellow`, `red`, `not_yet_determined` or `unknown`.
2828
+ */
2829
+ quality_rating: string | null;
2830
+ /**
2831
+ * Messaging limit tier at Meta, for example `TIER_1K` or `TIER_UNLIMITED`; `UNKNOWN` when Meta has not reported it.
2832
+ */
2833
+ messaging_limit: string | null;
2834
+ /**
2835
+ * Whether Ricky receives the messages sent to the number.
2836
+ */
2837
+ inbound_processing_enabled: boolean | null;
2838
+ /**
2839
+ * Whether customers can call the number and reach the AI agent.
2840
+ */
2841
+ calls_enabled: boolean | null;
2842
+ /**
2843
+ * When it was connected.
2844
+ */
2845
+ connected_at: string | null;
2846
+ /**
2847
+ * When Ricky last read its details from Meta.
2848
+ */
2849
+ last_synced_at: string | null;
2850
+ };
2696
2851
  /**
2697
2852
  * Only `name` is required; it does not connect the agent to any channel.
2698
2853
  */
@@ -3180,16 +3335,80 @@ export type CreateBroadcast = {
3180
3335
  phones: Array<string>;
3181
3336
  };
3182
3337
  /**
3183
- * When to start sending, up to 7 days ahead. Omit it to send now.
3338
+ * Fills template variables per recipient from their contact, as the broadcast composer does. Ricky saves them on the template, replacing the ones it had, so later broadcasts of the template use them too; omit it to keep the saved ones, send `[]` to clear them. A recipient without a contact, or without a value in the field, receives the text you sent in `template.components`.
3184
3339
  */
3185
- scheduled_at?: string;
3186
- };
3187
- /**
3188
- * Adds and removes the same tags on many contacts. Their other tags stay.
3189
- */
3190
- export type ChangeContactsTags = {
3191
- /**
3192
- * Contacts to change, up to 100. Repeated IDs count once.
3340
+ mappings?: Array<{
3341
+ /**
3342
+ * Where the variable is: the header, the body, or a URL button.
3343
+ */
3344
+ component: 'header' | 'body' | 'button';
3345
+ /**
3346
+ * The variable: its number (`1`) or its name in a header or body; for a button, the button’s index (`0`).
3347
+ */
3348
+ key: string;
3349
+ /**
3350
+ * Where each recipient’s value comes from.
3351
+ */
3352
+ source: {
3353
+ type: 'contact';
3354
+ /**
3355
+ * A field of the contact.
3356
+ */
3357
+ field: 'birthday' | 'city' | 'company' | 'country' | 'first_name' | 'job_title' | 'last_name' | 'lead_status' | 'lifecycle_stage' | 'linkedin_url' | 'notes' | 'postal_code' | 'primary_email' | 'primary_phone' | 'region' | 'source' | 'street_address' | 'website_url';
3358
+ } | {
3359
+ type: 'custom_field';
3360
+ /**
3361
+ * A custom contact field. See `GET /contact-fields`.
3362
+ */
3363
+ field_id: string;
3364
+ };
3365
+ }>;
3366
+ /**
3367
+ * When to start sending, up to 7 days ahead. Omit it to send now.
3368
+ */
3369
+ scheduled_at?: string;
3370
+ };
3371
+ /**
3372
+ * The audience to count, as you would send it to `POST /broadcasts`.
3373
+ */
3374
+ export type PreviewBroadcastAudience = {
3375
+ /**
3376
+ * Who receives it. `filter` takes every contact matching all the filters you send (no filter: every contact); `contacts` and `phones` take the ones you list. Ricky uses each contact’s phone, or its WhatsApp number, skips contacts without one and sends once per number, up to 5,000.
3377
+ */
3378
+ audience: {
3379
+ type: 'filter';
3380
+ /**
3381
+ * Only contacts with this tag.
3382
+ */
3383
+ tag_id?: string;
3384
+ /**
3385
+ * Only contacts at this stage.
3386
+ */
3387
+ lifecycle_stage?: 'subscriber' | 'lead' | 'marketing_qualified' | 'sales_qualified' | 'opportunity' | 'customer' | 'evangelist' | 'other';
3388
+ /**
3389
+ * Only contacts whose name, phone, email or company contains it.
3390
+ */
3391
+ query?: string;
3392
+ } | {
3393
+ type: 'contacts';
3394
+ /**
3395
+ * Contacts of the organization.
3396
+ */
3397
+ contact_ids: Array<string>;
3398
+ } | {
3399
+ type: 'phones';
3400
+ /**
3401
+ * Numbers with country code, for example `+50760001234`.
3402
+ */
3403
+ phones: Array<string>;
3404
+ };
3405
+ };
3406
+ /**
3407
+ * Adds and removes the same tags on many contacts. Their other tags stay.
3408
+ */
3409
+ export type ChangeContactsTags = {
3410
+ /**
3411
+ * Contacts to change, up to 100. Repeated IDs count once.
3193
3412
  */
3194
3413
  contact_ids: Array<string>;
3195
3414
  /**
@@ -3543,243 +3762,17 @@ export type UpdateKnowledgeFile = {
3543
3762
  send_enabled?: boolean;
3544
3763
  };
3545
3764
  /**
3546
- * A template draft. Ricky checks it as `POST /templates/validate` does, then submits it.
3547
- */
3548
- export type CreateTemplate = {
3549
- /**
3550
- * WhatsApp channel whose business account will own the template.
3551
- */
3552
- channel_id: string;
3553
- /**
3554
- * Lowercase letters, digits and underscores, starting with a letter.
3555
- */
3556
- name: string;
3557
- /**
3558
- * Language code, for example `es` or `en_US`.
3559
- */
3560
- language: string;
3561
- /**
3562
- * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
3563
- */
3564
- category: 'MARKETING' | 'UTILITY';
3565
- /**
3566
- * How variables are written: `{{first_name}}` or `{{1}}`. It cannot change later.
3567
- */
3568
- parameter_format?: 'NAMED' | 'POSITIONAL';
3569
- /**
3570
- * `TEXT` or `LOCATION`. Send `null` for no header.
3571
- */
3572
- header?: {
3573
- type: 'TEXT';
3574
- /**
3575
- * Header text; at most one variable.
3576
- */
3577
- text: string;
3578
- /**
3579
- * Example value of the header variable; required when it has one.
3580
- */
3581
- example?: string;
3582
- } | {
3583
- type: 'LOCATION';
3584
- } | null;
3585
- /**
3586
- * The message text.
3587
- */
3588
- body: {
3589
- /**
3590
- * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
3591
- */
3592
- text: string;
3593
- /**
3594
- * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
3595
- */
3596
- examples?: {
3597
- [key: string]: string;
3598
- };
3599
- };
3600
- /**
3601
- * Footer text, without variables.
3602
- */
3603
- footer?: string | null;
3604
- /**
3605
- * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
3606
- */
3607
- buttons?: Array<{
3608
- type: 'QUICK_REPLY';
3609
- text: string;
3610
- } | {
3611
- type: 'URL';
3612
- text: string;
3613
- /**
3614
- * Link the button opens; it may end in the variable `{{1}}`.
3615
- */
3616
- url: string;
3617
- /**
3618
- * Example URL for a link with `{{1}}`; required when it has one.
3619
- */
3620
- example?: string;
3621
- } | {
3622
- type: 'PHONE_NUMBER';
3623
- text: string;
3624
- /**
3625
- * Phone the button calls, with country code.
3626
- */
3627
- phone_number: string;
3628
- }>;
3629
- };
3630
- /**
3631
- * The body of `POST /templates`; `channel_id` is optional here.
3632
- */
3633
- export type ValidateTemplate = {
3634
- /**
3635
- * WhatsApp channel whose business account will own the template.
3636
- */
3637
- channel_id?: string;
3638
- /**
3639
- * Lowercase letters, digits and underscores, starting with a letter.
3640
- */
3641
- name: string;
3642
- /**
3643
- * Language code, for example `es` or `en_US`.
3644
- */
3645
- language: string;
3646
- /**
3647
- * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
3648
- */
3649
- category: 'MARKETING' | 'UTILITY';
3650
- /**
3651
- * How variables are written: `{{first_name}}` or `{{1}}`. It cannot change later.
3652
- */
3653
- parameter_format?: 'NAMED' | 'POSITIONAL';
3654
- /**
3655
- * `TEXT` or `LOCATION`. Send `null` for no header.
3656
- */
3657
- header?: {
3658
- type: 'TEXT';
3659
- /**
3660
- * Header text; at most one variable.
3661
- */
3662
- text: string;
3663
- /**
3664
- * Example value of the header variable; required when it has one.
3665
- */
3666
- example?: string;
3667
- } | {
3668
- type: 'LOCATION';
3669
- } | null;
3670
- /**
3671
- * The message text.
3672
- */
3673
- body: {
3674
- /**
3675
- * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
3676
- */
3677
- text: string;
3678
- /**
3679
- * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
3680
- */
3681
- examples?: {
3682
- [key: string]: string;
3683
- };
3684
- };
3685
- /**
3686
- * Footer text, without variables.
3687
- */
3688
- footer?: string | null;
3689
- /**
3690
- * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
3691
- */
3692
- buttons?: Array<{
3693
- type: 'QUICK_REPLY';
3694
- text: string;
3695
- } | {
3696
- type: 'URL';
3697
- text: string;
3698
- /**
3699
- * Link the button opens; it may end in the variable `{{1}}`.
3700
- */
3701
- url: string;
3702
- /**
3703
- * Example URL for a link with `{{1}}`; required when it has one.
3704
- */
3705
- example?: string;
3706
- } | {
3707
- type: 'PHONE_NUMBER';
3708
- text: string;
3709
- /**
3710
- * Phone the button calls, with country code.
3711
- */
3712
- phone_number: string;
3713
- }>;
3714
- };
3715
- /**
3716
- * Only the parts you send change; `buttons` replaces every button. Name, language and `parameter_format` cannot change.
3765
+ * The file every send of the workflow carries in its template header.
3717
3766
  */
3718
- export type UpdateTemplate = {
3719
- /**
3720
- * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
3721
- */
3722
- category?: 'MARKETING' | 'UTILITY';
3723
- /**
3724
- * `TEXT` or `LOCATION`. Send `null` for no header.
3725
- */
3726
- header?: {
3727
- type: 'TEXT';
3728
- /**
3729
- * Header text; at most one variable.
3730
- */
3731
- text: string;
3732
- /**
3733
- * Example value of the header variable; required when it has one.
3734
- */
3735
- example?: string;
3736
- } | {
3737
- type: 'LOCATION';
3738
- } | null;
3767
+ export type UploadWorkflowHeaderMedia = {
3739
3768
  /**
3740
- * The message text.
3769
+ * Public HTTPS address Ricky downloads the file from. It must not redirect or resolve to a private address, and its `Content-Type` must be the kind the template header takes (image, video or document) within WhatsApp’s size limit for it.
3741
3770
  */
3742
- body?: {
3743
- /**
3744
- * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
3745
- */
3746
- text: string;
3747
- /**
3748
- * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
3749
- */
3750
- examples?: {
3751
- [key: string]: string;
3752
- };
3753
- };
3771
+ url: string;
3754
3772
  /**
3755
- * Footer text, without variables.
3773
+ * Name to keep for the file; defaults to the last part of the URL.
3756
3774
  */
3757
- footer?: string | null;
3758
- /**
3759
- * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
3760
- */
3761
- buttons?: Array<{
3762
- type: 'QUICK_REPLY';
3763
- text: string;
3764
- } | {
3765
- type: 'URL';
3766
- text: string;
3767
- /**
3768
- * Link the button opens; it may end in the variable `{{1}}`.
3769
- */
3770
- url: string;
3771
- /**
3772
- * Example URL for a link with `{{1}}`; required when it has one.
3773
- */
3774
- example?: string;
3775
- } | {
3776
- type: 'PHONE_NUMBER';
3777
- text: string;
3778
- /**
3779
- * Phone the button calls, with country code.
3780
- */
3781
- phone_number: string;
3782
- }>;
3775
+ file_name?: string;
3783
3776
  };
3784
3777
  /**
3785
3778
  * Creates a conversation workflow as a `draft`. Activating it is a separate call.
@@ -4231,6 +4224,245 @@ export type UpdateWorkflow = {
4231
4224
  };
4232
4225
  };
4233
4226
  };
4227
+ /**
4228
+ * A template draft. Ricky checks it as `POST /templates/validate` does, then submits it.
4229
+ */
4230
+ export type CreateTemplate = {
4231
+ /**
4232
+ * WhatsApp channel whose business account will own the template.
4233
+ */
4234
+ channel_id: string;
4235
+ /**
4236
+ * Lowercase letters, digits and underscores, starting with a letter.
4237
+ */
4238
+ name: string;
4239
+ /**
4240
+ * Language code, for example `es` or `en_US`.
4241
+ */
4242
+ language: string;
4243
+ /**
4244
+ * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
4245
+ */
4246
+ category: 'MARKETING' | 'UTILITY';
4247
+ /**
4248
+ * How variables are written: `{{first_name}}` or `{{1}}`. It cannot change later.
4249
+ */
4250
+ parameter_format?: 'NAMED' | 'POSITIONAL';
4251
+ /**
4252
+ * `TEXT` or `LOCATION`. Send `null` for no header.
4253
+ */
4254
+ header?: {
4255
+ type: 'TEXT';
4256
+ /**
4257
+ * Header text; at most one variable.
4258
+ */
4259
+ text: string;
4260
+ /**
4261
+ * Example value of the header variable; required when it has one.
4262
+ */
4263
+ example?: string;
4264
+ } | {
4265
+ type: 'LOCATION';
4266
+ } | null;
4267
+ /**
4268
+ * The message text.
4269
+ */
4270
+ body: {
4271
+ /**
4272
+ * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
4273
+ */
4274
+ text: string;
4275
+ /**
4276
+ * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
4277
+ */
4278
+ examples?: {
4279
+ [key: string]: string;
4280
+ };
4281
+ };
4282
+ /**
4283
+ * Footer text, without variables.
4284
+ */
4285
+ footer?: string | null;
4286
+ /**
4287
+ * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
4288
+ */
4289
+ buttons?: Array<{
4290
+ type: 'QUICK_REPLY';
4291
+ text: string;
4292
+ } | {
4293
+ type: 'URL';
4294
+ text: string;
4295
+ /**
4296
+ * Link the button opens; it may end in the variable `{{1}}`.
4297
+ */
4298
+ url: string;
4299
+ /**
4300
+ * Example URL for a link with `{{1}}`; required when it has one.
4301
+ */
4302
+ example?: string;
4303
+ } | {
4304
+ type: 'PHONE_NUMBER';
4305
+ text: string;
4306
+ /**
4307
+ * Phone the button calls, with country code.
4308
+ */
4309
+ phone_number: string;
4310
+ }>;
4311
+ };
4312
+ /**
4313
+ * The body of `POST /templates`; `channel_id` is optional here.
4314
+ */
4315
+ export type ValidateTemplate = {
4316
+ /**
4317
+ * WhatsApp channel whose business account will own the template.
4318
+ */
4319
+ channel_id?: string;
4320
+ /**
4321
+ * Lowercase letters, digits and underscores, starting with a letter.
4322
+ */
4323
+ name: string;
4324
+ /**
4325
+ * Language code, for example `es` or `en_US`.
4326
+ */
4327
+ language: string;
4328
+ /**
4329
+ * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
4330
+ */
4331
+ category: 'MARKETING' | 'UTILITY';
4332
+ /**
4333
+ * How variables are written: `{{first_name}}` or `{{1}}`. It cannot change later.
4334
+ */
4335
+ parameter_format?: 'NAMED' | 'POSITIONAL';
4336
+ /**
4337
+ * `TEXT` or `LOCATION`. Send `null` for no header.
4338
+ */
4339
+ header?: {
4340
+ type: 'TEXT';
4341
+ /**
4342
+ * Header text; at most one variable.
4343
+ */
4344
+ text: string;
4345
+ /**
4346
+ * Example value of the header variable; required when it has one.
4347
+ */
4348
+ example?: string;
4349
+ } | {
4350
+ type: 'LOCATION';
4351
+ } | null;
4352
+ /**
4353
+ * The message text.
4354
+ */
4355
+ body: {
4356
+ /**
4357
+ * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
4358
+ */
4359
+ text: string;
4360
+ /**
4361
+ * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
4362
+ */
4363
+ examples?: {
4364
+ [key: string]: string;
4365
+ };
4366
+ };
4367
+ /**
4368
+ * Footer text, without variables.
4369
+ */
4370
+ footer?: string | null;
4371
+ /**
4372
+ * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
4373
+ */
4374
+ buttons?: Array<{
4375
+ type: 'QUICK_REPLY';
4376
+ text: string;
4377
+ } | {
4378
+ type: 'URL';
4379
+ text: string;
4380
+ /**
4381
+ * Link the button opens; it may end in the variable `{{1}}`.
4382
+ */
4383
+ url: string;
4384
+ /**
4385
+ * Example URL for a link with `{{1}}`; required when it has one.
4386
+ */
4387
+ example?: string;
4388
+ } | {
4389
+ type: 'PHONE_NUMBER';
4390
+ text: string;
4391
+ /**
4392
+ * Phone the button calls, with country code.
4393
+ */
4394
+ phone_number: string;
4395
+ }>;
4396
+ };
4397
+ /**
4398
+ * Only the parts you send change; `buttons` replaces every button. Name, language and `parameter_format` cannot change.
4399
+ */
4400
+ export type UpdateTemplate = {
4401
+ /**
4402
+ * `UTILITY` for updates on something the customer asked for; `MARKETING` otherwise.
4403
+ */
4404
+ category?: 'MARKETING' | 'UTILITY';
4405
+ /**
4406
+ * `TEXT` or `LOCATION`. Send `null` for no header.
4407
+ */
4408
+ header?: {
4409
+ type: 'TEXT';
4410
+ /**
4411
+ * Header text; at most one variable.
4412
+ */
4413
+ text: string;
4414
+ /**
4415
+ * Example value of the header variable; required when it has one.
4416
+ */
4417
+ example?: string;
4418
+ } | {
4419
+ type: 'LOCATION';
4420
+ } | null;
4421
+ /**
4422
+ * The message text.
4423
+ */
4424
+ body?: {
4425
+ /**
4426
+ * Body text. Variables are `{{1}}`, `{{2}}`… for `POSITIONAL` and `{{first_name}}` for `NAMED`; not at the very start or end.
4427
+ */
4428
+ text: string;
4429
+ /**
4430
+ * An example value for every variable, keyed by its number or name without braces. Meta reviews them.
4431
+ */
4432
+ examples?: {
4433
+ [key: string]: string;
4434
+ };
4435
+ };
4436
+ /**
4437
+ * Footer text, without variables.
4438
+ */
4439
+ footer?: string | null;
4440
+ /**
4441
+ * Quick replies, at most two links and one phone. Quick replies cannot sit between the other buttons.
4442
+ */
4443
+ buttons?: Array<{
4444
+ type: 'QUICK_REPLY';
4445
+ text: string;
4446
+ } | {
4447
+ type: 'URL';
4448
+ text: string;
4449
+ /**
4450
+ * Link the button opens; it may end in the variable `{{1}}`.
4451
+ */
4452
+ url: string;
4453
+ /**
4454
+ * Example URL for a link with `{{1}}`; required when it has one.
4455
+ */
4456
+ example?: string;
4457
+ } | {
4458
+ type: 'PHONE_NUMBER';
4459
+ text: string;
4460
+ /**
4461
+ * Phone the button calls, with country code.
4462
+ */
4463
+ phone_number: string;
4464
+ }>;
4465
+ };
4234
4466
  /**
4235
4467
  * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
4236
4468
  */
@@ -6240,6 +6472,203 @@ export type ListWorkflowExecutionsResponses = {
6240
6472
  };
6241
6473
  };
6242
6474
  export type ListWorkflowExecutionsResponse = ListWorkflowExecutionsResponses[keyof ListWorkflowExecutionsResponses];
6475
+ export type UploadWorkflowHeaderMediaData = {
6476
+ body: UploadWorkflowHeaderMedia;
6477
+ headers?: {
6478
+ /**
6479
+ * Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as `order-10482-ready`. Retrying with the same key and body replays the first response instead of repeating the write.
6480
+ */
6481
+ 'Idempotency-Key'?: string;
6482
+ };
6483
+ path: {
6484
+ /**
6485
+ * Workflow ID.
6486
+ */
6487
+ workflow_id: string;
6488
+ };
6489
+ query?: never;
6490
+ url: '/workflows/{workflow_id}/header-media';
6491
+ };
6492
+ export type UploadWorkflowHeaderMediaErrors = {
6493
+ /**
6494
+ * `invalid_json`: The body is not valid JSON.
6495
+ *
6496
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
6497
+ */
6498
+ 400: Error;
6499
+ /**
6500
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
6501
+ */
6502
+ 401: Error;
6503
+ /**
6504
+ * `insufficient_scope`: The key lacks the scope this operation requires.
6505
+ */
6506
+ 403: Error;
6507
+ /**
6508
+ * `not_found`: The resource does not exist in this organization.
6509
+ */
6510
+ 404: Error;
6511
+ /**
6512
+ * `idempotency_conflict`: The `Idempotency-Key` was used for a different request.
6513
+ *
6514
+ * `request_processing`: A request with this `Idempotency-Key` is still processing or ended in an unknown state.
6515
+ */
6516
+ 409: Error;
6517
+ /**
6518
+ * `body_too_large`: The JSON body exceeds 64 KiB.
6519
+ */
6520
+ 413: Error;
6521
+ /**
6522
+ * `unsupported_media_type`: The body must be `application/json`.
6523
+ */
6524
+ 415: Error;
6525
+ /**
6526
+ * `rule_violation`: The request breaks a business rule; `message` says which.
6527
+ */
6528
+ 422: Error;
6529
+ /**
6530
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
6531
+ */
6532
+ 429: Error;
6533
+ /**
6534
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
6535
+ */
6536
+ 500: Error;
6537
+ /**
6538
+ * `upstream_error`: The messaging provider failed. Retry later.
6539
+ */
6540
+ 502: Error;
6541
+ };
6542
+ export type UploadWorkflowHeaderMediaError = UploadWorkflowHeaderMediaErrors[keyof UploadWorkflowHeaderMediaErrors];
6543
+ export type UploadWorkflowHeaderMediaResponses = {
6544
+ /**
6545
+ * Success.
6546
+ */
6547
+ 200: {
6548
+ data: Workflow;
6549
+ };
6550
+ };
6551
+ export type UploadWorkflowHeaderMediaResponse = UploadWorkflowHeaderMediaResponses[keyof UploadWorkflowHeaderMediaResponses];
6552
+ export type PreviewWorkflowRemindersData = {
6553
+ body?: never;
6554
+ path: {
6555
+ /**
6556
+ * Workflow ID.
6557
+ */
6558
+ workflow_id: string;
6559
+ };
6560
+ query: {
6561
+ /**
6562
+ * Day the workflow would send, `YYYY-MM-DD` in its time zone: its next run or a later day.
6563
+ */
6564
+ date: string;
6565
+ /**
6566
+ * Odoo states to remind instead of the workflow’s, comma-separated, to see what a change would do. Omit it to use the workflow’s.
6567
+ */
6568
+ appointment_states?: string;
6569
+ };
6570
+ url: '/workflows/{workflow_id}/reminders/preview';
6571
+ };
6572
+ export type PreviewWorkflowRemindersErrors = {
6573
+ /**
6574
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
6575
+ */
6576
+ 400: Error;
6577
+ /**
6578
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
6579
+ */
6580
+ 401: Error;
6581
+ /**
6582
+ * `insufficient_scope`: The key lacks the scope this operation requires.
6583
+ */
6584
+ 403: Error;
6585
+ /**
6586
+ * `not_found`: The resource does not exist in this organization.
6587
+ */
6588
+ 404: Error;
6589
+ /**
6590
+ * `rule_violation`: The request breaks a business rule; `message` says which.
6591
+ */
6592
+ 422: Error;
6593
+ /**
6594
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
6595
+ */
6596
+ 429: Error;
6597
+ /**
6598
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
6599
+ */
6600
+ 500: Error;
6601
+ /**
6602
+ * `upstream_error`: The messaging provider failed. Retry later.
6603
+ */
6604
+ 502: Error;
6605
+ };
6606
+ export type PreviewWorkflowRemindersError = PreviewWorkflowRemindersErrors[keyof PreviewWorkflowRemindersErrors];
6607
+ export type PreviewWorkflowRemindersResponses = {
6608
+ /**
6609
+ * Success.
6610
+ */
6611
+ 200: {
6612
+ data: ReminderPreview;
6613
+ };
6614
+ };
6615
+ export type PreviewWorkflowRemindersResponse = PreviewWorkflowRemindersResponses[keyof PreviewWorkflowRemindersResponses];
6616
+ export type GetWorkflowReminderHistoryData = {
6617
+ body?: never;
6618
+ path: {
6619
+ /**
6620
+ * Workflow ID.
6621
+ */
6622
+ workflow_id: string;
6623
+ };
6624
+ query: {
6625
+ /**
6626
+ * Day the workflow ran, `YYYY-MM-DD` in its time zone.
6627
+ */
6628
+ date: string;
6629
+ };
6630
+ url: '/workflows/{workflow_id}/reminders/history';
6631
+ };
6632
+ export type GetWorkflowReminderHistoryErrors = {
6633
+ /**
6634
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
6635
+ */
6636
+ 400: Error;
6637
+ /**
6638
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
6639
+ */
6640
+ 401: Error;
6641
+ /**
6642
+ * `insufficient_scope`: The key lacks the scope this operation requires.
6643
+ */
6644
+ 403: Error;
6645
+ /**
6646
+ * `not_found`: The resource does not exist in this organization.
6647
+ */
6648
+ 404: Error;
6649
+ /**
6650
+ * `rule_violation`: The request breaks a business rule; `message` says which.
6651
+ */
6652
+ 422: Error;
6653
+ /**
6654
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
6655
+ */
6656
+ 429: Error;
6657
+ /**
6658
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
6659
+ */
6660
+ 500: Error;
6661
+ };
6662
+ export type GetWorkflowReminderHistoryError = GetWorkflowReminderHistoryErrors[keyof GetWorkflowReminderHistoryErrors];
6663
+ export type GetWorkflowReminderHistoryResponses = {
6664
+ /**
6665
+ * Success.
6666
+ */
6667
+ 200: {
6668
+ data: ReminderHistory;
6669
+ };
6670
+ };
6671
+ export type GetWorkflowReminderHistoryResponse = GetWorkflowReminderHistoryResponses[keyof GetWorkflowReminderHistoryResponses];
6243
6672
  export type GetDashboardReportData = {
6244
6673
  body?: never;
6245
6674
  path?: never;
@@ -9623,6 +10052,58 @@ export type FetchMessageMediaResponses = {
9623
10052
  };
9624
10053
  };
9625
10054
  export type FetchMessageMediaResponse = FetchMessageMediaResponses[keyof FetchMessageMediaResponses];
10055
+ export type PreviewBroadcastAudienceData = {
10056
+ body: PreviewBroadcastAudience;
10057
+ path?: never;
10058
+ query?: never;
10059
+ url: '/broadcasts/preview';
10060
+ };
10061
+ export type PreviewBroadcastAudienceErrors = {
10062
+ /**
10063
+ * `invalid_json`: The body is not valid JSON.
10064
+ *
10065
+ * `invalid_input`: A parameter or body field is invalid; `param` names it when known.
10066
+ */
10067
+ 400: Error;
10068
+ /**
10069
+ * `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
10070
+ */
10071
+ 401: Error;
10072
+ /**
10073
+ * `insufficient_scope`: The key lacks the scope this operation requires.
10074
+ */
10075
+ 403: Error;
10076
+ /**
10077
+ * `not_found`: The resource does not exist in this organization.
10078
+ */
10079
+ 404: Error;
10080
+ /**
10081
+ * `body_too_large`: The JSON body exceeds 64 KiB.
10082
+ */
10083
+ 413: Error;
10084
+ /**
10085
+ * `unsupported_media_type`: The body must be `application/json`.
10086
+ */
10087
+ 415: Error;
10088
+ /**
10089
+ * `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
10090
+ */
10091
+ 429: Error;
10092
+ /**
10093
+ * `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
10094
+ */
10095
+ 500: Error;
10096
+ };
10097
+ export type PreviewBroadcastAudienceError = PreviewBroadcastAudienceErrors[keyof PreviewBroadcastAudienceErrors];
10098
+ export type PreviewBroadcastAudienceResponses = {
10099
+ /**
10100
+ * Success.
10101
+ */
10102
+ 200: {
10103
+ data: BroadcastAudiencePreview;
10104
+ };
10105
+ };
10106
+ export type PreviewBroadcastAudienceResponse = PreviewBroadcastAudienceResponses[keyof PreviewBroadcastAudienceResponses];
9626
10107
  export type WebhookMessageReceivedWebhookPayload = WebhookEvent;
9627
10108
  export type WebhookMessageReceivedWebhookRequest = {
9628
10109
  body: WebhookMessageReceivedWebhookPayload;