@funnelchat-hq/sdk 0.1.2 → 0.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.
- package/README.md +105 -4
- package/dist/index.cjs +161 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +670 -85
- package/dist/index.d.ts +670 -85
- package/dist/index.js +159 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3780,7 +3780,11 @@ interface paths {
|
|
|
3780
3780
|
*/
|
|
3781
3781
|
get: operations["device.index"];
|
|
3782
3782
|
put?: never;
|
|
3783
|
-
|
|
3783
|
+
/**
|
|
3784
|
+
* Create a number connected by QR code
|
|
3785
|
+
* @description Same path and same rejections as the panel: `403 numbers_not_included`, `403 number_limit_reached`, `409 pending_number_exists` (the account already has a QR number waiting to be scanned: its `device_id` comes in the body), `422 qr_requires_coexistence`, `422 method_already_present` (with `device_id`), `409 operation_in_progress`. The provider is chosen by the system. Then ask for the QR with `GET devices/{device}/qr`. `country` is the country of the phone that will scan the QR, where the WhatsApp session is opened from.
|
|
3786
|
+
*/
|
|
3787
|
+
post: operations["pendingDevice.store"];
|
|
3784
3788
|
delete?: never;
|
|
3785
3789
|
options?: never;
|
|
3786
3790
|
head?: never;
|
|
@@ -4887,6 +4891,71 @@ interface paths {
|
|
|
4887
4891
|
patch?: never;
|
|
4888
4892
|
trace?: never;
|
|
4889
4893
|
};
|
|
4894
|
+
"/api/v1/devices/{device}/qr": {
|
|
4895
|
+
parameters: {
|
|
4896
|
+
query?: never;
|
|
4897
|
+
header?: never;
|
|
4898
|
+
path?: never;
|
|
4899
|
+
cookie?: never;
|
|
4900
|
+
};
|
|
4901
|
+
/**
|
|
4902
|
+
* The QR code to connect a number
|
|
4903
|
+
* @description Creates the WhatsApp instance when needed. Only for QR numbers: an official one answers `422 provider_unsupported`. Scanning the QR gives control of a WhatsApp, so it needs `accounts:operate`. Every call brings the code of that moment: ask again every `expires_in` seconds (5 with a QR) and replace the image with the latest one; the answer carries `Cache-Control: no-store`.
|
|
4904
|
+
*/
|
|
4905
|
+
get: operations["pendingDevice.qr"];
|
|
4906
|
+
put?: never;
|
|
4907
|
+
post?: never;
|
|
4908
|
+
delete?: never;
|
|
4909
|
+
options?: never;
|
|
4910
|
+
head?: never;
|
|
4911
|
+
patch?: never;
|
|
4912
|
+
trace?: never;
|
|
4913
|
+
};
|
|
4914
|
+
"/api/v1/connect-links": {
|
|
4915
|
+
parameters: {
|
|
4916
|
+
query?: never;
|
|
4917
|
+
header?: never;
|
|
4918
|
+
path?: never;
|
|
4919
|
+
cookie?: never;
|
|
4920
|
+
};
|
|
4921
|
+
/**
|
|
4922
|
+
* List connect links
|
|
4923
|
+
* @description Without the token: `url` is not shown again. Newest first.
|
|
4924
|
+
*/
|
|
4925
|
+
get: operations["pendingConnectLink.index"];
|
|
4926
|
+
put?: never;
|
|
4927
|
+
/**
|
|
4928
|
+
* Create a connect link
|
|
4929
|
+
* @description A single-use page where your customer connects a number: by QR code, or an official one through the Meta sign-up. The number is created when the page finishes. The quota is checked now (except on a reconnection) and again at the end, with the rejections of `POST devices`. `provision_us_number` needs `dedicated` in `allowed_connection_types` and no `device_id` (`422 invalid_request`). At most 20 open links per account (`429 too_many_open_links`); `type: "meta"` answers `503 meta_connect_disabled` while the official sign-up is off, as it is in production until the domain is registered with Meta. `country` (only `qr`, not with `device_id`) is the country of the phone that will scan the QR.
|
|
4930
|
+
*/
|
|
4931
|
+
post: operations["pendingConnectLink.store"];
|
|
4932
|
+
delete?: never;
|
|
4933
|
+
options?: never;
|
|
4934
|
+
head?: never;
|
|
4935
|
+
patch?: never;
|
|
4936
|
+
trace?: never;
|
|
4937
|
+
};
|
|
4938
|
+
"/api/v1/connect-links/{link}": {
|
|
4939
|
+
parameters: {
|
|
4940
|
+
query?: never;
|
|
4941
|
+
header?: never;
|
|
4942
|
+
path?: never;
|
|
4943
|
+
cookie?: never;
|
|
4944
|
+
};
|
|
4945
|
+
/** Read a connect link */
|
|
4946
|
+
get: operations["pendingConnectLink.show"];
|
|
4947
|
+
put?: never;
|
|
4948
|
+
post?: never;
|
|
4949
|
+
/**
|
|
4950
|
+
* Revoke a connect link
|
|
4951
|
+
* @description Only a `pending` link: any other answers `409 link_not_pending`.
|
|
4952
|
+
*/
|
|
4953
|
+
delete: operations["pendingConnectLink.destroy"];
|
|
4954
|
+
options?: never;
|
|
4955
|
+
head?: never;
|
|
4956
|
+
patch?: never;
|
|
4957
|
+
trace?: never;
|
|
4958
|
+
};
|
|
4890
4959
|
}
|
|
4891
4960
|
interface webhooks {
|
|
4892
4961
|
"message.received": {
|
|
@@ -6136,7 +6205,7 @@ interface webhooks {
|
|
|
6136
6205
|
put?: never;
|
|
6137
6206
|
/**
|
|
6138
6207
|
* device.connected
|
|
6139
|
-
* @description One of the numbers of the account got connected: by scanning the QR code
|
|
6208
|
+
* @description One of the numbers of the account got connected: by scanning the QR code, by finishing the sign-up of a WhatsApp Cloud number, or through a connect link.
|
|
6140
6209
|
*/
|
|
6141
6210
|
post: {
|
|
6142
6211
|
parameters: {
|
|
@@ -6149,14 +6218,11 @@ interface webhooks {
|
|
|
6149
6218
|
content: {
|
|
6150
6219
|
"application/json": {
|
|
6151
6220
|
data?: {
|
|
6152
|
-
device:
|
|
6153
|
-
id: number;
|
|
6154
|
-
name: string | null;
|
|
6155
|
-
/** @description Digits only, without `+`. */
|
|
6156
|
-
number: string | null;
|
|
6157
|
-
};
|
|
6221
|
+
device: components["schemas"]["PendingWebhookDevice"];
|
|
6158
6222
|
/** Format: date-time */
|
|
6159
6223
|
connected_at: string;
|
|
6224
|
+
/** @description The connect link of this connection, or `null` when it did not come from a link. */
|
|
6225
|
+
connect_link_id?: number | null;
|
|
6160
6226
|
};
|
|
6161
6227
|
};
|
|
6162
6228
|
};
|
|
@@ -6180,7 +6246,7 @@ interface webhooks {
|
|
|
6180
6246
|
put?: never;
|
|
6181
6247
|
/**
|
|
6182
6248
|
* device.disconnected
|
|
6183
|
-
* @description One of the numbers of the account disconnected and can no longer send or receive.
|
|
6249
|
+
* @description One of the numbers of the account disconnected and can no longer send or receive: a QR session that closed or was protected from a shadow ban, an official number that failed its re-registration, or one disconnected from the panel.
|
|
6184
6250
|
*/
|
|
6185
6251
|
post: {
|
|
6186
6252
|
parameters: {
|
|
@@ -6193,14 +6259,13 @@ interface webhooks {
|
|
|
6193
6259
|
content: {
|
|
6194
6260
|
"application/json": {
|
|
6195
6261
|
data?: {
|
|
6196
|
-
device:
|
|
6197
|
-
id: number;
|
|
6198
|
-
name: string | null;
|
|
6199
|
-
/** @description Digits only, without `+`. */
|
|
6200
|
-
number: string | null;
|
|
6201
|
-
};
|
|
6262
|
+
device: components["schemas"]["PendingWebhookDevice"];
|
|
6202
6263
|
/** Format: date-time */
|
|
6203
6264
|
disconnected_at: string;
|
|
6265
|
+
/** @enum {string} */
|
|
6266
|
+
reason?: "qr_logged_out" | "meta_account_not_registered" | "shadow_ban_protection" | "provider_error" | "unknown" | "disconnected_by_user";
|
|
6267
|
+
/** @description The connect link that last connected the number, or `null`. */
|
|
6268
|
+
connect_link_id?: number | null;
|
|
6204
6269
|
};
|
|
6205
6270
|
};
|
|
6206
6271
|
};
|
|
@@ -7352,6 +7417,92 @@ interface webhooks {
|
|
|
7352
7417
|
patch?: never;
|
|
7353
7418
|
trace?: never;
|
|
7354
7419
|
};
|
|
7420
|
+
"device.deleted": {
|
|
7421
|
+
parameters: {
|
|
7422
|
+
query?: never;
|
|
7423
|
+
header?: never;
|
|
7424
|
+
path?: never;
|
|
7425
|
+
cookie?: never;
|
|
7426
|
+
};
|
|
7427
|
+
get?: never;
|
|
7428
|
+
put?: never;
|
|
7429
|
+
/**
|
|
7430
|
+
* device.deleted
|
|
7431
|
+
* @description A number of the account was deleted: its slot of the plan is free again.
|
|
7432
|
+
*/
|
|
7433
|
+
post: {
|
|
7434
|
+
parameters: {
|
|
7435
|
+
query?: never;
|
|
7436
|
+
header?: never;
|
|
7437
|
+
path?: never;
|
|
7438
|
+
cookie?: never;
|
|
7439
|
+
};
|
|
7440
|
+
requestBody?: {
|
|
7441
|
+
content: {
|
|
7442
|
+
"application/json": {
|
|
7443
|
+
data?: {
|
|
7444
|
+
device: components["schemas"]["PendingWebhookDevice"];
|
|
7445
|
+
/** Format: date-time */
|
|
7446
|
+
deleted_at: string;
|
|
7447
|
+
/** @description The connect link that last connected the number, or `null`. */
|
|
7448
|
+
connect_link_id?: number | null;
|
|
7449
|
+
};
|
|
7450
|
+
};
|
|
7451
|
+
};
|
|
7452
|
+
};
|
|
7453
|
+
responses: never;
|
|
7454
|
+
};
|
|
7455
|
+
delete?: never;
|
|
7456
|
+
options?: never;
|
|
7457
|
+
head?: never;
|
|
7458
|
+
patch?: never;
|
|
7459
|
+
trace?: never;
|
|
7460
|
+
};
|
|
7461
|
+
"device.health_changed": {
|
|
7462
|
+
parameters: {
|
|
7463
|
+
query?: never;
|
|
7464
|
+
header?: never;
|
|
7465
|
+
path?: never;
|
|
7466
|
+
cookie?: never;
|
|
7467
|
+
};
|
|
7468
|
+
get?: never;
|
|
7469
|
+
put?: never;
|
|
7470
|
+
/**
|
|
7471
|
+
* device.health_changed
|
|
7472
|
+
* @description The health of an official number changed (what Meta lets it do). Emitted only when the overall state changes.
|
|
7473
|
+
*/
|
|
7474
|
+
post: {
|
|
7475
|
+
parameters: {
|
|
7476
|
+
query?: never;
|
|
7477
|
+
header?: never;
|
|
7478
|
+
path?: never;
|
|
7479
|
+
cookie?: never;
|
|
7480
|
+
};
|
|
7481
|
+
requestBody?: {
|
|
7482
|
+
content: {
|
|
7483
|
+
"application/json": {
|
|
7484
|
+
data?: {
|
|
7485
|
+
device: components["schemas"]["PendingWebhookDevice"];
|
|
7486
|
+
/** @enum {string} */
|
|
7487
|
+
previous_state: "available" | "limited" | "blocked" | "unknown";
|
|
7488
|
+
/** @enum {string} */
|
|
7489
|
+
state: "available" | "limited" | "blocked" | "unknown";
|
|
7490
|
+
/** Format: date-time */
|
|
7491
|
+
changed_at: string;
|
|
7492
|
+
/** @description The connect link that last connected the number, or `null`. */
|
|
7493
|
+
connect_link_id?: number | null;
|
|
7494
|
+
};
|
|
7495
|
+
};
|
|
7496
|
+
};
|
|
7497
|
+
};
|
|
7498
|
+
responses: never;
|
|
7499
|
+
};
|
|
7500
|
+
delete?: never;
|
|
7501
|
+
options?: never;
|
|
7502
|
+
head?: never;
|
|
7503
|
+
patch?: never;
|
|
7504
|
+
trace?: never;
|
|
7505
|
+
};
|
|
7355
7506
|
}
|
|
7356
7507
|
interface components {
|
|
7357
7508
|
schemas: {
|
|
@@ -8422,6 +8573,8 @@ interface components {
|
|
|
8422
8573
|
/** @description The statuses `message.status_changed` reports for the messages of this number. */
|
|
8423
8574
|
statuses: ("sent" | "delivered" | "read" | "failed")[];
|
|
8424
8575
|
};
|
|
8576
|
+
connection?: components["schemas"]["PendingDeviceConnection"];
|
|
8577
|
+
external_reference?: components["schemas"]["PendingExternalReference"];
|
|
8425
8578
|
};
|
|
8426
8579
|
/** DisconnectSurveyResource */
|
|
8427
8580
|
DisconnectSurveyResource: {
|
|
@@ -9587,6 +9740,115 @@ interface components {
|
|
|
9587
9740
|
/** Format: date-time */
|
|
9588
9741
|
updated_at?: string | null;
|
|
9589
9742
|
};
|
|
9743
|
+
/**
|
|
9744
|
+
* @description `qr`: connected by scanning a QR code (not official). `coexistence`: WhatsApp Cloud API together with the WhatsApp Business app. `dedicated`: WhatsApp Cloud API only. `null` when it cannot be told yet.
|
|
9745
|
+
* @enum {string|null}
|
|
9746
|
+
*/
|
|
9747
|
+
PendingDeviceConnection: "qr" | "coexistence" | "dedicated" | null;
|
|
9748
|
+
/** @description Your own reference for the number (for example the id of your customer). Free text, not unique. */
|
|
9749
|
+
PendingExternalReference: string | null;
|
|
9750
|
+
PendingDeviceCreate: {
|
|
9751
|
+
/**
|
|
9752
|
+
* @description How the number connects. Only `qr` for now: an official number is created through a connect link.
|
|
9753
|
+
* @enum {string}
|
|
9754
|
+
*/
|
|
9755
|
+
connection: "qr";
|
|
9756
|
+
/** @description The name of the number in the panel. */
|
|
9757
|
+
alias?: string;
|
|
9758
|
+
external_reference?: components["schemas"]["PendingExternalReference"];
|
|
9759
|
+
/** @description Adds QR to a number that already exists (in coexistence) instead of taking a new slot of the plan. */
|
|
9760
|
+
same_number_as?: number;
|
|
9761
|
+
country?: components["schemas"]["PendingCountry"];
|
|
9762
|
+
};
|
|
9763
|
+
PendingDeviceQr: {
|
|
9764
|
+
connected: boolean;
|
|
9765
|
+
/** @description A PNG image as a data URI, or `null` when the number is already connected. */
|
|
9766
|
+
qr_code: string | null;
|
|
9767
|
+
/** @description Seconds after which to ask for it again: 5 with a QR, 3 while the session starts, 0 once connected. WhatsApp changes the code every few seconds and an old one no longer links: show the latest one and have it scanned right away; do not store or forward a QR. */
|
|
9768
|
+
expires_in: number;
|
|
9769
|
+
};
|
|
9770
|
+
/** @enum {string} */
|
|
9771
|
+
PendingConnectLinkStatus: "pending" | "completed" | "failed" | "expired" | "revoked";
|
|
9772
|
+
/**
|
|
9773
|
+
* @description Why the link did not complete, or `null`.
|
|
9774
|
+
* @enum {string|null}
|
|
9775
|
+
*/
|
|
9776
|
+
PendingConnectLinkErrorCode: "link_expired" | "already_used" | "revoked" | "quota_exceeded" | "trial_number_blocked" | "facebook_auth_failed" | "meta_error" | "number_not_owned" | "qr_timeout" | "provider_error" | null;
|
|
9777
|
+
/** @enum {string} */
|
|
9778
|
+
PendingConnectLinkConnectionType: "coexistence" | "dedicated";
|
|
9779
|
+
PendingConnectLink: {
|
|
9780
|
+
id: number;
|
|
9781
|
+
/** @enum {string} */
|
|
9782
|
+
type: "meta" | "qr";
|
|
9783
|
+
/** @description A Meta link stays `pending` after a failure of Facebook or Meta, so your customer can try again on the page; the fifth failed attempt turns it `failed` (`facebook_auth_failed` or `meta_error`). `quota_exceeded`, `trial_number_blocked` and `number_not_owned` close it at the first attempt. */
|
|
9784
|
+
status: components["schemas"]["PendingConnectLinkStatus"];
|
|
9785
|
+
/** @description The page to send your customer to. It carries the token, so it comes only in the response of `POST connect-links`. */
|
|
9786
|
+
url?: string | null;
|
|
9787
|
+
/** Format: date-time */
|
|
9788
|
+
expires_at: string;
|
|
9789
|
+
allowed_connection_types: components["schemas"]["PendingConnectLinkConnectionType"][] | null;
|
|
9790
|
+
provision_us_number: boolean;
|
|
9791
|
+
/** @description Only `type: qr`: the country the WhatsApp session is opened from, lowercase; `null` when it was not sent. */
|
|
9792
|
+
country: string | null;
|
|
9793
|
+
/** @description The number the link reconnects, or the one it created once `completed`; `null` otherwise. */
|
|
9794
|
+
device_id: number | null;
|
|
9795
|
+
external_reference: components["schemas"]["PendingExternalReference"];
|
|
9796
|
+
return_url: string | null;
|
|
9797
|
+
/** @description Why the link did not complete (`link_expired` when it expired, `revoked` when revoked), or `null`. */
|
|
9798
|
+
error_code: components["schemas"]["PendingConnectLinkErrorCode"];
|
|
9799
|
+
/** Format: date-time */
|
|
9800
|
+
created_at: string;
|
|
9801
|
+
/** Format: date-time */
|
|
9802
|
+
completed_at: string | null;
|
|
9803
|
+
};
|
|
9804
|
+
PendingConnectLinkWithUrl: components["schemas"]["PendingConnectLink"] & {
|
|
9805
|
+
url: string;
|
|
9806
|
+
};
|
|
9807
|
+
PendingConnectLinkCreate: {
|
|
9808
|
+
/** @enum {string} */
|
|
9809
|
+
type: "meta";
|
|
9810
|
+
/** @description With both, your customer chooses on the page. */
|
|
9811
|
+
allowed_connection_types: components["schemas"]["PendingConnectLinkConnectionType"][];
|
|
9812
|
+
/** @description Offers a US number of the pool (3 per account, 1 on trial accounts, held 15 minutes). `false` by default. A pool number is always dedicated: it needs `dedicated` in `allowed_connection_types` and does not go with `device_id`; otherwise `422 invalid_request`. */
|
|
9813
|
+
provision_us_number?: boolean;
|
|
9814
|
+
/** @description Reconnects this number instead of creating one; takes no new slot. `type` must match how the number connects. */
|
|
9815
|
+
device_id?: number;
|
|
9816
|
+
external_reference?: components["schemas"]["PendingExternalReference"];
|
|
9817
|
+
/**
|
|
9818
|
+
* Format: uri
|
|
9819
|
+
* @description Only `https`. When the page finishes it redirects there with `connect_link_id`, `status`, `device_id` and `error_code`.
|
|
9820
|
+
*/
|
|
9821
|
+
return_url?: string;
|
|
9822
|
+
/** @description 1440 (24 hours) by default. */
|
|
9823
|
+
expires_in_minutes?: number;
|
|
9824
|
+
} | {
|
|
9825
|
+
/** @enum {string} */
|
|
9826
|
+
type: "qr";
|
|
9827
|
+
/** @description Adds QR to a number in coexistence. */
|
|
9828
|
+
same_number_as?: number;
|
|
9829
|
+
/** @description The country of the phone that will scan the QR code (ISO 3166-1 alpha-2): the WhatsApp session is opened from there. Not with `device_id` (`422 invalid_request`): a reconnection creates nothing. */
|
|
9830
|
+
country?: components["schemas"]["PendingCountry"];
|
|
9831
|
+
/** @description Reconnects this number instead of creating one; takes no new slot. `type` must match how the number connects. */
|
|
9832
|
+
device_id?: number;
|
|
9833
|
+
external_reference?: components["schemas"]["PendingExternalReference"];
|
|
9834
|
+
/**
|
|
9835
|
+
* Format: uri
|
|
9836
|
+
* @description Only `https`. When the page finishes it redirects there with `connect_link_id`, `status`, `device_id` and `error_code`.
|
|
9837
|
+
*/
|
|
9838
|
+
return_url?: string;
|
|
9839
|
+
/** @description 1440 (24 hours) by default. */
|
|
9840
|
+
expires_in_minutes?: number;
|
|
9841
|
+
};
|
|
9842
|
+
PendingWebhookDevice: {
|
|
9843
|
+
id: number;
|
|
9844
|
+
name: string | null;
|
|
9845
|
+
/** @description Digits only, without `+`. */
|
|
9846
|
+
number: string | null;
|
|
9847
|
+
connection?: components["schemas"]["PendingDeviceConnection"];
|
|
9848
|
+
external_reference?: components["schemas"]["PendingExternalReference"];
|
|
9849
|
+
};
|
|
9850
|
+
/** @description The country of the phone that will scan the QR code (ISO 3166-1 alpha-2, two letters, any case): the WhatsApp session is opened from there. Without it, Funnelchat chooses one. */
|
|
9851
|
+
PendingCountry: string | null;
|
|
9590
9852
|
};
|
|
9591
9853
|
responses: {
|
|
9592
9854
|
/** @description Unauthenticated */
|
|
@@ -17432,7 +17694,10 @@ interface operations {
|
|
|
17432
17694
|
};
|
|
17433
17695
|
"device.index": {
|
|
17434
17696
|
parameters: {
|
|
17435
|
-
query?:
|
|
17697
|
+
query?: {
|
|
17698
|
+
/** @description Only the numbers with this reference (exact match). */
|
|
17699
|
+
external_reference?: string;
|
|
17700
|
+
};
|
|
17436
17701
|
header?: never;
|
|
17437
17702
|
path?: never;
|
|
17438
17703
|
cookie?: never;
|
|
@@ -17483,6 +17748,35 @@ interface operations {
|
|
|
17483
17748
|
403: components["responses"]["AccountsAuthorizationException"];
|
|
17484
17749
|
};
|
|
17485
17750
|
};
|
|
17751
|
+
"pendingDevice.store": {
|
|
17752
|
+
parameters: {
|
|
17753
|
+
query?: never;
|
|
17754
|
+
header?: {
|
|
17755
|
+
/** @description Kept 24 hours per account and resource. Only a 2xx is replayed, with `Idempotent-Replayed: true`; a rejection is evaluated again. The same key with another body: `422 idempotency_key_mismatch`; while the first call runs: `409 operation_in_progress`; a malformed key: `422 invalid_idempotency_key`. */
|
|
17756
|
+
"Idempotency-Key"?: string;
|
|
17757
|
+
};
|
|
17758
|
+
path?: never;
|
|
17759
|
+
cookie?: never;
|
|
17760
|
+
};
|
|
17761
|
+
requestBody: {
|
|
17762
|
+
content: {
|
|
17763
|
+
"application/json": components["schemas"]["PendingDeviceCreate"];
|
|
17764
|
+
};
|
|
17765
|
+
};
|
|
17766
|
+
responses: {
|
|
17767
|
+
/** @description Created, with `connected: false` and `connection: "qr"`. */
|
|
17768
|
+
201: {
|
|
17769
|
+
headers: {
|
|
17770
|
+
[name: string]: unknown;
|
|
17771
|
+
};
|
|
17772
|
+
content: {
|
|
17773
|
+
"application/json": {
|
|
17774
|
+
data: components["schemas"]["DeviceResource"];
|
|
17775
|
+
};
|
|
17776
|
+
};
|
|
17777
|
+
};
|
|
17778
|
+
};
|
|
17779
|
+
};
|
|
17486
17780
|
"device.me": {
|
|
17487
17781
|
parameters: {
|
|
17488
17782
|
query?: never;
|
|
@@ -17640,6 +17934,7 @@ interface operations {
|
|
|
17640
17934
|
* account (defense in depth, see updateMetaDevice below).
|
|
17641
17935
|
*/
|
|
17642
17936
|
capi_consent?: boolean;
|
|
17937
|
+
external_reference?: components["schemas"]["PendingExternalReference"];
|
|
17643
17938
|
};
|
|
17644
17939
|
};
|
|
17645
17940
|
};
|
|
@@ -19733,6 +20028,134 @@ interface operations {
|
|
|
19733
20028
|
};
|
|
19734
20029
|
};
|
|
19735
20030
|
};
|
|
20031
|
+
"pendingDevice.qr": {
|
|
20032
|
+
parameters: {
|
|
20033
|
+
query?: never;
|
|
20034
|
+
header?: never;
|
|
20035
|
+
path: {
|
|
20036
|
+
/** @description The device ID */
|
|
20037
|
+
device: number;
|
|
20038
|
+
};
|
|
20039
|
+
cookie?: never;
|
|
20040
|
+
};
|
|
20041
|
+
requestBody?: never;
|
|
20042
|
+
responses: {
|
|
20043
|
+
/** @description OK */
|
|
20044
|
+
200: {
|
|
20045
|
+
headers: {
|
|
20046
|
+
[name: string]: unknown;
|
|
20047
|
+
};
|
|
20048
|
+
content: {
|
|
20049
|
+
"application/json": {
|
|
20050
|
+
data: components["schemas"]["PendingDeviceQr"];
|
|
20051
|
+
};
|
|
20052
|
+
};
|
|
20053
|
+
};
|
|
20054
|
+
};
|
|
20055
|
+
};
|
|
20056
|
+
"pendingConnectLink.index": {
|
|
20057
|
+
parameters: {
|
|
20058
|
+
query?: {
|
|
20059
|
+
status?: components["schemas"]["PendingConnectLinkStatus"];
|
|
20060
|
+
/** @description Exact match. */
|
|
20061
|
+
external_reference?: string;
|
|
20062
|
+
perPage?: number;
|
|
20063
|
+
page?: number;
|
|
20064
|
+
};
|
|
20065
|
+
header?: never;
|
|
20066
|
+
path?: never;
|
|
20067
|
+
cookie?: never;
|
|
20068
|
+
};
|
|
20069
|
+
requestBody?: never;
|
|
20070
|
+
responses: {
|
|
20071
|
+
/** @description OK */
|
|
20072
|
+
200: {
|
|
20073
|
+
headers: {
|
|
20074
|
+
[name: string]: unknown;
|
|
20075
|
+
};
|
|
20076
|
+
content: {
|
|
20077
|
+
"application/json": {
|
|
20078
|
+
data: components["schemas"]["PendingConnectLink"][];
|
|
20079
|
+
links?: Record<string, unknown>;
|
|
20080
|
+
meta?: Record<string, unknown>;
|
|
20081
|
+
};
|
|
20082
|
+
};
|
|
20083
|
+
};
|
|
20084
|
+
};
|
|
20085
|
+
};
|
|
20086
|
+
"pendingConnectLink.store": {
|
|
20087
|
+
parameters: {
|
|
20088
|
+
query?: never;
|
|
20089
|
+
header?: {
|
|
20090
|
+
/** @description Kept 24 hours per account. The same key with the same body answers the same response without creating another resource; with another body, `422 idempotency_key_mismatch`; while the first call runs, `409 operation_in_progress`. */
|
|
20091
|
+
"Idempotency-Key"?: string;
|
|
20092
|
+
};
|
|
20093
|
+
path?: never;
|
|
20094
|
+
cookie?: never;
|
|
20095
|
+
};
|
|
20096
|
+
requestBody: {
|
|
20097
|
+
content: {
|
|
20098
|
+
"application/json": components["schemas"]["PendingConnectLinkCreate"];
|
|
20099
|
+
};
|
|
20100
|
+
};
|
|
20101
|
+
responses: {
|
|
20102
|
+
/** @description Created. `url` carries the token and is shown only here. */
|
|
20103
|
+
201: {
|
|
20104
|
+
headers: {
|
|
20105
|
+
[name: string]: unknown;
|
|
20106
|
+
};
|
|
20107
|
+
content: {
|
|
20108
|
+
"application/json": {
|
|
20109
|
+
data: components["schemas"]["PendingConnectLinkWithUrl"];
|
|
20110
|
+
};
|
|
20111
|
+
};
|
|
20112
|
+
};
|
|
20113
|
+
};
|
|
20114
|
+
};
|
|
20115
|
+
"pendingConnectLink.show": {
|
|
20116
|
+
parameters: {
|
|
20117
|
+
query?: never;
|
|
20118
|
+
header?: never;
|
|
20119
|
+
path: {
|
|
20120
|
+
link: number;
|
|
20121
|
+
};
|
|
20122
|
+
cookie?: never;
|
|
20123
|
+
};
|
|
20124
|
+
requestBody?: never;
|
|
20125
|
+
responses: {
|
|
20126
|
+
/** @description OK */
|
|
20127
|
+
200: {
|
|
20128
|
+
headers: {
|
|
20129
|
+
[name: string]: unknown;
|
|
20130
|
+
};
|
|
20131
|
+
content: {
|
|
20132
|
+
"application/json": {
|
|
20133
|
+
data: components["schemas"]["PendingConnectLink"];
|
|
20134
|
+
};
|
|
20135
|
+
};
|
|
20136
|
+
};
|
|
20137
|
+
};
|
|
20138
|
+
};
|
|
20139
|
+
"pendingConnectLink.destroy": {
|
|
20140
|
+
parameters: {
|
|
20141
|
+
query?: never;
|
|
20142
|
+
header?: never;
|
|
20143
|
+
path: {
|
|
20144
|
+
link: number;
|
|
20145
|
+
};
|
|
20146
|
+
cookie?: never;
|
|
20147
|
+
};
|
|
20148
|
+
requestBody?: never;
|
|
20149
|
+
responses: {
|
|
20150
|
+
/** @description No Content */
|
|
20151
|
+
204: {
|
|
20152
|
+
headers: {
|
|
20153
|
+
[name: string]: unknown;
|
|
20154
|
+
};
|
|
20155
|
+
content?: never;
|
|
20156
|
+
};
|
|
20157
|
+
};
|
|
20158
|
+
};
|
|
19736
20159
|
"webhook.group_created": {
|
|
19737
20160
|
parameters: {
|
|
19738
20161
|
query?: never;
|
|
@@ -20641,6 +21064,16 @@ interface RequestOptions {
|
|
|
20641
21064
|
/** Cancels the request. */
|
|
20642
21065
|
signal?: AbortSignal;
|
|
20643
21066
|
}
|
|
21067
|
+
/** Options of the creates that take an `Idempotency-Key` (`devices.create`, `connectLinks.create`). */
|
|
21068
|
+
interface IdempotentRequestOptions extends RequestOptions {
|
|
21069
|
+
/**
|
|
21070
|
+
* Sent as the `Idempotency-Key` header (up to 255 characters, kept 24 hours per account). The same
|
|
21071
|
+
* key with the same body answers the same response without creating another resource, so after a
|
|
21072
|
+
* timeout or a `5xx` you can repeat the call with it safely. With another body: `422
|
|
21073
|
+
* idempotency_key_mismatch`; while the first call runs: `409 operation_in_progress`.
|
|
21074
|
+
*/
|
|
21075
|
+
idempotencyKey?: string;
|
|
21076
|
+
}
|
|
20644
21077
|
type PathPart<P extends ApiPath, M extends HttpMethod> = PathParams<P, M> extends undefined ? {
|
|
20645
21078
|
path?: undefined;
|
|
20646
21079
|
} : {
|
|
@@ -20688,6 +21121,66 @@ declare abstract class Resource {
|
|
|
20688
21121
|
#private;
|
|
20689
21122
|
constructor(client: Funnelchat);
|
|
20690
21123
|
protected get client(): Funnelchat;
|
|
21124
|
+
/** The options of a request with `idempotencyKey` turned into the `Idempotency-Key` header. */
|
|
21125
|
+
protected idempotent({ idempotencyKey, ...options }?: IdempotentRequestOptions): RequestOptions;
|
|
21126
|
+
}
|
|
21127
|
+
|
|
21128
|
+
type LinkId = PathParams<'/api/v1/connect-links/{link}', 'GET'>['link'];
|
|
21129
|
+
/**
|
|
21130
|
+
* Connect links (accounts area): a single-use page, on the Funnelchat domain, where your customer
|
|
21131
|
+
* connects a WhatsApp number to your account, by QR code (`type: 'qr'`) or as an official number
|
|
21132
|
+
* through the Meta sign-up (`type: 'meta'`). The number is created when the page finishes; with
|
|
21133
|
+
* `device_id` the link reconnects that number instead, without taking a new slot. The Meta sign-up
|
|
21134
|
+
* is not available in production yet: `type: 'meta'` answers `503 meta_connect_disabled` until it is.
|
|
21135
|
+
*
|
|
21136
|
+
* Reading needs `accounts:read`; creating and revoking, `accounts:operate`. The result arrives three
|
|
21137
|
+
* ways: the `device.connected` webhook (with `connect_link_id` and `external_reference`), the
|
|
21138
|
+
* `return_url`, or `get`. The other `device.*` events carry the link that last connected the number.
|
|
21139
|
+
*
|
|
21140
|
+
* Errors of their own (`APIError.code`): the rejections of `devices.create`, `429
|
|
21141
|
+
* too_many_open_links` (20 open links per account), `503 meta_connect_disabled`, `422
|
|
21142
|
+
* connection_type_mismatch` (`device_id` of a number that connects another way) and `409
|
|
21143
|
+
* link_not_pending` (revoking a link that already ended).
|
|
21144
|
+
*/
|
|
21145
|
+
declare class ConnectLinks extends Resource {
|
|
21146
|
+
/**
|
|
21147
|
+
* `POST /api/v1/connect-links`. `url` is the page to send your customer to: it carries the token
|
|
21148
|
+
* and comes only in this response.
|
|
21149
|
+
*
|
|
21150
|
+
* `provision_us_number` (a US number of the pool, always dedicated) needs `dedicated` in
|
|
21151
|
+
* `allowed_connection_types` and does not go with `device_id`: otherwise `422 invalid_request`.
|
|
21152
|
+
* A Meta link stays `pending` after a failure of Facebook or Meta, so your customer can try again;
|
|
21153
|
+
* the fifth failed attempt turns it `failed`.
|
|
21154
|
+
*
|
|
21155
|
+
* `country` (only `qr`, not with `device_id`) is the country of the phone that will scan the QR, in
|
|
21156
|
+
* two letters: the WhatsApp session is opened from there. The link returns it, lowercase.
|
|
21157
|
+
*/
|
|
21158
|
+
create(body: Body<'/api/v1/connect-links', 'POST'>, options?: IdempotentRequestOptions): APIPromise<{
|
|
21159
|
+
data: components["schemas"]["PendingConnectLinkWithUrl"];
|
|
21160
|
+
}>;
|
|
21161
|
+
/** `GET /api/v1/connect-links/{link}`: its `status`, and `device_id` and `error_code` once it ends. */
|
|
21162
|
+
get(link: LinkId, options?: RequestOptions): APIPromise<{
|
|
21163
|
+
data: components["schemas"]["PendingConnectLink"];
|
|
21164
|
+
}>;
|
|
21165
|
+
/** `GET /api/v1/connect-links`, paginated, newest first: filter by `status` or `external_reference`. */
|
|
21166
|
+
list(query?: Query<'/api/v1/connect-links'>, options?: RequestOptions): PagePromise<{
|
|
21167
|
+
id: number;
|
|
21168
|
+
type: "meta" | "qr";
|
|
21169
|
+
status: components["schemas"]["PendingConnectLinkStatus"];
|
|
21170
|
+
url?: string | null;
|
|
21171
|
+
expires_at: string;
|
|
21172
|
+
allowed_connection_types: components["schemas"]["PendingConnectLinkConnectionType"][] | null;
|
|
21173
|
+
provision_us_number: boolean;
|
|
21174
|
+
country: string | null;
|
|
21175
|
+
device_id: number | null;
|
|
21176
|
+
external_reference: components["schemas"]["PendingExternalReference"];
|
|
21177
|
+
return_url: string | null;
|
|
21178
|
+
error_code: components["schemas"]["PendingConnectLinkErrorCode"];
|
|
21179
|
+
created_at: string;
|
|
21180
|
+
completed_at: string | null;
|
|
21181
|
+
}>;
|
|
21182
|
+
/** `DELETE /api/v1/connect-links/{link}`: revokes a `pending` link (any other is `409 link_not_pending`). */
|
|
21183
|
+
revoke(link: LinkId, options?: RequestOptions): APIPromise<unknown>;
|
|
20691
21184
|
}
|
|
20692
21185
|
|
|
20693
21186
|
type ContactId$2 = PathParams<'/api/v1/contacts/{contact}', 'GET'>['contact'];
|
|
@@ -21080,50 +21573,29 @@ declare class CustomFields extends Resource {
|
|
|
21080
21573
|
}
|
|
21081
21574
|
|
|
21082
21575
|
type DeviceId$3 = PathParams<'/api/v1/devices/{device}', 'GET'>['device'];
|
|
21576
|
+
type Device = ListItem<'/api/v1/devices'>;
|
|
21083
21577
|
/** WhatsApp numbers of the account (accounts area). The `id` of a number is the `device_id` used to send. */
|
|
21084
21578
|
declare class Devices extends Resource {
|
|
21085
|
-
/**
|
|
21086
|
-
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
slot_state?: "free" | "reserved" | "pending" | "held";
|
|
21106
|
-
pool_suspended?: boolean;
|
|
21107
|
-
pool_suspension_reason?: "over_pool" | "payment_lapse" | null;
|
|
21108
|
-
pool_keep?: boolean;
|
|
21109
|
-
qr_allowed?: boolean;
|
|
21110
|
-
can_change_to_meta?: boolean;
|
|
21111
|
-
capabilities: {
|
|
21112
|
-
messages: {
|
|
21113
|
-
text: boolean;
|
|
21114
|
-
media: boolean;
|
|
21115
|
-
buttons: boolean;
|
|
21116
|
-
lists: boolean;
|
|
21117
|
-
templates: boolean;
|
|
21118
|
-
location: boolean;
|
|
21119
|
-
voice_note: boolean;
|
|
21120
|
-
polls: boolean;
|
|
21121
|
-
events: boolean;
|
|
21122
|
-
contact_card: boolean;
|
|
21123
|
-
reactions: boolean;
|
|
21124
|
-
};
|
|
21125
|
-
statuses: ("sent" | "delivered" | "read" | "failed")[];
|
|
21126
|
-
};
|
|
21579
|
+
/**
|
|
21580
|
+
* `GET /api/v1/devices`. Iterate it with `for await`, or `await` it for the first page.
|
|
21581
|
+
* `external_reference` keeps only the numbers with that reference (exact match).
|
|
21582
|
+
*/
|
|
21583
|
+
list(query?: Query<'/api/v1/devices'>, options?: RequestOptions): PagePromise<Device>;
|
|
21584
|
+
/** @deprecated The 0.1.2 signature, still supported: pass the options second, `list({}, options)`. */
|
|
21585
|
+
list(options: RequestOptions): PagePromise<Device>;
|
|
21586
|
+
/**
|
|
21587
|
+
* `POST /api/v1/devices`: creates a number that connects by QR code (`connection: 'qr'`), with
|
|
21588
|
+
* `connected: false`. Then show its QR with `qr`, or send your customer a connect link
|
|
21589
|
+
* (`connectLinks.create`). Needs `accounts:operate`. It takes a slot of the plan, with the panel's
|
|
21590
|
+
* rejections: `403 numbers_not_included`, `403 number_limit_reached`, `422 qr_requires_coexistence`
|
|
21591
|
+
* and `422 method_already_present` (`same_number_as` adds QR to a number in coexistence instead).
|
|
21592
|
+
* An account has at most one QR number waiting to be scanned: another one is `409
|
|
21593
|
+
* pending_number_exists`, with that number's `device_id` in `error.body`. `country` (two letters,
|
|
21594
|
+
* such as `'br'`) is the country of the phone that will scan the QR: the WhatsApp session is opened
|
|
21595
|
+
* from there.
|
|
21596
|
+
*/
|
|
21597
|
+
create(body: Body<'/api/v1/devices', 'POST'>, options?: IdempotentRequestOptions): APIPromise<{
|
|
21598
|
+
data: components["schemas"]["DeviceResource"];
|
|
21127
21599
|
}>;
|
|
21128
21600
|
/**
|
|
21129
21601
|
* `GET /api/v1/devices/{device}`. `capabilities` says what the number can do by API: message
|
|
@@ -21170,8 +21642,16 @@ declare class Devices extends Resource {
|
|
|
21170
21642
|
};
|
|
21171
21643
|
statuses: ("sent" | "delivered" | "read" | "failed")[];
|
|
21172
21644
|
};
|
|
21645
|
+
connection?: components["schemas"]["PendingDeviceConnection"];
|
|
21646
|
+
external_reference?: components["schemas"]["PendingExternalReference"];
|
|
21173
21647
|
}>;
|
|
21174
|
-
/**
|
|
21648
|
+
/**
|
|
21649
|
+
* `DELETE /api/v1/devices/{device}`: deletes the number and frees its slot of the plan. An
|
|
21650
|
+
* official number stops receiving through Funnelchat but stays registered with Meta; a QR one
|
|
21651
|
+
* logs out. Irreversible; needs `accounts:operate`. Sends `device.deleted`.
|
|
21652
|
+
*/
|
|
21653
|
+
delete(device: DeviceId$3, options?: RequestOptions): APIPromise<Record<string, unknown>>;
|
|
21654
|
+
/** `PUT /api/v1/devices/{device}`: also changes `external_reference`. */
|
|
21175
21655
|
update(device: DeviceId$3, body: Body<'/api/v1/devices/{device}', 'PUT'>, options?: RequestOptions): APIPromise<{
|
|
21176
21656
|
id: number;
|
|
21177
21657
|
alias: string;
|
|
@@ -21213,6 +21693,20 @@ declare class Devices extends Resource {
|
|
|
21213
21693
|
};
|
|
21214
21694
|
statuses: ("sent" | "delivered" | "read" | "failed")[];
|
|
21215
21695
|
};
|
|
21696
|
+
connection?: components["schemas"]["PendingDeviceConnection"];
|
|
21697
|
+
external_reference?: components["schemas"]["PendingExternalReference"];
|
|
21698
|
+
}>;
|
|
21699
|
+
/**
|
|
21700
|
+
* `GET /api/v1/devices/{device}/qr`: the QR code to scan, as a PNG data URI (`qr_code`), or `null`
|
|
21701
|
+
* once `connected`. Ask for it every `expires_in` seconds (5 with a QR, 3 while the session starts,
|
|
21702
|
+
* 0 once connected) and have it scanned right away: WhatsApp changes the code every few seconds and
|
|
21703
|
+
* an old one no longer links, so show the latest and never store or forward a QR. Only for QR
|
|
21704
|
+
* numbers (an official one is `422 provider_unsupported`); needs
|
|
21705
|
+
* `accounts:operate`, since scanning it gives control of a WhatsApp. A number that cannot connect now
|
|
21706
|
+
* answers `409` (`trial_number_blocked`, `number_suspended_by_plan`, `device_inactive`…).
|
|
21707
|
+
*/
|
|
21708
|
+
qr(device: DeviceId$3, options?: RequestOptions): APIPromise<{
|
|
21709
|
+
data: components["schemas"]["PendingDeviceQr"];
|
|
21216
21710
|
}>;
|
|
21217
21711
|
/** `GET /api/v1/devices/{device}/status`: connection status. */
|
|
21218
21712
|
status(device: DeviceId$3, options?: RequestOptions): APIPromise<Record<string, unknown>>;
|
|
@@ -21929,7 +22423,7 @@ interface WebhookEventInfo {
|
|
|
21929
22423
|
readonly pending: boolean;
|
|
21930
22424
|
readonly description: string | null;
|
|
21931
22425
|
}
|
|
21932
|
-
/** Every webhook event type known to the spec (
|
|
22426
|
+
/** Every webhook event type known to the spec (55). */
|
|
21933
22427
|
declare const webhookEvents: readonly [{
|
|
21934
22428
|
readonly type: "account.blocked";
|
|
21935
22429
|
readonly domains: readonly ["accounts"];
|
|
@@ -22043,13 +22537,25 @@ declare const webhookEvents: readonly [{
|
|
|
22043
22537
|
readonly domains: readonly ["accounts"];
|
|
22044
22538
|
readonly status: "live";
|
|
22045
22539
|
readonly pending: true;
|
|
22046
|
-
readonly description: "One of the numbers of the account got connected: by scanning the QR code
|
|
22540
|
+
readonly description: "One of the numbers of the account got connected: by scanning the QR code, by finishing the sign-up of a WhatsApp Cloud number, or through a connect link.";
|
|
22541
|
+
}, {
|
|
22542
|
+
readonly type: "device.deleted";
|
|
22543
|
+
readonly domains: readonly ["accounts"];
|
|
22544
|
+
readonly status: "planned";
|
|
22545
|
+
readonly pending: true;
|
|
22546
|
+
readonly description: "A number of the account was deleted: its slot of the plan is free again.";
|
|
22047
22547
|
}, {
|
|
22048
22548
|
readonly type: "device.disconnected";
|
|
22049
22549
|
readonly domains: readonly ["accounts"];
|
|
22050
22550
|
readonly status: "live";
|
|
22051
22551
|
readonly pending: true;
|
|
22052
|
-
readonly description: "One of the numbers of the account disconnected and can no longer send or receive.";
|
|
22552
|
+
readonly description: "One of the numbers of the account disconnected and can no longer send or receive: a QR session that closed or was protected from a shadow ban, an official number that failed its re-registration, or one disconnected from the panel.";
|
|
22553
|
+
}, {
|
|
22554
|
+
readonly type: "device.health_changed";
|
|
22555
|
+
readonly domains: readonly ["accounts"];
|
|
22556
|
+
readonly status: "planned";
|
|
22557
|
+
readonly pending: true;
|
|
22558
|
+
readonly description: "The health of an official number changed (what Meta lets it do). Emitted only when the overall state changes.";
|
|
22053
22559
|
}, {
|
|
22054
22560
|
readonly type: "flow.completed";
|
|
22055
22561
|
readonly domains: readonly ["conversations"];
|
|
@@ -22411,25 +22917,36 @@ interface WebhookEventDataMap {
|
|
|
22411
22917
|
leaves: number;
|
|
22412
22918
|
conversion_rate: number;
|
|
22413
22919
|
};
|
|
22414
|
-
/** `device.connected` (live, pending of the spec; typed from: schema). One of the numbers of the account got connected: by scanning the QR code
|
|
22920
|
+
/** `device.connected` (live, pending of the spec; typed from: schema). One of the numbers of the account got connected: by scanning the QR code, by finishing the sign-up of a WhatsApp Cloud number, or through a connect link. */
|
|
22415
22921
|
"device.connected": {
|
|
22416
|
-
device:
|
|
22417
|
-
id: number;
|
|
22418
|
-
name: string | null;
|
|
22419
|
-
/** Digits only, without `+`. */
|
|
22420
|
-
number: string | null;
|
|
22421
|
-
};
|
|
22922
|
+
device: components["schemas"]["PendingWebhookDevice"];
|
|
22422
22923
|
connected_at: string;
|
|
22924
|
+
/** The connect link of this connection, or `null` when it did not come from a link. */
|
|
22925
|
+
connect_link_id?: number | null;
|
|
22926
|
+
};
|
|
22927
|
+
/** `device.deleted` (planned, pending of the spec; typed from: schema). A number of the account was deleted: its slot of the plan is free again. */
|
|
22928
|
+
"device.deleted": {
|
|
22929
|
+
device: components["schemas"]["PendingWebhookDevice"];
|
|
22930
|
+
deleted_at: string;
|
|
22931
|
+
/** The connect link that last connected the number, or `null`. */
|
|
22932
|
+
connect_link_id?: number | null;
|
|
22423
22933
|
};
|
|
22424
|
-
/** `device.disconnected` (live, pending of the spec; typed from: schema). One of the numbers of the account disconnected and can no longer send or receive. */
|
|
22934
|
+
/** `device.disconnected` (live, pending of the spec; typed from: schema). One of the numbers of the account disconnected and can no longer send or receive: a QR session that closed or was protected from a shadow ban, an official number that failed its re-registration, or one disconnected from the panel. */
|
|
22425
22935
|
"device.disconnected": {
|
|
22426
|
-
device:
|
|
22427
|
-
id: number;
|
|
22428
|
-
name: string | null;
|
|
22429
|
-
/** Digits only, without `+`. */
|
|
22430
|
-
number: string | null;
|
|
22431
|
-
};
|
|
22936
|
+
device: components["schemas"]["PendingWebhookDevice"];
|
|
22432
22937
|
disconnected_at: string;
|
|
22938
|
+
reason?: "qr_logged_out" | "meta_account_not_registered" | "shadow_ban_protection" | "provider_error" | "unknown" | "disconnected_by_user";
|
|
22939
|
+
/** The connect link that last connected the number, or `null`. */
|
|
22940
|
+
connect_link_id?: number | null;
|
|
22941
|
+
};
|
|
22942
|
+
/** `device.health_changed` (planned, pending of the spec; typed from: schema). The health of an official number changed (what Meta lets it do). Emitted only when the overall state changes. */
|
|
22943
|
+
"device.health_changed": {
|
|
22944
|
+
device: components["schemas"]["PendingWebhookDevice"];
|
|
22945
|
+
previous_state: "available" | "limited" | "blocked" | "unknown";
|
|
22946
|
+
state: "available" | "limited" | "blocked" | "unknown";
|
|
22947
|
+
changed_at: string;
|
|
22948
|
+
/** The connect link that last connected the number, or `null`. */
|
|
22949
|
+
connect_link_id?: number | null;
|
|
22433
22950
|
};
|
|
22434
22951
|
/** `flow.completed` (live; typed from: example). Un contacto terminó un flujo de automatización. Se envía una sola vez por cada ejecución de un flujo, cuando termina con éxito. No se envía si la ejecución se cortó, se canceló, quedó bloqueada o falló. `contact` es `null` si la ejecución no tiene un contacto asociado. Un flujo muy usado puede generar muchos eventos seguidos. */
|
|
22435
22952
|
"flow.completed": {
|
|
@@ -22868,7 +23385,9 @@ interface PendingEventData {
|
|
|
22868
23385
|
* Sources (production, 22-10): platform-gate v0.8.0 as pinned by accounts v1.4.24; api-edge v0.3.0
|
|
22869
23386
|
* (src/index.ts); conversations v1.18.10 (Message/Services/ApiSendGuard.php,
|
|
22870
23387
|
* Message/Support/ApiKeySendResponse.php, WhatsappForm/Support/FormSendPreflight.php). The spec
|
|
22871
|
-
* does not document most of them yet; when it does, this list can be generated.
|
|
23388
|
+
* does not document most of them yet; when it does, this list can be generated. The codes of
|
|
23389
|
+
* creating and connecting numbers come from contract 1022-alta-de-numeros v0.1 (23-10-2026, with
|
|
23390
|
+
* its amendment from accounts feat/alta-de-numeros-api 52d49b319), not from production yet.
|
|
22872
23391
|
*/
|
|
22873
23392
|
/** Errors of the API entry and of the key gate, on any route. */
|
|
22874
23393
|
declare const ACCESS_ERROR_CODES: {
|
|
@@ -22931,13 +23450,75 @@ declare const SEND_ERROR_CODES: {
|
|
|
22931
23450
|
/** 422: the number cannot send forms. */
|
|
22932
23451
|
readonly number_not_eligible: 422;
|
|
22933
23452
|
};
|
|
23453
|
+
/**
|
|
23454
|
+
* Rejections of creating a number (`devices.create`), asking for its QR (`devices.qr`) or creating,
|
|
23455
|
+
* reading or revoking a connect link: nothing was created. The quota of the plan is the same as in
|
|
23456
|
+
* the panel. A code that comes with two statuses has the one of the create here; the other is noted.
|
|
23457
|
+
*/
|
|
23458
|
+
declare const NUMBER_ERROR_CODES: {
|
|
23459
|
+
/** 403: the plan of the account does not include numbers. */
|
|
23460
|
+
readonly numbers_not_included: 403;
|
|
23461
|
+
/** 403: the account already uses every number of its plan (`limit`, `used`, `pending_device_ids` in the body). */
|
|
23462
|
+
readonly number_limit_reached: 403;
|
|
23463
|
+
/** 403: the account cannot connect numbers now. */
|
|
23464
|
+
readonly connect_not_allowed: 403;
|
|
23465
|
+
/** 403: `devices.qr` of a number whose payment is due. */
|
|
23466
|
+
readonly payment_required: 403;
|
|
23467
|
+
/**
|
|
23468
|
+
* 409: the account already has a QR number waiting to be scanned (at most one): its `device_id`
|
|
23469
|
+
* comes in the body. Show that one's QR, or delete it, instead of creating another.
|
|
23470
|
+
*/
|
|
23471
|
+
readonly pending_number_exists: 409;
|
|
23472
|
+
/** 422 (409 on `devices.qr`): QR can only be added to an official number that is in coexistence. */
|
|
23473
|
+
readonly qr_requires_coexistence: 422;
|
|
23474
|
+
/** 422: the number already has that connection method; the body brings its `device_id`. */
|
|
23475
|
+
readonly method_already_present: 422;
|
|
23476
|
+
/** 422: `same_number_as` or `device_id` is not a number of the account that can take it. */
|
|
23477
|
+
readonly invalid_reference_device: 422;
|
|
23478
|
+
/** 422: a connect link with `device_id` of a number that connects another way than `type`. */
|
|
23479
|
+
readonly connection_type_mismatch: 422;
|
|
23480
|
+
/** 422 (409 on `devices.qr`): the number is suspended because the plan has fewer numbers than the account uses. */
|
|
23481
|
+
readonly number_suspended_by_plan: 422;
|
|
23482
|
+
/** 422: the body is not valid; `errors` says which fields. */
|
|
23483
|
+
readonly invalid_request: 422;
|
|
23484
|
+
/** 409: `devices.qr` of a trial number that is blocked. */
|
|
23485
|
+
readonly trial_number_blocked: 409;
|
|
23486
|
+
/** 409: `devices.qr` of a number that is turned off. */
|
|
23487
|
+
readonly device_inactive: 409;
|
|
23488
|
+
/** 409: `devices.qr` when no more QR sessions can be started now. */
|
|
23489
|
+
readonly provisioning_quota_exceeded: 409;
|
|
23490
|
+
/** 409: revoking a connect link that is no longer `pending`. */
|
|
23491
|
+
readonly link_not_pending: 409;
|
|
23492
|
+
/** 429: the account has 20 connect links open. Revoke some, or wait for them to end. Not worth retrying. */
|
|
23493
|
+
readonly too_many_open_links: 429;
|
|
23494
|
+
/** 500 (502 on `devices.qr`): the WhatsApp provider failed. */
|
|
23495
|
+
readonly provider_error: 500;
|
|
23496
|
+
/** 503: official numbers (`type: 'meta'`) cannot be connected by link yet. QR links work. Not worth retrying. */
|
|
23497
|
+
readonly meta_connect_disabled: 503;
|
|
23498
|
+
/** 403: the connect page was opened with an API key or a session. The page is for your customer, without credentials. */
|
|
23499
|
+
readonly credentials_not_allowed: 403;
|
|
23500
|
+
};
|
|
23501
|
+
/** Rejections of a create sent with `idempotencyKey`. */
|
|
23502
|
+
declare const IDEMPOTENCY_ERROR_CODES: {
|
|
23503
|
+
/** 422: the key was already used with another body. Use a new key for a new resource. */
|
|
23504
|
+
readonly idempotency_key_mismatch: 422;
|
|
23505
|
+
/** 422: the key is not 1 to 255 characters. */
|
|
23506
|
+
readonly invalid_idempotency_key: 422;
|
|
23507
|
+
/** 409: the first call with that key, or another operation on the number, is still running. Read the state, or repeat it later. */
|
|
23508
|
+
readonly operation_in_progress: 409;
|
|
23509
|
+
};
|
|
22934
23510
|
type AccessErrorCode = keyof typeof ACCESS_ERROR_CODES;
|
|
22935
23511
|
/** An error code of a send rejected by the WhatsApp rules (`APIError.code`). */
|
|
22936
23512
|
type SendErrorCode = keyof typeof SEND_ERROR_CODES;
|
|
23513
|
+
/** An error code of creating a number or a connect link (`APIError.code`). */
|
|
23514
|
+
type NumberErrorCode = keyof typeof NUMBER_ERROR_CODES;
|
|
23515
|
+
type IdempotencyErrorCode = keyof typeof IDEMPOTENCY_ERROR_CODES;
|
|
22937
23516
|
/** Every `error` code the SDK knows. The API can send others: treat `code` as a `string`. */
|
|
22938
|
-
type KnownErrorCode = AccessErrorCode | SendErrorCode;
|
|
23517
|
+
type KnownErrorCode = AccessErrorCode | SendErrorCode | NumberErrorCode | IdempotencyErrorCode;
|
|
22939
23518
|
/** Whether an `APIError.code` is a rejection of a send: nothing was sent and nothing was stored. */
|
|
22940
23519
|
declare function isSendRuleError(code: string | undefined): code is SendErrorCode;
|
|
23520
|
+
/** Whether an `APIError.code` is a rejection by the number quota of the plan (the same as the panel's). */
|
|
23521
|
+
declare function isNumberQuotaError(code: string | undefined): code is 'numbers_not_included' | 'number_limit_reached' | 'pending_number_exists' | 'qr_requires_coexistence' | 'method_already_present';
|
|
22941
23522
|
|
|
22942
23523
|
/**
|
|
22943
23524
|
* Errors thrown by the SDK.
|
|
@@ -23030,14 +23611,16 @@ declare class UnprocessableEntityError extends APIError {
|
|
|
23030
23611
|
}
|
|
23031
23612
|
/**
|
|
23032
23613
|
* `429`: rate limit (`rate_limited`, `daily_cap_exceeded`; `retryAfter` says how many seconds to
|
|
23033
|
-
* wait)
|
|
23034
|
-
* does not fix.
|
|
23614
|
+
* wait), the monthly active contacts (`mac_lockout_24h`, `mac_limit_reached`) or the open connect
|
|
23615
|
+
* links (`too_many_open_links`), which waiting does not fix.
|
|
23035
23616
|
*/
|
|
23036
23617
|
declare class RateLimitError extends APIError {
|
|
23037
23618
|
}
|
|
23038
23619
|
/**
|
|
23039
23620
|
* `5xx`. `502 origin_unreachable` and `500 edge_misconfigured` come from the API entry. After a
|
|
23040
|
-
* `5xx` on a write, read the state before repeating it: it may have been applied
|
|
23621
|
+
* `5xx` on a write, read the state before repeating it: it may have been applied (or repeat a create
|
|
23622
|
+
* with the same `idempotencyKey`). `503 meta_connect_disabled`: official numbers cannot be connected
|
|
23623
|
+
* by link yet.
|
|
23041
23624
|
*/
|
|
23042
23625
|
declare class InternalServerError extends APIError {
|
|
23043
23626
|
}
|
|
@@ -23325,7 +23908,7 @@ declare class Funnelchat {
|
|
|
23325
23908
|
readonly verify: typeof verify;
|
|
23326
23909
|
readonly constructEvent: typeof constructEvent;
|
|
23327
23910
|
};
|
|
23328
|
-
static readonly VERSION = "0.
|
|
23911
|
+
static readonly VERSION = "0.2.0";
|
|
23329
23912
|
readonly baseUrl: string;
|
|
23330
23913
|
readonly timeoutMs: number;
|
|
23331
23914
|
readonly maxRetries: number;
|
|
@@ -23339,6 +23922,8 @@ declare class Funnelchat {
|
|
|
23339
23922
|
readonly customFields: CustomFields;
|
|
23340
23923
|
readonly groups: Groups;
|
|
23341
23924
|
readonly devices: Devices;
|
|
23925
|
+
/** Single-use pages where your customer connects a WhatsApp number to your account. */
|
|
23926
|
+
readonly connectLinks: ConnectLinks;
|
|
23342
23927
|
/** Webhook subscriptions, plus `verify` and `constructEvent`. */
|
|
23343
23928
|
readonly webhooks: Webhooks;
|
|
23344
23929
|
constructor(options?: ClientOptions);
|
|
@@ -23384,10 +23969,10 @@ interface RouteInfo {
|
|
|
23384
23969
|
readonly summary: string | null;
|
|
23385
23970
|
readonly pending: boolean;
|
|
23386
23971
|
}
|
|
23387
|
-
/** Every operation of the spec (
|
|
23972
|
+
/** Every operation of the spec (264), sorted by path. */
|
|
23388
23973
|
declare const routes: readonly RouteInfo[];
|
|
23389
23974
|
|
|
23390
23975
|
/** The SDK version, sent in the `User-Agent`. A test keeps it equal to package.json. */
|
|
23391
|
-
declare const VERSION = "0.
|
|
23976
|
+
declare const VERSION = "0.2.0";
|
|
23392
23977
|
|
|
23393
|
-
export { ACCESS_ERROR_CODES, APIConnectionError, APIConnectionTimeoutError, APIError, APIPromise, type APIResponse, APIUserAbortError, type AccessErrorCode, type ApiPath, AuthenticationError, BASE_URLS, BadRequestError, type Body, type ClientOptions, ConflictError, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, DEFAULT_TOLERANCE_SECONDS, type Environment, type FieldErrors, Funnelchat, FunnelchatError, type HttpMethod, InternalServerError, type KnownErrorCode, type ListItem, NotFoundError, Page, PagePromise, type PathParams, PermissionDeniedError, type Query, type QueryParams, REQUEST_ID_HEADER, RateLimitError, type RawBody, type RequestBody, type RequestOptions, type ResponseBody, type RouteInfo, SEND_ERROR_CODES, SIGNATURE_HEADER, type SendErrorCode, type SendMessageParams, type TypedRequestOptions, UnprocessableEntityError, UnsupportedMediaTypeError, type UntypedRequestOptions, VERSION, type VerifyOptions, type WebhookEvent, type WebhookEventData, type WebhookEventEnvelope, type WebhookEventInfo, type WebhookEventOf, type WebhookEventType, type webhooks as WebhookSchemas, WebhookVerificationError, type WebhookVerificationFailure, type components, constructEvent, Funnelchat as default, isSendRuleError, type operations, type paths, routes, verify, webhookEvents };
|
|
23978
|
+
export { ACCESS_ERROR_CODES, APIConnectionError, APIConnectionTimeoutError, APIError, APIPromise, type APIResponse, APIUserAbortError, type AccessErrorCode, type ApiPath, AuthenticationError, BASE_URLS, BadRequestError, type Body, type ClientOptions, ConflictError, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, DEFAULT_TOLERANCE_SECONDS, type Environment, type FieldErrors, Funnelchat, FunnelchatError, type HttpMethod, IDEMPOTENCY_ERROR_CODES, type IdempotencyErrorCode, type IdempotentRequestOptions, InternalServerError, type KnownErrorCode, type ListItem, NUMBER_ERROR_CODES, NotFoundError, type NumberErrorCode, Page, PagePromise, type PathParams, PermissionDeniedError, type Query, type QueryParams, REQUEST_ID_HEADER, RateLimitError, type RawBody, type RequestBody, type RequestOptions, type ResponseBody, type RouteInfo, SEND_ERROR_CODES, SIGNATURE_HEADER, type SendErrorCode, type SendMessageParams, type TypedRequestOptions, UnprocessableEntityError, UnsupportedMediaTypeError, type UntypedRequestOptions, VERSION, type VerifyOptions, type WebhookEvent, type WebhookEventData, type WebhookEventEnvelope, type WebhookEventInfo, type WebhookEventOf, type WebhookEventType, type webhooks as WebhookSchemas, WebhookVerificationError, type WebhookVerificationFailure, type components, constructEvent, Funnelchat as default, isNumberQuotaError, isSendRuleError, type operations, type paths, routes, verify, webhookEvents };
|