@kirimdev/sdk 3.1.0 → 3.2.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.
@@ -130,6 +130,7 @@ export interface paths {
130
130
  parameters: {
131
131
  query?: {
132
132
  status?: "connected" | "all";
133
+ customer_id?: string;
133
134
  };
134
135
  header?: never;
135
136
  path?: never;
@@ -296,6 +297,8 @@ export interface paths {
296
297
  * **Outbound send** — body has a `type` field (`text`, `image`, `document`, `video`, `audio`, `template`, `interactive`). Body shape mirrors the Meta WhatsApp Cloud API; media variants accept either `link` (hosted URL) or `id` (Meta uploaded media). The sender is the WhatsApp account identified by `phone_number_id` in the URL path; there is no `from` field in the body. Pass `Idempotency-Key` to safely retry on network failure.
297
298
  *
298
299
  * **Read receipt** — body has `status: "read"` + `message_id` (the inbound wamid from your webhook). Sends a read receipt back to the sender so the double-tick turns blue on their phone. Optional `typing_indicator: { type: "text" }` shows a typing bubble alongside the receipt; Meta auto-dismisses after ~25 seconds or on first outbound message.
300
+ *
301
+ * **Pre-send validation** — the API performs compliance checks before queuing the send. A 422 response with `error.code` set to `marketing_opted_out` indicates the recipient has stopped marketing messages from your business (the customer did this via the WhatsApp app menu — webhook `user_preferences` notifies you of the change). `account_restricted` indicates Meta has restricted your WhatsApp account; check the account status via the dashboard. `consent_required` indicates the recipient has not opted in. `upstream_error` indicates the WhatsApp account is disconnected. None of these are retryable until the underlying condition changes.
299
302
  */
300
303
  post: {
301
304
  parameters: {
@@ -944,6 +947,111 @@ export interface paths {
944
947
  patch?: never;
945
948
  trace?: never;
946
949
  };
950
+ "/{phone_number_id}/templates/sync": {
951
+ parameters: {
952
+ query?: never;
953
+ header?: never;
954
+ path?: never;
955
+ cookie?: never;
956
+ };
957
+ get?: never;
958
+ put?: never;
959
+ /**
960
+ * Sync templates from Meta
961
+ * @description Pull the latest template inventory from Meta and upsert into the Kirim DB for this WhatsApp account. Idempotent — call any time, returns a `{ created, updated, synced }` summary. Useful for platform integrations (multi-tenant Customers) so they don't need to wait for an operator to click "Sync" in the dashboard.
962
+ */
963
+ post: {
964
+ parameters: {
965
+ query?: never;
966
+ header?: never;
967
+ path: {
968
+ /** @description Meta WhatsApp Business `phone_number_id` of the connected account that should send / own this resource. Discoverable via `GET /v1/accounts` (returned as `phone_number_id` on each row). */
969
+ phone_number_id: string;
970
+ };
971
+ cookie?: never;
972
+ };
973
+ requestBody?: never;
974
+ responses: {
975
+ /** @description Sync summary */
976
+ 200: {
977
+ headers: {
978
+ [name: string]: unknown;
979
+ };
980
+ content: {
981
+ "application/json": components["schemas"]["SyncTemplatesResponse"];
982
+ };
983
+ };
984
+ /** @description Validation failure */
985
+ 400: {
986
+ headers: {
987
+ [name: string]: unknown;
988
+ };
989
+ content: {
990
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
991
+ };
992
+ };
993
+ /** @description Authentication failure */
994
+ 401: {
995
+ headers: {
996
+ [name: string]: unknown;
997
+ };
998
+ content: {
999
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1000
+ };
1001
+ };
1002
+ /** @description Resource not found */
1003
+ 404: {
1004
+ headers: {
1005
+ [name: string]: unknown;
1006
+ };
1007
+ content: {
1008
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1009
+ };
1010
+ };
1011
+ /** @description Semantic failure (e.g. idempotency key reuse) */
1012
+ 422: {
1013
+ headers: {
1014
+ [name: string]: unknown;
1015
+ };
1016
+ content: {
1017
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1018
+ };
1019
+ };
1020
+ /** @description Rate limit exceeded */
1021
+ 429: {
1022
+ headers: {
1023
+ [name: string]: unknown;
1024
+ };
1025
+ content: {
1026
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1027
+ };
1028
+ };
1029
+ /** @description Internal server error */
1030
+ 500: {
1031
+ headers: {
1032
+ [name: string]: unknown;
1033
+ };
1034
+ content: {
1035
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1036
+ };
1037
+ };
1038
+ /** @description Upstream WhatsApp error */
1039
+ 502: {
1040
+ headers: {
1041
+ [name: string]: unknown;
1042
+ };
1043
+ content: {
1044
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
1045
+ };
1046
+ };
1047
+ };
1048
+ };
1049
+ delete?: never;
1050
+ options?: never;
1051
+ head?: never;
1052
+ patch?: never;
1053
+ trace?: never;
1054
+ };
947
1055
  "/webhook_subscriptions": {
948
1056
  parameters: {
949
1057
  query?: never;
@@ -1030,7 +1138,7 @@ export interface paths {
1030
1138
  /** Format: uri */
1031
1139
  url: string;
1032
1140
  description?: string;
1033
- events: ("message.received" | "message.status" | "conversation.assigned" | "conversation.closed" | "contact.created" | "contact.updated")[];
1141
+ events: ("message.received" | "message.status" | "conversation.assigned" | "conversation.closed" | "contact.created" | "contact.updated" | "customer.created" | "customer.updated" | "customer.archived" | "customer.onboarded" | "customer.setup_link.created" | "customer.setup_link.consumed")[];
1034
1142
  };
1035
1143
  };
1036
1144
  };
@@ -1263,7 +1371,7 @@ export interface paths {
1263
1371
  /** Format: uri */
1264
1372
  url?: string;
1265
1373
  description?: string | null;
1266
- events?: ("message.received" | "message.status" | "conversation.assigned" | "conversation.closed" | "contact.created" | "contact.updated")[];
1374
+ events?: ("message.received" | "message.status" | "conversation.assigned" | "conversation.closed" | "contact.created" | "contact.updated" | "customer.created" | "customer.updated" | "customer.archived" | "customer.onboarded" | "customer.setup_link.created" | "customer.setup_link.consumed")[];
1267
1375
  /** @enum {string} */
1268
1376
  status?: "active" | "paused";
1269
1377
  };
@@ -3613,104 +3721,857 @@ export interface paths {
3613
3721
  };
3614
3722
  trace?: never;
3615
3723
  };
3616
- }
3617
- export type webhooks = Record<string, never>;
3618
- export interface components {
3619
- schemas: {
3620
- ApiErrorEnvelope: {
3621
- error: {
3622
- /** @example invalid_request_error */
3623
- type: string;
3624
- /** @example invalid_phone_number */
3625
- code: string;
3626
- message: string;
3627
- param?: string;
3628
- /** @example req_01HXYZABCDEFGHJKMNPQRSTVWX */
3629
- request_id: string;
3630
- };
3724
+ "/customers": {
3725
+ parameters: {
3726
+ query?: never;
3727
+ header?: never;
3728
+ path?: never;
3729
+ cookie?: never;
3631
3730
  };
3632
- Message: {
3633
- /** @example msg_01HXYZABCDEFGHJKMNPQRSTVWX */
3634
- id: string;
3635
- /** @enum {string} */
3636
- object: "message";
3637
- to?: string;
3638
- type?: string;
3639
- /** @enum {string} */
3640
- status: "queued" | "pending" | "sent" | "delivered" | "read" | "failed";
3641
- /** Format: date-time */
3642
- created_at?: string;
3643
- conversation_id?: string;
3644
- message_id?: string;
3645
- error?: {
3646
- code: string;
3647
- message: string;
3648
- provider_code: number | null;
3731
+ /**
3732
+ * List customers
3733
+ * @description List end-customers (tenant-of-tenant) attached to the organization. Each customer can own one or more WhatsApp accounts via setup links. NOTE: a customer here is NOT a WhatsApp contact — see the `/{phone_number_id}/contacts` resource for those.
3734
+ */
3735
+ get: {
3736
+ parameters: {
3737
+ query?: {
3738
+ status?: "pending" | "active" | "suspended" | "archived";
3739
+ search?: string;
3740
+ limit?: string;
3741
+ cursor?: string;
3742
+ };
3743
+ header?: never;
3744
+ path?: never;
3745
+ cookie?: never;
3649
3746
  };
3650
- };
3651
- Template: {
3652
- /** @example tmpl_01HXYZABCDEFGHJKMNPQRSTVWX */
3653
- id: string;
3654
- /** @enum {string} */
3655
- object: "template";
3656
- name: string;
3657
- language: string;
3658
- /** @enum {string} */
3659
- status: "pending" | "approved" | "rejected";
3660
- content: string;
3661
- variables: string[];
3662
- components?: unknown;
3663
- whatsapp_account: {
3664
- phone_number: string | null;
3747
+ requestBody?: never;
3748
+ responses: {
3749
+ /** @description Customer list */
3750
+ 200: {
3751
+ headers: {
3752
+ [name: string]: unknown;
3753
+ };
3754
+ content: {
3755
+ "application/json": components["schemas"]["ListCustomersResponse"];
3756
+ };
3757
+ };
3758
+ /** @description Validation failure */
3759
+ 400: {
3760
+ headers: {
3761
+ [name: string]: unknown;
3762
+ };
3763
+ content: {
3764
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3765
+ };
3766
+ };
3767
+ /** @description Authentication failure */
3768
+ 401: {
3769
+ headers: {
3770
+ [name: string]: unknown;
3771
+ };
3772
+ content: {
3773
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3774
+ };
3775
+ };
3776
+ /** @description Rate limit exceeded */
3777
+ 429: {
3778
+ headers: {
3779
+ [name: string]: unknown;
3780
+ };
3781
+ content: {
3782
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3783
+ };
3784
+ };
3785
+ /** @description Internal server error */
3786
+ 500: {
3787
+ headers: {
3788
+ [name: string]: unknown;
3789
+ };
3790
+ content: {
3791
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3792
+ };
3793
+ };
3665
3794
  };
3666
- provider_template_id: string | null;
3667
- /** Format: date-time */
3668
- created_at: string;
3669
- /** Format: date-time */
3670
- updated_at: string;
3671
- };
3672
- Account: {
3673
- /** @enum {string} */
3674
- object: "account";
3675
- /**
3676
- * @description Meta WhatsApp Business `phone_number_id`. Use as the `{phone_number_id}` path parameter in `/v1/{phone_number_id}/...` endpoints. Nullable while onboarding is in flight.
3677
- * @example 106540352242922
3678
- */
3679
- phone_number_id: string | null;
3680
- /** @example +628111222333 */
3681
- phone_number: string | null;
3682
- /** @example Customer Support */
3683
- name: string | null;
3684
- /**
3685
- * @description Lifecycle state of the account (e.g. `connected`, `disconnected`, `degraded`, `onboarding`).
3686
- * @example connected
3687
- */
3688
- status: string;
3689
3795
  };
3690
- WebhookSubscription: {
3691
- /** @example wbs_01HXYZABCDEFGHJKMNPQRSTVWX */
3692
- id: string;
3693
- /** @enum {string} */
3694
- object: "webhook_subscription";
3695
- /** Format: uri */
3696
- url: string;
3697
- description: string | null;
3698
- events: string[];
3699
- /** @enum {string} */
3700
- status: "active" | "paused" | "disabled";
3701
- disabled_reason: string | null;
3702
- consecutive_failures: number;
3703
- secrets: {
3704
- /** @example sec_01HXYZABCDEFGHJKMNPQRSTVWX */
3705
- id: string;
3706
- /** Format: date-time */
3707
- created_at: string;
3708
- /** Format: date-time */
3709
- expires_at: string | null;
3710
- }[];
3711
- /** Format: date-time */
3712
- created_at: string;
3713
- /** Format: date-time */
3796
+ put?: never;
3797
+ /**
3798
+ * Create a customer
3799
+ * @description Create a new end-customer. Starts in `pending` status; transitions to `active` when the first WhatsApp account is connected via a setup link.
3800
+ */
3801
+ post: {
3802
+ parameters: {
3803
+ query?: never;
3804
+ header?: never;
3805
+ path?: never;
3806
+ cookie?: never;
3807
+ };
3808
+ requestBody?: {
3809
+ content: {
3810
+ "application/json": {
3811
+ team_id?: string;
3812
+ name: string;
3813
+ /** Format: email */
3814
+ email?: string;
3815
+ metadata?: {
3816
+ [key: string]: unknown;
3817
+ };
3818
+ };
3819
+ };
3820
+ };
3821
+ responses: {
3822
+ /** @description Customer created */
3823
+ 200: {
3824
+ headers: {
3825
+ [name: string]: unknown;
3826
+ };
3827
+ content: {
3828
+ "application/json": components["schemas"]["CreateCustomerResponse"];
3829
+ };
3830
+ };
3831
+ /** @description Validation failure */
3832
+ 400: {
3833
+ headers: {
3834
+ [name: string]: unknown;
3835
+ };
3836
+ content: {
3837
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3838
+ };
3839
+ };
3840
+ /** @description Authentication failure */
3841
+ 401: {
3842
+ headers: {
3843
+ [name: string]: unknown;
3844
+ };
3845
+ content: {
3846
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3847
+ };
3848
+ };
3849
+ /** @description Rate limit exceeded */
3850
+ 429: {
3851
+ headers: {
3852
+ [name: string]: unknown;
3853
+ };
3854
+ content: {
3855
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3856
+ };
3857
+ };
3858
+ /** @description Internal server error */
3859
+ 500: {
3860
+ headers: {
3861
+ [name: string]: unknown;
3862
+ };
3863
+ content: {
3864
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3865
+ };
3866
+ };
3867
+ };
3868
+ };
3869
+ delete?: never;
3870
+ options?: never;
3871
+ head?: never;
3872
+ patch?: never;
3873
+ trace?: never;
3874
+ };
3875
+ "/customers/{id}": {
3876
+ parameters: {
3877
+ query?: never;
3878
+ header?: never;
3879
+ path?: never;
3880
+ cookie?: never;
3881
+ };
3882
+ /** Fetch a customer by id */
3883
+ get: {
3884
+ parameters: {
3885
+ query?: never;
3886
+ header?: never;
3887
+ path: {
3888
+ id: string;
3889
+ };
3890
+ cookie?: never;
3891
+ };
3892
+ requestBody?: never;
3893
+ responses: {
3894
+ /** @description Customer resource (includes attached WhatsApp accounts) */
3895
+ 200: {
3896
+ headers: {
3897
+ [name: string]: unknown;
3898
+ };
3899
+ content: {
3900
+ "application/json": components["schemas"]["GetCustomerResponse"];
3901
+ };
3902
+ };
3903
+ /** @description Validation failure */
3904
+ 400: {
3905
+ headers: {
3906
+ [name: string]: unknown;
3907
+ };
3908
+ content: {
3909
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3910
+ };
3911
+ };
3912
+ /** @description Authentication failure */
3913
+ 401: {
3914
+ headers: {
3915
+ [name: string]: unknown;
3916
+ };
3917
+ content: {
3918
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3919
+ };
3920
+ };
3921
+ /** @description Resource not found */
3922
+ 404: {
3923
+ headers: {
3924
+ [name: string]: unknown;
3925
+ };
3926
+ content: {
3927
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3928
+ };
3929
+ };
3930
+ /** @description Rate limit exceeded */
3931
+ 429: {
3932
+ headers: {
3933
+ [name: string]: unknown;
3934
+ };
3935
+ content: {
3936
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3937
+ };
3938
+ };
3939
+ /** @description Internal server error */
3940
+ 500: {
3941
+ headers: {
3942
+ [name: string]: unknown;
3943
+ };
3944
+ content: {
3945
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3946
+ };
3947
+ };
3948
+ };
3949
+ };
3950
+ put?: never;
3951
+ post?: never;
3952
+ /**
3953
+ * Archive a customer
3954
+ * @description Soft-archives the customer. WhatsApp accounts previously assigned remain in the database with `customer_id` unchanged — message history is never destroyed.
3955
+ */
3956
+ delete: {
3957
+ parameters: {
3958
+ query?: never;
3959
+ header?: never;
3960
+ path: {
3961
+ id: string;
3962
+ };
3963
+ cookie?: never;
3964
+ };
3965
+ requestBody?: never;
3966
+ responses: {
3967
+ /** @description Archived */
3968
+ 200: {
3969
+ headers: {
3970
+ [name: string]: unknown;
3971
+ };
3972
+ content: {
3973
+ "application/json": components["schemas"]["ArchiveCustomerResponse"];
3974
+ };
3975
+ };
3976
+ /** @description Validation failure */
3977
+ 400: {
3978
+ headers: {
3979
+ [name: string]: unknown;
3980
+ };
3981
+ content: {
3982
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3983
+ };
3984
+ };
3985
+ /** @description Authentication failure */
3986
+ 401: {
3987
+ headers: {
3988
+ [name: string]: unknown;
3989
+ };
3990
+ content: {
3991
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
3992
+ };
3993
+ };
3994
+ /** @description Resource not found */
3995
+ 404: {
3996
+ headers: {
3997
+ [name: string]: unknown;
3998
+ };
3999
+ content: {
4000
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4001
+ };
4002
+ };
4003
+ /** @description Rate limit exceeded */
4004
+ 429: {
4005
+ headers: {
4006
+ [name: string]: unknown;
4007
+ };
4008
+ content: {
4009
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4010
+ };
4011
+ };
4012
+ /** @description Internal server error */
4013
+ 500: {
4014
+ headers: {
4015
+ [name: string]: unknown;
4016
+ };
4017
+ content: {
4018
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4019
+ };
4020
+ };
4021
+ };
4022
+ };
4023
+ options?: never;
4024
+ head?: never;
4025
+ /** Update a customer */
4026
+ patch: {
4027
+ parameters: {
4028
+ query?: never;
4029
+ header?: never;
4030
+ path: {
4031
+ id: string;
4032
+ };
4033
+ cookie?: never;
4034
+ };
4035
+ requestBody?: {
4036
+ content: {
4037
+ "application/json": {
4038
+ name?: string;
4039
+ /** Format: email */
4040
+ email?: string | null;
4041
+ metadata?: {
4042
+ [key: string]: unknown;
4043
+ } | null;
4044
+ /** @enum {string} */
4045
+ status?: "pending" | "active" | "suspended";
4046
+ };
4047
+ };
4048
+ };
4049
+ responses: {
4050
+ /** @description Updated customer */
4051
+ 200: {
4052
+ headers: {
4053
+ [name: string]: unknown;
4054
+ };
4055
+ content: {
4056
+ "application/json": components["schemas"]["UpdateCustomerResponse"];
4057
+ };
4058
+ };
4059
+ /** @description Validation failure */
4060
+ 400: {
4061
+ headers: {
4062
+ [name: string]: unknown;
4063
+ };
4064
+ content: {
4065
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4066
+ };
4067
+ };
4068
+ /** @description Authentication failure */
4069
+ 401: {
4070
+ headers: {
4071
+ [name: string]: unknown;
4072
+ };
4073
+ content: {
4074
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4075
+ };
4076
+ };
4077
+ /** @description Resource not found */
4078
+ 404: {
4079
+ headers: {
4080
+ [name: string]: unknown;
4081
+ };
4082
+ content: {
4083
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4084
+ };
4085
+ };
4086
+ /** @description Rate limit exceeded */
4087
+ 429: {
4088
+ headers: {
4089
+ [name: string]: unknown;
4090
+ };
4091
+ content: {
4092
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4093
+ };
4094
+ };
4095
+ /** @description Internal server error */
4096
+ 500: {
4097
+ headers: {
4098
+ [name: string]: unknown;
4099
+ };
4100
+ content: {
4101
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4102
+ };
4103
+ };
4104
+ };
4105
+ };
4106
+ trace?: never;
4107
+ };
4108
+ "/customers/{id}/setup_links": {
4109
+ parameters: {
4110
+ query?: never;
4111
+ header?: never;
4112
+ path?: never;
4113
+ cookie?: never;
4114
+ };
4115
+ /**
4116
+ * List setup links for a customer
4117
+ * @description Returns up to the 50 most-recent setup links — token plaintext is NEVER returned here (only at create time). Optional `status` query filters to `active` / `consumed` / `expired` / `revoked`.
4118
+ */
4119
+ get: {
4120
+ parameters: {
4121
+ query?: {
4122
+ status?: "active" | "consumed" | "expired" | "revoked";
4123
+ };
4124
+ header?: never;
4125
+ path: {
4126
+ id: string;
4127
+ };
4128
+ cookie?: never;
4129
+ };
4130
+ requestBody?: never;
4131
+ responses: {
4132
+ /** @description Setup link list */
4133
+ 200: {
4134
+ headers: {
4135
+ [name: string]: unknown;
4136
+ };
4137
+ content: {
4138
+ "application/json": components["schemas"]["ListCustomerSetupLinksResponse"];
4139
+ };
4140
+ };
4141
+ /** @description Validation failure */
4142
+ 400: {
4143
+ headers: {
4144
+ [name: string]: unknown;
4145
+ };
4146
+ content: {
4147
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4148
+ };
4149
+ };
4150
+ /** @description Authentication failure */
4151
+ 401: {
4152
+ headers: {
4153
+ [name: string]: unknown;
4154
+ };
4155
+ content: {
4156
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4157
+ };
4158
+ };
4159
+ /** @description Resource not found */
4160
+ 404: {
4161
+ headers: {
4162
+ [name: string]: unknown;
4163
+ };
4164
+ content: {
4165
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4166
+ };
4167
+ };
4168
+ /** @description Rate limit exceeded */
4169
+ 429: {
4170
+ headers: {
4171
+ [name: string]: unknown;
4172
+ };
4173
+ content: {
4174
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4175
+ };
4176
+ };
4177
+ /** @description Internal server error */
4178
+ 500: {
4179
+ headers: {
4180
+ [name: string]: unknown;
4181
+ };
4182
+ content: {
4183
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4184
+ };
4185
+ };
4186
+ };
4187
+ };
4188
+ put?: never;
4189
+ /**
4190
+ * Generate a setup link
4191
+ * @description Creates a one-time setup link the end-customer can use to complete Meta Embedded Signup. The plaintext token and full setup URL are returned EXACTLY ONCE — store them immediately.
4192
+ */
4193
+ post: {
4194
+ parameters: {
4195
+ query?: never;
4196
+ header?: never;
4197
+ path: {
4198
+ id: string;
4199
+ };
4200
+ cookie?: never;
4201
+ };
4202
+ requestBody?: {
4203
+ content: {
4204
+ "application/json": {
4205
+ expires_in_hours?: number;
4206
+ /** Format: uri */
4207
+ success_redirect_url?: string;
4208
+ /** Format: uri */
4209
+ failure_redirect_url?: string;
4210
+ };
4211
+ };
4212
+ };
4213
+ responses: {
4214
+ /** @description Setup link created (token returned ONCE) */
4215
+ 200: {
4216
+ headers: {
4217
+ [name: string]: unknown;
4218
+ };
4219
+ content: {
4220
+ "application/json": components["schemas"]["CreateCustomerSetupLinkResponse"];
4221
+ };
4222
+ };
4223
+ /** @description Validation failure */
4224
+ 400: {
4225
+ headers: {
4226
+ [name: string]: unknown;
4227
+ };
4228
+ content: {
4229
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4230
+ };
4231
+ };
4232
+ /** @description Authentication failure */
4233
+ 401: {
4234
+ headers: {
4235
+ [name: string]: unknown;
4236
+ };
4237
+ content: {
4238
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4239
+ };
4240
+ };
4241
+ /** @description Resource not found */
4242
+ 404: {
4243
+ headers: {
4244
+ [name: string]: unknown;
4245
+ };
4246
+ content: {
4247
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4248
+ };
4249
+ };
4250
+ /** @description Rate limit exceeded */
4251
+ 429: {
4252
+ headers: {
4253
+ [name: string]: unknown;
4254
+ };
4255
+ content: {
4256
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4257
+ };
4258
+ };
4259
+ /** @description Internal server error */
4260
+ 500: {
4261
+ headers: {
4262
+ [name: string]: unknown;
4263
+ };
4264
+ content: {
4265
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4266
+ };
4267
+ };
4268
+ };
4269
+ };
4270
+ delete?: never;
4271
+ options?: never;
4272
+ head?: never;
4273
+ patch?: never;
4274
+ trace?: never;
4275
+ };
4276
+ "/customers/{id}/setup_links/{link_id}": {
4277
+ parameters: {
4278
+ query?: never;
4279
+ header?: never;
4280
+ path?: never;
4281
+ cookie?: never;
4282
+ };
4283
+ get?: never;
4284
+ put?: never;
4285
+ post?: never;
4286
+ /**
4287
+ * Revoke a setup link
4288
+ * @description Revoke a still-active link. Already-consumed or already-revoked links return `409`.
4289
+ */
4290
+ delete: {
4291
+ parameters: {
4292
+ query?: never;
4293
+ header?: never;
4294
+ path: {
4295
+ id: string;
4296
+ link_id: string;
4297
+ };
4298
+ cookie?: never;
4299
+ };
4300
+ requestBody?: never;
4301
+ responses: {
4302
+ /** @description Revoked */
4303
+ 200: {
4304
+ headers: {
4305
+ [name: string]: unknown;
4306
+ };
4307
+ content: {
4308
+ "application/json": components["schemas"]["RevokeCustomerSetupLinkResponse"];
4309
+ };
4310
+ };
4311
+ /** @description Validation failure */
4312
+ 400: {
4313
+ headers: {
4314
+ [name: string]: unknown;
4315
+ };
4316
+ content: {
4317
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4318
+ };
4319
+ };
4320
+ /** @description Authentication failure */
4321
+ 401: {
4322
+ headers: {
4323
+ [name: string]: unknown;
4324
+ };
4325
+ content: {
4326
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4327
+ };
4328
+ };
4329
+ /** @description Resource not found */
4330
+ 404: {
4331
+ headers: {
4332
+ [name: string]: unknown;
4333
+ };
4334
+ content: {
4335
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4336
+ };
4337
+ };
4338
+ /** @description Conflict (e.g. webhook subscription disabled) */
4339
+ 409: {
4340
+ headers: {
4341
+ [name: string]: unknown;
4342
+ };
4343
+ content: {
4344
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4345
+ };
4346
+ };
4347
+ /** @description Rate limit exceeded */
4348
+ 429: {
4349
+ headers: {
4350
+ [name: string]: unknown;
4351
+ };
4352
+ content: {
4353
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4354
+ };
4355
+ };
4356
+ /** @description Internal server error */
4357
+ 500: {
4358
+ headers: {
4359
+ [name: string]: unknown;
4360
+ };
4361
+ content: {
4362
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4363
+ };
4364
+ };
4365
+ };
4366
+ };
4367
+ options?: never;
4368
+ head?: never;
4369
+ /**
4370
+ * Update redirect URLs on an active setup link
4371
+ * @description Recover from a typo in `success_redirect_url` / `failure_redirect_url` without revoking and regenerating the link. Only works while `status = active`; pass `null` to clear a redirect.
4372
+ */
4373
+ patch: {
4374
+ parameters: {
4375
+ query?: never;
4376
+ header?: never;
4377
+ path: {
4378
+ id: string;
4379
+ link_id: string;
4380
+ };
4381
+ cookie?: never;
4382
+ };
4383
+ requestBody?: {
4384
+ content: {
4385
+ "application/json": {
4386
+ success_redirect_url?: string | null;
4387
+ failure_redirect_url?: string | null;
4388
+ };
4389
+ };
4390
+ };
4391
+ responses: {
4392
+ /** @description Updated setup link */
4393
+ 200: {
4394
+ headers: {
4395
+ [name: string]: unknown;
4396
+ };
4397
+ content: {
4398
+ "application/json": components["schemas"]["UpdateCustomerSetupLinkResponse"];
4399
+ };
4400
+ };
4401
+ /** @description Validation failure */
4402
+ 400: {
4403
+ headers: {
4404
+ [name: string]: unknown;
4405
+ };
4406
+ content: {
4407
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4408
+ };
4409
+ };
4410
+ /** @description Authentication failure */
4411
+ 401: {
4412
+ headers: {
4413
+ [name: string]: unknown;
4414
+ };
4415
+ content: {
4416
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4417
+ };
4418
+ };
4419
+ /** @description Resource not found */
4420
+ 404: {
4421
+ headers: {
4422
+ [name: string]: unknown;
4423
+ };
4424
+ content: {
4425
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4426
+ };
4427
+ };
4428
+ /** @description Conflict (e.g. webhook subscription disabled) */
4429
+ 409: {
4430
+ headers: {
4431
+ [name: string]: unknown;
4432
+ };
4433
+ content: {
4434
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4435
+ };
4436
+ };
4437
+ /** @description Rate limit exceeded */
4438
+ 429: {
4439
+ headers: {
4440
+ [name: string]: unknown;
4441
+ };
4442
+ content: {
4443
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4444
+ };
4445
+ };
4446
+ /** @description Internal server error */
4447
+ 500: {
4448
+ headers: {
4449
+ [name: string]: unknown;
4450
+ };
4451
+ content: {
4452
+ "application/json": components["schemas"]["ApiErrorEnvelope"];
4453
+ };
4454
+ };
4455
+ };
4456
+ };
4457
+ trace?: never;
4458
+ };
4459
+ }
4460
+ export type webhooks = Record<string, never>;
4461
+ export interface components {
4462
+ schemas: {
4463
+ ApiErrorEnvelope: {
4464
+ error: {
4465
+ /** @example invalid_request_error */
4466
+ type: string;
4467
+ /** @example invalid_phone_number */
4468
+ code: string;
4469
+ message: string;
4470
+ param?: string;
4471
+ /** @example req_01HXYZABCDEFGHJKMNPQRSTVWX */
4472
+ request_id: string;
4473
+ };
4474
+ };
4475
+ WhatsappAccountEmbedded: {
4476
+ phone_number: string | null;
4477
+ /**
4478
+ * @description Meta `business_phone_number_id` — use as the `{phone_number_id}` path segment in `/v1/{phone_number_id}/...` endpoints.
4479
+ * @example 106540352242922
4480
+ */
4481
+ phone_number_id: string | null;
4482
+ /** @description End-customer (multi-tenant platform mode) that owns this account. NULL for direct-org accounts. */
4483
+ customer: {
4484
+ /** @example cus_01HXYZABCDEFGHJKMNPQRSTVWX */
4485
+ id: string;
4486
+ name: string;
4487
+ } | null;
4488
+ };
4489
+ Message: {
4490
+ /** @example msg_01HXYZABCDEFGHJKMNPQRSTVWX */
4491
+ id: string;
4492
+ /** @enum {string} */
4493
+ object: "message";
4494
+ to?: string;
4495
+ type?: string;
4496
+ /** @enum {string} */
4497
+ status: "queued" | "pending" | "sent" | "delivered" | "read" | "failed";
4498
+ /** Format: date-time */
4499
+ created_at?: string;
4500
+ conversation_id?: string;
4501
+ message_id?: string;
4502
+ error?: {
4503
+ /** @description Stable Kirim error code. Known values include `outside_24h_window`, `marketing_opted_out`, `marketing_blocked_by_user`, `recipient_unavailable`, `unsupported_message_type`, `account_restricted`, `account_locked`, `consent_required`, `permission_revoked`, `auth_expired`, `app_rate_limited`, `account_rate_limited`, `template_not_found`, `template_paused`, `template_policy_violation`, `flow_blocked`, `media_upload_failed`, `media_download_failed`, `undeliverable`, `policy_violation`, `upstream_error`. */
4504
+ code: string;
4505
+ message: string;
4506
+ provider_code: number | null;
4507
+ };
4508
+ };
4509
+ Template: {
4510
+ /** @example tmpl_01HXYZABCDEFGHJKMNPQRSTVWX */
4511
+ id: string;
4512
+ /** @enum {string} */
4513
+ object: "template";
4514
+ name: string;
4515
+ language: string;
4516
+ /** @enum {string} */
4517
+ status: "pending" | "approved" | "rejected";
4518
+ content: string;
4519
+ variables: string[];
4520
+ components?: unknown;
4521
+ whatsapp_account: components["schemas"]["WhatsappAccountEmbedded"];
4522
+ provider_template_id: string | null;
4523
+ /** Format: date-time */
4524
+ created_at: string;
4525
+ /** Format: date-time */
4526
+ updated_at: string;
4527
+ };
4528
+ Account: {
4529
+ /** @enum {string} */
4530
+ object: "account";
4531
+ /**
4532
+ * @description Meta WhatsApp Business `phone_number_id`. Use as the `{phone_number_id}` path parameter in `/v1/{phone_number_id}/...` endpoints. Nullable while onboarding is in flight.
4533
+ * @example 106540352242922
4534
+ */
4535
+ phone_number_id: string | null;
4536
+ /** @example +628111222333 */
4537
+ phone_number: string | null;
4538
+ /** @example Customer Support */
4539
+ name: string | null;
4540
+ /**
4541
+ * @description Lifecycle state of the account (e.g. `connected`, `disconnected`, `degraded`, `onboarding`).
4542
+ * @example connected
4543
+ */
4544
+ status: string;
4545
+ /**
4546
+ * @description Public id of the end-customer (multi-tenant platform mode) that owns this account. NULL for direct-org accounts. Filter the list endpoint via `?customer_id=cus_...`.
4547
+ * @example cus_01HXYZABCDEFGHJKMNPQRSTVWX
4548
+ */
4549
+ customer_id: string | null;
4550
+ };
4551
+ WebhookSubscription: {
4552
+ /** @example wbs_01HXYZABCDEFGHJKMNPQRSTVWX */
4553
+ id: string;
4554
+ /** @enum {string} */
4555
+ object: "webhook_subscription";
4556
+ /** Format: uri */
4557
+ url: string;
4558
+ description: string | null;
4559
+ events: string[];
4560
+ /** @enum {string} */
4561
+ status: "active" | "paused" | "disabled";
4562
+ disabled_reason: string | null;
4563
+ consecutive_failures: number;
4564
+ secrets: {
4565
+ /** @example sec_01HXYZABCDEFGHJKMNPQRSTVWX */
4566
+ id: string;
4567
+ /** Format: date-time */
4568
+ created_at: string;
4569
+ /** Format: date-time */
4570
+ expires_at: string | null;
4571
+ }[];
4572
+ /** Format: date-time */
4573
+ created_at: string;
4574
+ /** Format: date-time */
3714
4575
  updated_at: string;
3715
4576
  initial_secret?: string;
3716
4577
  };
@@ -3749,9 +4610,7 @@ export interface components {
3749
4610
  phone_number: string | null;
3750
4611
  name: string | null;
3751
4612
  };
3752
- whatsapp_account: {
3753
- phone_number: string | null;
3754
- };
4613
+ whatsapp_account: components["schemas"]["WhatsappAccountEmbedded"];
3755
4614
  assignee: {
3756
4615
  id: string;
3757
4616
  name: string | null;
@@ -3778,9 +4637,7 @@ export interface components {
3778
4637
  metadata: {
3779
4638
  [key: string]: unknown;
3780
4639
  } | null;
3781
- whatsapp_account: {
3782
- phone_number: string | null;
3783
- };
4640
+ whatsapp_account: components["schemas"]["WhatsappAccountEmbedded"];
3784
4641
  /** Format: date-time */
3785
4642
  created_at: string;
3786
4643
  /** Format: date-time */
@@ -3800,6 +4657,57 @@ export interface components {
3800
4657
  /** Format: date-time */
3801
4658
  updated_at: string;
3802
4659
  };
4660
+ Customer: {
4661
+ /** @example cus_01HXYZABCDEFGHJKMNPQRSTVWX */
4662
+ id: string;
4663
+ /** @enum {string} */
4664
+ object: "customer";
4665
+ name: string;
4666
+ email: string | null;
4667
+ /** @enum {string} */
4668
+ status: "pending" | "active" | "suspended" | "archived";
4669
+ metadata: {
4670
+ [key: string]: unknown;
4671
+ } | null;
4672
+ /** Format: date-time */
4673
+ archived_at: string | null;
4674
+ team_id: string;
4675
+ /** Format: date-time */
4676
+ created_at: string;
4677
+ /** Format: date-time */
4678
+ updated_at: string;
4679
+ };
4680
+ CustomerSetupLink: {
4681
+ /** @example csl_01HXYZABCDEFGHJKMNPQRSTVWX */
4682
+ id: string;
4683
+ /** @enum {string} */
4684
+ object: "customer_setup_link";
4685
+ customer_id: string;
4686
+ /** @enum {string} */
4687
+ status: "active" | "consumed" | "expired" | "revoked";
4688
+ token_last4: string;
4689
+ /** Format: date-time */
4690
+ expires_at: string;
4691
+ /** Format: date-time */
4692
+ consumed_at: string | null;
4693
+ /**
4694
+ * Format: uri
4695
+ * @description Where the tenant is redirected after successful Embedded Signup. We append `?customer_id=&account_id=&status=success` on the redirect.
4696
+ */
4697
+ success_redirect_url: string | null;
4698
+ /**
4699
+ * Format: uri
4700
+ * @description Where the tenant is redirected on failure (link error, Meta signup cancelled, etc.). We append `?customer_id=&status=failed&reason=<code>`.
4701
+ */
4702
+ failure_redirect_url: string | null;
4703
+ /** Format: date-time */
4704
+ created_at: string;
4705
+ };
4706
+ CustomerSetupLinkWithToken: components["schemas"]["CustomerSetupLink"] & {
4707
+ /** Format: uri */
4708
+ setup_url: string;
4709
+ token: string;
4710
+ };
3803
4711
  MessageListItem: {
3804
4712
  /** @example msg_01HXYZABCDEFGHJKMNPQRSTVWX */
3805
4713
  id: string;
@@ -3817,6 +4725,7 @@ export interface components {
3817
4725
  /** Format: date-time */
3818
4726
  created_at: string;
3819
4727
  error?: {
4728
+ /** @description Stable Kirim error code. Known values include `outside_24h_window`, `marketing_opted_out`, `marketing_blocked_by_user`, `recipient_unavailable`, `unsupported_message_type`, `account_restricted`, `account_locked`, `consent_required`, `permission_revoked`, `auth_expired`, `app_rate_limited`, `account_rate_limited`, `template_not_found`, `template_paused`, `template_policy_violation`, `flow_blocked`, `media_upload_failed`, `media_download_failed`, `undeliverable`, `policy_violation`, `upstream_error`. */
3820
4729
  code: string;
3821
4730
  message: string;
3822
4731
  provider_code: number | null;
@@ -3871,6 +4780,19 @@ export interface components {
3871
4780
  data: components["schemas"]["Template"];
3872
4781
  request_id: string;
3873
4782
  };
4783
+ SyncTemplatesResponse: {
4784
+ data: {
4785
+ /** @enum {string} */
4786
+ object: "template_sync_result";
4787
+ /** @example 12 */
4788
+ synced: number;
4789
+ /** @example 2 */
4790
+ created: number;
4791
+ /** @example 10 */
4792
+ updated: number;
4793
+ };
4794
+ request_id: string;
4795
+ };
3874
4796
  CreateWebhookSubscriptionResponse: {
3875
4797
  data: components["schemas"]["WebhookSubscription"];
3876
4798
  request_id: string;
@@ -4066,6 +4988,70 @@ export interface components {
4066
4988
  };
4067
4989
  request_id: string;
4068
4990
  };
4991
+ ListCustomersResponse: {
4992
+ data: components["schemas"]["Customer"][];
4993
+ has_more: boolean;
4994
+ next_cursor: string | null;
4995
+ request_id: string;
4996
+ };
4997
+ CreateCustomerResponse: {
4998
+ data: components["schemas"]["Customer"];
4999
+ request_id: string;
5000
+ };
5001
+ GetCustomerResponse: {
5002
+ data: components["schemas"]["Customer"] & {
5003
+ /** @description WhatsApp accounts currently assigned to this customer. */
5004
+ whatsapp_accounts: {
5005
+ phone_number_id: string | null;
5006
+ phone_number: string | null;
5007
+ name: string | null;
5008
+ status: string;
5009
+ /** Format: date-time */
5010
+ onboarded_at: string | null;
5011
+ }[];
5012
+ };
5013
+ request_id: string;
5014
+ };
5015
+ UpdateCustomerResponse: {
5016
+ data: components["schemas"]["Customer"];
5017
+ request_id: string;
5018
+ };
5019
+ ArchiveCustomerResponse: {
5020
+ data: {
5021
+ id: string;
5022
+ /** @enum {string} */
5023
+ object: "customer";
5024
+ /** @enum {boolean} */
5025
+ archived: true;
5026
+ };
5027
+ request_id: string;
5028
+ };
5029
+ ListCustomerSetupLinksResponse: {
5030
+ data: components["schemas"]["CustomerSetupLink"][];
5031
+ has_more: boolean;
5032
+ next_cursor: string | null;
5033
+ request_id: string;
5034
+ };
5035
+ CreateCustomerSetupLinkResponse: {
5036
+ data: components["schemas"]["CustomerSetupLinkWithToken"];
5037
+ request_id: string;
5038
+ };
5039
+ UpdateCustomerSetupLinkResponse: {
5040
+ data: components["schemas"]["CustomerSetupLink"];
5041
+ request_id: string;
5042
+ };
5043
+ RevokeCustomerSetupLinkResponse: {
5044
+ data: {
5045
+ id: string;
5046
+ /** @enum {string} */
5047
+ object: "customer_setup_link";
5048
+ /** @enum {boolean} */
5049
+ revoked: true;
5050
+ /** @enum {string} */
5051
+ status: "active" | "consumed" | "expired" | "revoked";
5052
+ };
5053
+ request_id: string;
5054
+ };
4069
5055
  };
4070
5056
  responses: never;
4071
5057
  parameters: never;