@kirimdev/sdk 3.1.1 → 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;
@@ -946,6 +947,111 @@ export interface paths {
946
947
  patch?: never;
947
948
  trace?: never;
948
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
+ };
949
1055
  "/webhook_subscriptions": {
950
1056
  parameters: {
951
1057
  query?: never;
@@ -1032,7 +1138,7 @@ export interface paths {
1032
1138
  /** Format: uri */
1033
1139
  url: string;
1034
1140
  description?: string;
1035
- 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")[];
1036
1142
  };
1037
1143
  };
1038
1144
  };
@@ -1265,7 +1371,7 @@ export interface paths {
1265
1371
  /** Format: uri */
1266
1372
  url?: string;
1267
1373
  description?: string | null;
1268
- 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")[];
1269
1375
  /** @enum {string} */
1270
1376
  status?: "active" | "paused";
1271
1377
  };
@@ -3615,105 +3721,857 @@ export interface paths {
3615
3721
  };
3616
3722
  trace?: never;
3617
3723
  };
3618
- }
3619
- export type webhooks = Record<string, never>;
3620
- export interface components {
3621
- schemas: {
3622
- ApiErrorEnvelope: {
3623
- error: {
3624
- /** @example invalid_request_error */
3625
- type: string;
3626
- /** @example invalid_phone_number */
3627
- code: string;
3628
- message: string;
3629
- param?: string;
3630
- /** @example req_01HXYZABCDEFGHJKMNPQRSTVWX */
3631
- request_id: string;
3632
- };
3724
+ "/customers": {
3725
+ parameters: {
3726
+ query?: never;
3727
+ header?: never;
3728
+ path?: never;
3729
+ cookie?: never;
3633
3730
  };
3634
- Message: {
3635
- /** @example msg_01HXYZABCDEFGHJKMNPQRSTVWX */
3636
- id: string;
3637
- /** @enum {string} */
3638
- object: "message";
3639
- to?: string;
3640
- type?: string;
3641
- /** @enum {string} */
3642
- status: "queued" | "pending" | "sent" | "delivered" | "read" | "failed";
3643
- /** Format: date-time */
3644
- created_at?: string;
3645
- conversation_id?: string;
3646
- message_id?: string;
3647
- error?: {
3648
- /** @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`. */
3649
- code: string;
3650
- message: string;
3651
- 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;
3652
3746
  };
3653
- };
3654
- Template: {
3655
- /** @example tmpl_01HXYZABCDEFGHJKMNPQRSTVWX */
3656
- id: string;
3657
- /** @enum {string} */
3658
- object: "template";
3659
- name: string;
3660
- language: string;
3661
- /** @enum {string} */
3662
- status: "pending" | "approved" | "rejected";
3663
- content: string;
3664
- variables: string[];
3665
- components?: unknown;
3666
- whatsapp_account: {
3667
- 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
+ };
3668
3794
  };
3669
- provider_template_id: string | null;
3670
- /** Format: date-time */
3671
- created_at: string;
3672
- /** Format: date-time */
3673
- updated_at: string;
3674
- };
3675
- Account: {
3676
- /** @enum {string} */
3677
- object: "account";
3678
- /**
3679
- * @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.
3680
- * @example 106540352242922
3681
- */
3682
- phone_number_id: string | null;
3683
- /** @example +628111222333 */
3684
- phone_number: string | null;
3685
- /** @example Customer Support */
3686
- name: string | null;
3687
- /**
3688
- * @description Lifecycle state of the account (e.g. `connected`, `disconnected`, `degraded`, `onboarding`).
3689
- * @example connected
3690
- */
3691
- status: string;
3692
3795
  };
3693
- WebhookSubscription: {
3694
- /** @example wbs_01HXYZABCDEFGHJKMNPQRSTVWX */
3695
- id: string;
3696
- /** @enum {string} */
3697
- object: "webhook_subscription";
3698
- /** Format: uri */
3699
- url: string;
3700
- description: string | null;
3701
- events: string[];
3702
- /** @enum {string} */
3703
- status: "active" | "paused" | "disabled";
3704
- disabled_reason: string | null;
3705
- consecutive_failures: number;
3706
- secrets: {
3707
- /** @example sec_01HXYZABCDEFGHJKMNPQRSTVWX */
3708
- id: string;
3709
- /** Format: date-time */
3710
- created_at: string;
3711
- /** Format: date-time */
3712
- expires_at: string | null;
3713
- }[];
3714
- /** Format: date-time */
3715
- created_at: string;
3716
- /** 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 */
3717
4575
  updated_at: string;
3718
4576
  initial_secret?: string;
3719
4577
  };
@@ -3752,9 +4610,7 @@ export interface components {
3752
4610
  phone_number: string | null;
3753
4611
  name: string | null;
3754
4612
  };
3755
- whatsapp_account: {
3756
- phone_number: string | null;
3757
- };
4613
+ whatsapp_account: components["schemas"]["WhatsappAccountEmbedded"];
3758
4614
  assignee: {
3759
4615
  id: string;
3760
4616
  name: string | null;
@@ -3781,9 +4637,7 @@ export interface components {
3781
4637
  metadata: {
3782
4638
  [key: string]: unknown;
3783
4639
  } | null;
3784
- whatsapp_account: {
3785
- phone_number: string | null;
3786
- };
4640
+ whatsapp_account: components["schemas"]["WhatsappAccountEmbedded"];
3787
4641
  /** Format: date-time */
3788
4642
  created_at: string;
3789
4643
  /** Format: date-time */
@@ -3803,6 +4657,57 @@ export interface components {
3803
4657
  /** Format: date-time */
3804
4658
  updated_at: string;
3805
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
+ };
3806
4711
  MessageListItem: {
3807
4712
  /** @example msg_01HXYZABCDEFGHJKMNPQRSTVWX */
3808
4713
  id: string;
@@ -3875,6 +4780,19 @@ export interface components {
3875
4780
  data: components["schemas"]["Template"];
3876
4781
  request_id: string;
3877
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
+ };
3878
4796
  CreateWebhookSubscriptionResponse: {
3879
4797
  data: components["schemas"]["WebhookSubscription"];
3880
4798
  request_id: string;
@@ -4070,6 +4988,70 @@ export interface components {
4070
4988
  };
4071
4989
  request_id: string;
4072
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
+ };
4073
5055
  };
4074
5056
  responses: never;
4075
5057
  parameters: never;