@apostlejs/whatsapp 0.0.19 → 0.1.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/dist/index.cjs +791 -1
- package/dist/index.d.cts +489 -2222
- package/{LICENSE.md → license} +1 -1
- package/package.json +17 -27
package/dist/index.d.cts
CHANGED
|
@@ -1,2241 +1,508 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import * as _apostlejs_whatsapp_api0 from "@apostlejs/whatsapp-api";
|
|
2
|
+
import { CreateFlowRequestWrapper, WhatsappApiClient, WhatsappApiContact, WhatsappApiErrors, WhatsappApiFlowActionPayload, WhatsappApiFlowCategory, WhatsappApiFlowDetail, WhatsappApiFlowMedia, WhatsappApiFlowMode, WhatsappApiInteractiveFlowAction, WhatsappApiInteractiveMessage, WhatsappApiIsoCountryCode, WhatsappApiLanguageTag, WhatsappApiSendMessageRequest, WhatsappApiTemplateMessage, WhatsappApiWebhookFlowDecryptedBody, WhatsappApiWebhookFlowEncryptedBody, WhatsappApiWebhookFlowPingResponse, WhatsappApiWebhookFlowResponse, WhatsappApiWebhookMessageObject, WhatsappApiWebhookMessageStatus, WhatsappApiWebhookMessageType } from "@apostlejs/whatsapp-api";
|
|
3
|
+
import { UUID } from "node:crypto";
|
|
4
|
+
import { Exact } from "type-fest";
|
|
5
|
+
|
|
6
|
+
//#region \0rolldown/runtime.js
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/models/chat/value-objects/chat-url.v-object.d.ts
|
|
9
|
+
declare class ChatURL {
|
|
10
|
+
private phoneNumber;
|
|
11
|
+
private prefilled?;
|
|
12
|
+
constructor(phoneNumber: string, prefilled?: string | undefined);
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/models/context/models/config.model.d.ts
|
|
17
|
+
type WhatsappConfig = {
|
|
18
|
+
metaGraphApiVersion?: string;
|
|
19
|
+
metaAppAccessToken?: string;
|
|
20
|
+
metaAppSecretKey?: string;
|
|
21
|
+
whatsappNumberId?: string;
|
|
22
|
+
whatsappMessageNamespace?: string;
|
|
23
|
+
whatsappFlowsMode?: string;
|
|
24
|
+
whatsappWebhookToken?: string;
|
|
25
|
+
whatsappAccountId?: string;
|
|
26
|
+
whatsappAccountEncryptionPrivateKey?: string;
|
|
27
|
+
whatsappAccountEncryptionPassphrase?: string;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/models/waba/models/waba-encryption.model.d.ts
|
|
31
|
+
declare class WabaEncryption<Generated extends boolean = false> {
|
|
32
|
+
readonly passphrase: UUID;
|
|
33
|
+
readonly privateKey: string;
|
|
34
|
+
readonly publicKey: Generated extends true ? string : string | undefined;
|
|
35
|
+
constructor(args: {
|
|
36
|
+
privateKey: string;
|
|
37
|
+
passphrase: UUID;
|
|
38
|
+
publicKey?: string;
|
|
39
|
+
});
|
|
40
|
+
static generate(): WabaEncryption<true>;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/models/context/models/context.model.d.ts
|
|
44
|
+
type WhatsappContext = {
|
|
45
|
+
config: WhatsappConfig;
|
|
46
|
+
client: WhatsappApiClient;
|
|
47
|
+
encryption?: WabaEncryption;
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/models/flow/models/flow-encryption-metadata.model.d.ts
|
|
51
|
+
type WhatsappFlowEncryptionMetadata = {
|
|
52
|
+
aesKeyBuffer: Buffer;
|
|
53
|
+
initialVectorBuffer: Buffer;
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/models/flow/models/flow-json.model.d.ts
|
|
57
|
+
type WhatsappFlowJSON = {
|
|
58
|
+
version: "7.3";
|
|
59
|
+
data_api_version: "4.0";
|
|
60
|
+
routing_model: Partial<Record<PropertyKey, Array<PropertyKey>>>;
|
|
61
|
+
screens: Array<any>;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/models/flow/models/flow-metadata.model.d.ts
|
|
65
|
+
type WhatsappFlowMetadata = {
|
|
66
|
+
name: string;
|
|
67
|
+
categories: WhatsappApiFlowCategory[];
|
|
68
|
+
applicationId?: string;
|
|
69
|
+
endpointUri?: string;
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/models/flow/models/flow-parameters.model.d.ts
|
|
73
|
+
type WhatsappFlowParameters = Record<string, string | number>;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/models/flow/models/flow-token.model.d.ts
|
|
76
|
+
declare class FlowToken {
|
|
77
|
+
chatId: string;
|
|
78
|
+
flowName: string;
|
|
79
|
+
flowParameters: Record<string, string | number>;
|
|
80
|
+
flowIdentifier: string;
|
|
81
|
+
constructor(args: {
|
|
82
|
+
chatId: string;
|
|
83
|
+
flowName: string;
|
|
84
|
+
flowParameters?: Record<string, string | number>;
|
|
85
|
+
flowIdentifier?: string;
|
|
86
|
+
});
|
|
87
|
+
static fromString(token: string): FlowToken;
|
|
88
|
+
toString(): string;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/models/flow/requests/get-flow-preview.i-request.d.ts
|
|
92
|
+
type WhatsappGetFlowWebPreviewPageRequestQuery = {
|
|
93
|
+
name: string;
|
|
94
|
+
action: WhatsappApiInteractiveFlowAction;
|
|
95
|
+
phoneNumber: string;
|
|
96
|
+
recipientId: string;
|
|
97
|
+
interactive?: boolean;
|
|
98
|
+
payload?: WhatsappApiFlowActionPayload;
|
|
99
|
+
parameters?: WhatsappFlowParameters;
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/models/flow/services/crypto/flow-body.i-decryptor.d.ts
|
|
103
|
+
type WhatsappFlowWebhookDecryptor = (encryptedBody: WhatsappApiWebhookFlowEncryptedBody) => {
|
|
104
|
+
body: WhatsappApiWebhookFlowDecryptedBody;
|
|
105
|
+
encryptionMetadata: {
|
|
61
106
|
aesKeyBuffer: Buffer;
|
|
62
107
|
initialVectorBuffer: Buffer;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
type
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
type WhatsappDeleteFlowResponse = {
|
|
135
|
-
success: boolean;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
type FlowStatus = "DRAFT" | "PUBLISHED" | "DEPRECATED" | "BLOCKED" | "THROTTLED";
|
|
139
|
-
type FlowCanSendMessageStatus = "AVAILABLE" | "LIMITED" | "BLOCKED";
|
|
140
|
-
|
|
141
|
-
interface FlowValidationError {
|
|
142
|
-
error: string;
|
|
143
|
-
error_type: string;
|
|
144
|
-
message: string;
|
|
145
|
-
line_start: number;
|
|
146
|
-
line_end: number;
|
|
147
|
-
column_start: number;
|
|
148
|
-
column_end: number;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
type WhatsappGetFlowWebPreviewPageRequestQuery = {
|
|
152
|
-
flow_token: string;
|
|
153
|
-
flow_action: "data_exchange" | "navigate";
|
|
154
|
-
phone_number: string;
|
|
155
|
-
flow_action_payload?: {
|
|
156
|
-
screen: string;
|
|
157
|
-
data: Record<string, AnyType>;
|
|
158
|
-
};
|
|
159
|
-
interactive?: boolean;
|
|
160
|
-
};
|
|
161
|
-
type WhatsappGetFlowWebPreviewURLResponse = {
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/models/flow/services/crypto/flow-media.i-decryptor.d.ts
|
|
112
|
+
type WhatsappFlowMediaDecryptor = (media: WhatsappApiFlowMedia, defaultUrl?: string) => Promise<Buffer>;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/models/flow/services/crypto/flow-response.i-encryptor.d.ts
|
|
115
|
+
type WhatsappFlowResponseEncryptor = (response: WhatsappApiWebhookFlowResponse | WhatsappApiWebhookFlowPingResponse, encryptionMetadata: WhatsappFlowEncryptionMetadata) => string;
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/models/i18n/enums/language-tag.model.d.ts
|
|
118
|
+
declare enum WhatsappLanguageTag {
|
|
119
|
+
AR_SA = "ar-SA",
|
|
120
|
+
BN_BD = "bn-BD",
|
|
121
|
+
BN_IN = "bn-IN",
|
|
122
|
+
CS_CZ = "cs-CZ",
|
|
123
|
+
DA_DK = "da-DK",
|
|
124
|
+
DE_AT = "de-AT",
|
|
125
|
+
DE_CH = "de-CH",
|
|
126
|
+
DE_DE = "de-DE",
|
|
127
|
+
EL_GR = "el-GR",
|
|
128
|
+
EN_AU = "en-AU",
|
|
129
|
+
EN_CA = "en-CA",
|
|
130
|
+
EN_GB = "en-GB",
|
|
131
|
+
EN_IE = "en-IE",
|
|
132
|
+
EN_IN = "en-IN",
|
|
133
|
+
EN_NZ = "en-NZ",
|
|
134
|
+
EN_US = "en-US",
|
|
135
|
+
EN_ZA = "en-ZA",
|
|
136
|
+
ES_AR = "es-AR",
|
|
137
|
+
ES_CL = "es-CL",
|
|
138
|
+
ES_CO = "es-CO",
|
|
139
|
+
ES_ES = "es-ES",
|
|
140
|
+
ES_MX = "es-MX",
|
|
141
|
+
ES_US = "es-US",
|
|
142
|
+
FI_FI = "fi-FI",
|
|
143
|
+
FR_BE = "fr-BE",
|
|
144
|
+
FR_CA = "fr-CA",
|
|
145
|
+
FR_CH = "fr-CH",
|
|
146
|
+
FR_FR = "fr-FR",
|
|
147
|
+
HE_IL = "he-IL",
|
|
148
|
+
HI_IN = "hi-IN",
|
|
149
|
+
HU_HU = "hu-HU",
|
|
150
|
+
ID_ID = "id-ID",
|
|
151
|
+
IT_CH = "it-CH",
|
|
152
|
+
IT_IT = "it-IT",
|
|
153
|
+
JA_JP = "ja-JP",
|
|
154
|
+
KO_KR = "ko-KR",
|
|
155
|
+
NL_BE = "nl-BE",
|
|
156
|
+
NL_NL = "nl-NL",
|
|
157
|
+
NO_NO = "no-NO",
|
|
158
|
+
PL_PL = "pl-PL",
|
|
159
|
+
PT_BR = "pt-BR",
|
|
160
|
+
PT_PT = "pt-PT",
|
|
161
|
+
RO_RO = "ro-RO",
|
|
162
|
+
RU_RU = "ru-RU",
|
|
163
|
+
SK_SK = "sk-SK",
|
|
164
|
+
SV_SE = "sv-SE",
|
|
165
|
+
TA_IN = "ta-IN",
|
|
166
|
+
TA_LK = "ta-LK",
|
|
167
|
+
TH_TH = "th-TH",
|
|
168
|
+
TR_TR = "tr-TR",
|
|
169
|
+
ZH_CN = "zh-CN",
|
|
170
|
+
ZH_HK = "zh-HK",
|
|
171
|
+
ZH_TW = "zh-TW"
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/models/message/messages/button.d.ts
|
|
175
|
+
type WhatsappButtonMessage = Omit<WhatsappApiInteractiveMessage, "action" | "type"> & {
|
|
176
|
+
type: "button";
|
|
177
|
+
buttons: Array<{
|
|
162
178
|
id: string;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
type
|
|
170
|
-
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
179
|
+
text: string;
|
|
180
|
+
}>;
|
|
181
|
+
};
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/models/message/messages/contact.d.ts
|
|
184
|
+
type WhatsappContactMessage = {
|
|
185
|
+
type: "contact";
|
|
186
|
+
contacts: WhatsappApiContact[];
|
|
187
|
+
};
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/models/message/messages/flow.d.ts
|
|
190
|
+
type Base = {
|
|
191
|
+
name: string;
|
|
192
|
+
button: string;
|
|
193
|
+
mode?: WhatsappApiFlowMode;
|
|
194
|
+
identifier?: string;
|
|
195
|
+
parameters?: WhatsappFlowParameters;
|
|
196
|
+
action?: WhatsappApiInteractiveFlowAction;
|
|
197
|
+
payload?: WhatsappApiFlowActionPayload;
|
|
198
|
+
};
|
|
199
|
+
type Navigate = Base & {
|
|
200
|
+
action?: "navigate";
|
|
201
|
+
payload: WhatsappApiFlowActionPayload;
|
|
202
|
+
};
|
|
203
|
+
type Exchange = Base & {
|
|
204
|
+
action?: "data_exchange";
|
|
205
|
+
payload?: WhatsappApiFlowActionPayload;
|
|
206
|
+
};
|
|
207
|
+
type Flow = Navigate | Exchange;
|
|
208
|
+
type WhatsappFlowMessage = Omit<WhatsappApiInteractiveMessage, "action" | "type"> & {
|
|
209
|
+
type: "flow";
|
|
210
|
+
flow: Flow;
|
|
211
|
+
};
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/models/message/messages/list.d.ts
|
|
214
|
+
type WhatsappListMessage = Omit<WhatsappApiInteractiveMessage, "action" | "type"> & {
|
|
215
|
+
type: "list";
|
|
216
|
+
list: {
|
|
217
|
+
button: string;
|
|
218
|
+
sections: Array<{
|
|
219
|
+
rows: Array<{
|
|
191
220
|
id: string;
|
|
192
|
-
name: string;
|
|
193
|
-
status: FlowStatus;
|
|
194
|
-
categories: FlowCategory[];
|
|
195
|
-
validation_errors: FlowValidationError[];
|
|
196
|
-
}>;
|
|
197
|
-
paging: {
|
|
198
|
-
cursors: {
|
|
199
|
-
before: string;
|
|
200
|
-
after: string;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
type WhatsappPublishFlowResponse = {
|
|
206
|
-
success: boolean;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
type WhatsappUpdateFlowJsonRequestBody = {
|
|
210
|
-
name: "flow.json";
|
|
211
|
-
asset_type: "FLOW_JSON";
|
|
212
|
-
file: AnyType;
|
|
213
|
-
};
|
|
214
|
-
type WhatsappUpdateFlowJsonResponse = {
|
|
215
|
-
success: boolean;
|
|
216
|
-
validation_errors: FlowValidationError[];
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
type WhatsappFlowUpdateMetadataRequestBody = {
|
|
220
|
-
name?: string;
|
|
221
|
-
categories?: FlowCategory[];
|
|
222
|
-
endpoint_uri?: string;
|
|
223
|
-
application_id?: string;
|
|
224
|
-
};
|
|
225
|
-
type WhatsappFlowUpdateMetadataResponse = {
|
|
226
|
-
success: boolean;
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
declare const flowsEndpoints: {
|
|
230
|
-
create: Endpoint<"/{waba_id}/flows", "post", {
|
|
231
|
-
body: WhatsappCreateFlowRequestBody;
|
|
232
|
-
}, WhatsappCreateFlowResponse>;
|
|
233
|
-
updateMetadata: Endpoint<"/{flow_id}", "post", {
|
|
234
|
-
body: WhatsappFlowUpdateMetadataRequestBody;
|
|
235
|
-
}, WhatsappFlowUpdateMetadataResponse>;
|
|
236
|
-
readMany: Endpoint<"/{waba_id}/flows", "get", IRequest, WhatsappGetManyFlowsRequestResponse>;
|
|
237
|
-
delete: Endpoint<"/{flow_id}", "delete", IRequest, WhatsappDeleteFlowResponse>;
|
|
238
|
-
read: Endpoint<"/{flow_id}", "get", {
|
|
239
|
-
query: WhatsappGetFlowsRequestQuery;
|
|
240
|
-
}, WhatsappGetManyFlowsRequestResponse>;
|
|
241
|
-
updateJson: Endpoint<"/{flow_id}/assets", "post", {
|
|
242
|
-
body: WhatsappUpdateFlowJsonRequestBody;
|
|
243
|
-
}, WhatsappUpdateFlowJsonResponse>;
|
|
244
|
-
getPreview: Endpoint<"/{flow_id}?fields=preview.invalidate(false)", "get", IRequest, WhatsappGetFlowWebPreviewURLResponse>;
|
|
245
|
-
publish: Endpoint<"/{flow_id}/publish", "post", IRequest, WhatsappPublishFlowResponse>;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
type WhatsappMediaRetrieveRequestResponse = {
|
|
249
|
-
messaging_product: "whatsapp";
|
|
250
|
-
url: string;
|
|
251
|
-
mime_type: string;
|
|
252
|
-
sha256: string;
|
|
253
|
-
file_size: number;
|
|
254
|
-
id: string;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
declare const mediaEndpoints: {
|
|
258
|
-
fetch: Endpoint<"/{media_id}", "get", {
|
|
259
|
-
query: {
|
|
260
|
-
phone_number_id?: string;
|
|
261
|
-
};
|
|
262
|
-
}, WhatsappMediaRetrieveRequestResponse>;
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
interface WaIncomingContactObject {
|
|
266
|
-
wa_id: string;
|
|
267
|
-
profile: {
|
|
268
|
-
name: string;
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
type WaIncomingContacts = Array<WaIncomingContactObject>;
|
|
272
|
-
|
|
273
|
-
type WaOutgoingContactsMessage = Array<{
|
|
274
|
-
addresses?: Array<Partial<{
|
|
275
|
-
street: string;
|
|
276
|
-
city: string;
|
|
277
|
-
state: string;
|
|
278
|
-
zip: string;
|
|
279
|
-
country: string;
|
|
280
|
-
country_code: string;
|
|
281
|
-
type: string;
|
|
282
|
-
}>>;
|
|
283
|
-
birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
|
|
284
|
-
emails?: Array<Partial<{
|
|
285
|
-
email: string;
|
|
286
|
-
type: string;
|
|
287
|
-
}>>;
|
|
288
|
-
name: {
|
|
289
|
-
formatted_name: string;
|
|
290
|
-
first_name?: string;
|
|
291
|
-
last_name?: string;
|
|
292
|
-
middle_name?: string;
|
|
293
|
-
prefix?: string;
|
|
294
|
-
suffix?: string;
|
|
295
|
-
};
|
|
296
|
-
org?: Partial<{
|
|
297
|
-
company: string;
|
|
298
|
-
department: string;
|
|
299
221
|
title: string;
|
|
222
|
+
description?: string;
|
|
223
|
+
}>;
|
|
224
|
+
title: string;
|
|
300
225
|
}>;
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}>;
|
|
311
|
-
|
|
312
|
-
type MediaTypes = "sticker" | "audio" | "document" | "image" | "video";
|
|
313
|
-
type WaOutgoingImageMessage = {
|
|
314
|
-
id: string;
|
|
315
|
-
caption?: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/models/message/messages/media.d.ts
|
|
230
|
+
type WhatsappMediaMessage = {
|
|
231
|
+
type: "media";
|
|
232
|
+
sticker: {
|
|
233
|
+
ref: string;
|
|
234
|
+
};
|
|
316
235
|
} | {
|
|
317
|
-
|
|
236
|
+
type: "media";
|
|
237
|
+
image: {
|
|
238
|
+
ref: string;
|
|
318
239
|
caption?: string;
|
|
319
|
-
};
|
|
320
|
-
type WaOutgoingDocumentMessage = {
|
|
321
|
-
id: string;
|
|
322
|
-
caption?: string;
|
|
323
|
-
filename?: string;
|
|
240
|
+
};
|
|
324
241
|
} | {
|
|
325
|
-
|
|
242
|
+
type: "media";
|
|
243
|
+
document: {
|
|
244
|
+
ref: string;
|
|
326
245
|
caption?: string;
|
|
327
246
|
filename?: string;
|
|
328
|
-
};
|
|
329
|
-
type WaOutgoingAudioMessage = {
|
|
330
|
-
id: string;
|
|
247
|
+
};
|
|
331
248
|
} | {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
caption?: string;
|
|
249
|
+
type: "media";
|
|
250
|
+
audio: {
|
|
251
|
+
ref: string;
|
|
252
|
+
};
|
|
337
253
|
} | {
|
|
338
|
-
|
|
254
|
+
type: "media";
|
|
255
|
+
video: {
|
|
256
|
+
ref: string;
|
|
339
257
|
caption?: string;
|
|
340
|
-
};
|
|
341
|
-
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/models/message/messages/template.d.ts
|
|
262
|
+
type WhatsappTemplateMessage = Omit<WhatsappApiTemplateMessage, "namespace" | "language"> & {
|
|
263
|
+
type: "template";
|
|
264
|
+
language: `${WhatsappLanguageTag}`;
|
|
265
|
+
};
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/models/message/messages/text.d.ts
|
|
268
|
+
type WhatsappTextMessage = {
|
|
269
|
+
type: "text";
|
|
270
|
+
text: string;
|
|
271
|
+
previewUrl?: boolean;
|
|
272
|
+
};
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/models/message/models/message.model.d.ts
|
|
275
|
+
type WhatsappMessage = WhatsappButtonMessage | WhatsappFlowMessage | WhatsappListMessage | WhatsappTextMessage | WhatsappTemplateMessage | WhatsappMediaMessage | WhatsappContactMessage;
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/models/message/requests/send-message.i-request.d.ts
|
|
278
|
+
type WhatsappSendMessageRequest = {
|
|
279
|
+
showUrlPreviewImage?: boolean;
|
|
280
|
+
metadata?: string;
|
|
281
|
+
to: string;
|
|
282
|
+
reply?: string;
|
|
283
|
+
message: WhatsappMessage;
|
|
284
|
+
};
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/models/message/requests/show-typing-indicator.i-request.d.ts
|
|
287
|
+
type WhatsappShowTypingIndicatorRequest = {
|
|
288
|
+
messageId: string;
|
|
289
|
+
};
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/models/waba/services/generators/waba-encryption.i-generator.d.ts
|
|
292
|
+
type WhatsappWabaEncryptionGenerator = () => {
|
|
293
|
+
passphrase: UUID;
|
|
294
|
+
publicKey: string;
|
|
295
|
+
privateKey: string;
|
|
296
|
+
};
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/models/webhook/webhooks/flows/flow-exchange.i-webhook.d.ts
|
|
299
|
+
type WhatsappWebhookFlow = {
|
|
300
|
+
payload: WhatsappApiWebhookFlowDecryptedBody;
|
|
301
|
+
pingResponse: WhatsappApiWebhookFlowPingResponse;
|
|
302
|
+
encryptionMetadata: WhatsappFlowEncryptionMetadata;
|
|
303
|
+
};
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/models/webhook/kind/received-media.kind.d.ts
|
|
306
|
+
type WhatsappReceivedMediaKind = "audio" | "document" | "image" | "video";
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/models/webhook/webhooks/messages/message-received.i-webhook.d.ts
|
|
309
|
+
type WhatsappMessageReceivedWebhook = {
|
|
310
|
+
id: string;
|
|
311
|
+
type: WhatsappApiWebhookMessageType;
|
|
312
|
+
timestamp: number;
|
|
313
|
+
metadata: {
|
|
314
|
+
forwarded?: boolean;
|
|
315
|
+
frequentlyForwarded?: boolean;
|
|
316
|
+
};
|
|
317
|
+
chatId: string;
|
|
318
|
+
text: string | null;
|
|
319
|
+
reply?: string;
|
|
320
|
+
interaction?: {
|
|
321
|
+
button?: {
|
|
322
|
+
id: string | null;
|
|
323
|
+
title: string;
|
|
324
|
+
payload: string | null;
|
|
325
|
+
};
|
|
326
|
+
selectedOption?: {
|
|
327
|
+
id: string;
|
|
328
|
+
title: string;
|
|
329
|
+
description: string;
|
|
330
|
+
};
|
|
331
|
+
flowResponse?: {
|
|
332
|
+
flow_token: string;
|
|
333
|
+
} & {
|
|
334
|
+
[key: string]: any;
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
media?: {
|
|
342
338
|
id: string;
|
|
343
|
-
|
|
344
|
-
link: string;
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
interface WaInteractiveAction {
|
|
348
|
-
name?: "flow";
|
|
349
|
-
parameters?: {
|
|
350
|
-
flow_message_version?: "3";
|
|
351
|
-
flow_token?: string;
|
|
352
|
-
flow_name?: string;
|
|
353
|
-
flow_cta?: string;
|
|
354
|
-
flow_action?: "navigate" | "data_exchange";
|
|
355
|
-
flow_action_payload?: {
|
|
356
|
-
screen: string;
|
|
357
|
-
data?: Record<string, AnyType>;
|
|
358
|
-
};
|
|
359
|
-
mode: "draft" | "published";
|
|
360
|
-
};
|
|
361
|
-
button?: string;
|
|
362
|
-
buttons?: Array<{
|
|
363
|
-
type: "reply";
|
|
364
|
-
reply: {
|
|
365
|
-
title: string;
|
|
366
|
-
id: string;
|
|
367
|
-
};
|
|
368
|
-
}>;
|
|
369
|
-
catalog_id?: string;
|
|
370
|
-
product_retailer_id?: string;
|
|
371
|
-
sections?: Array<{
|
|
372
|
-
product_items?: Array<{
|
|
373
|
-
product_retailer_id: string;
|
|
374
|
-
}>;
|
|
375
|
-
rows: Array<{
|
|
376
|
-
id: string;
|
|
377
|
-
title: string;
|
|
378
|
-
description?: string;
|
|
379
|
-
}>;
|
|
380
|
-
title: string;
|
|
381
|
-
}>;
|
|
382
|
-
mode?: "draft" | "published";
|
|
383
|
-
}
|
|
384
|
-
interface WaInteractiveBody {
|
|
385
|
-
text: string;
|
|
386
|
-
}
|
|
387
|
-
interface WaInteractiveFooter {
|
|
388
|
-
text: string;
|
|
389
|
-
}
|
|
390
|
-
type WaInteractiveHeader = {
|
|
391
|
-
sub_text?: string;
|
|
392
|
-
} & ({
|
|
393
|
-
type: "text";
|
|
394
|
-
text: string;
|
|
395
|
-
} | {
|
|
396
|
-
video: WaOutgoingVideoMessage;
|
|
397
|
-
type: "video";
|
|
398
|
-
} | {
|
|
399
|
-
type: "document";
|
|
400
|
-
document: WaOutgoingDocumentMessage;
|
|
401
|
-
} | {
|
|
402
|
-
image: WaOutgoingImageMessage;
|
|
403
|
-
type: "image";
|
|
404
|
-
});
|
|
405
|
-
type WaInteractiveActionType = "button" | "catalog_message" | "list" | "product" | "product_list" | "flow";
|
|
406
|
-
interface WaInteractiveBase {
|
|
407
|
-
type: WaInteractiveActionType;
|
|
408
|
-
body?: WaInteractiveBody;
|
|
409
|
-
footer?: WaInteractiveFooter;
|
|
410
|
-
header?: WaInteractiveHeader;
|
|
411
|
-
}
|
|
412
|
-
type WaOutgoingInteractiveMessage = WaInteractiveBase & {
|
|
413
|
-
action: WaInteractiveAction;
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
interface WaOutgoingLocationMessage {
|
|
417
|
-
latitude: number;
|
|
418
|
-
longitude: number;
|
|
419
|
-
name: string;
|
|
420
|
-
address: string;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
interface WaOutgoingReactionMessage {
|
|
424
|
-
message_id: string;
|
|
425
|
-
emoji: string;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
type WhatsappLanguageTag = "af" | "sq" | "ar" | "az" | "bn" | "bg" | "ca" | "zh_CN" | "zh_HK" | "zh_TW" | "hr" | "cs" | "da" | "nl" | "en" | "en_GB" | "en_US" | "et" | "fil" | "fi" | "fr" | "de" | "el" | "gu" | "ha" | "he" | "hi" | "hu" | "id" | "ga" | "it" | "ja" | "kn" | "kk" | "ko" | "lo" | "lv" | "lt" | "mk" | "ms" | "ml" | "mr" | "nb" | "fa" | "pl" | "pt_PT" | "pt_BR" | "pa" | "ro" | "ru" | "sr" | "sk" | "sl" | "es" | "es_AR" | "es_ES" | "es_MX" | "sw" | "sv" | "ta" | "te" | "th" | "tr" | "uk" | "ur" | "uz" | "vi" | "zu";
|
|
429
|
-
|
|
430
|
-
type WaOutgoingTemplateMessage = {
|
|
431
|
-
name: string;
|
|
432
|
-
language: {
|
|
433
|
-
code: WhatsappLanguageTag;
|
|
434
|
-
};
|
|
435
|
-
namespace?: string;
|
|
436
|
-
components?: Array<{
|
|
437
|
-
type: "header" | "body" | "footer";
|
|
438
|
-
parameters: Array<{
|
|
439
|
-
type: "text" | "image" | "video" | "document";
|
|
440
|
-
text?: string;
|
|
441
|
-
image?: WaOutgoingImageMessage;
|
|
442
|
-
video?: WaOutgoingDocumentMessage;
|
|
443
|
-
document?: WaOutgoingVideoMessage;
|
|
444
|
-
}>;
|
|
445
|
-
} | {
|
|
446
|
-
type: "button";
|
|
447
|
-
sub_type: "quick_reply" | "url" | "copy_code";
|
|
448
|
-
index: string;
|
|
449
|
-
parameters: Array<{
|
|
450
|
-
type: "payload" | "text" | "coupon_code";
|
|
451
|
-
payload?: string;
|
|
452
|
-
text?: string;
|
|
453
|
-
coupon_code?: string;
|
|
454
|
-
}>;
|
|
455
|
-
}>;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
interface WaOutgoingTextMessage {
|
|
459
|
-
body: string;
|
|
460
|
-
preview_url?: boolean;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
interface WaOutgoingMessage {
|
|
464
|
-
text?: WaOutgoingTextMessage;
|
|
465
|
-
contacts?: WaOutgoingContactsMessage;
|
|
466
|
-
reaction?: WaOutgoingReactionMessage;
|
|
467
|
-
location?: WaOutgoingLocationMessage;
|
|
468
|
-
audio?: WaOutgoingAudioMessage;
|
|
469
|
-
document?: WaOutgoingDocumentMessage;
|
|
470
|
-
image?: WaOutgoingImageMessage;
|
|
471
|
-
video?: WaOutgoingVideoMessage;
|
|
472
|
-
sticker?: WaOutgoingStickerMessage;
|
|
473
|
-
interactive?: WaOutgoingInteractiveMessage;
|
|
474
|
-
template?: WaOutgoingTemplateMessage;
|
|
475
|
-
}
|
|
476
|
-
type WaMessageType = keyof WaOutgoingMessage;
|
|
477
|
-
|
|
478
|
-
type WhatsappSendMessageRequestConfig = {
|
|
479
|
-
to: string;
|
|
480
|
-
preview_url?: boolean;
|
|
481
|
-
context?: {
|
|
482
|
-
message_id: string;
|
|
483
|
-
};
|
|
484
|
-
biz_opaque_callback_data?: string;
|
|
485
|
-
recipient_type?: "individual";
|
|
486
|
-
messaging_product?: "whatsapp";
|
|
487
|
-
};
|
|
488
|
-
type WhatsappSendMessageRequestBody<T extends keyof WaOutgoingMessage> = {
|
|
489
|
-
type: T;
|
|
490
|
-
} & WhatsappSendMessageRequestConfig & Record<T, WaOutgoingMessage[T]>;
|
|
491
|
-
type WhatsappSendMessageResponse = {
|
|
492
|
-
messaging_product: "whatsapp";
|
|
493
|
-
contacts: WaIncomingContactObject[];
|
|
494
|
-
messages: Array<{
|
|
495
|
-
id: string;
|
|
496
|
-
}>;
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
type WhatsappShowTypingIndicatorRequestBody = {
|
|
500
|
-
messaging_product: "whatsapp";
|
|
501
|
-
status: "read";
|
|
502
|
-
message_id: string;
|
|
503
|
-
typing_indicator: {
|
|
504
|
-
type: "text";
|
|
505
|
-
};
|
|
506
|
-
};
|
|
507
|
-
type WhatsappShowTypingIndicatorRequestResponse = {
|
|
508
|
-
success: boolean;
|
|
509
|
-
};
|
|
510
|
-
|
|
511
|
-
declare const messagesEndpoints: {
|
|
512
|
-
send: Endpoint<"/{number_id}/messages", "post", {
|
|
513
|
-
body: WhatsappSendMessageRequestBody<any>;
|
|
514
|
-
}, WhatsappSendMessageResponse>;
|
|
515
|
-
showTypingIndicator: Endpoint<"/{number_id}/messages", "post", {
|
|
516
|
-
body: WhatsappShowTypingIndicatorRequestBody;
|
|
517
|
-
}, WhatsappShowTypingIndicatorRequestResponse>;
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
type WhatsappISOCountryCode = "AU" | "ID" | "IN" | "JP" | "SG" | "KR" | "DE" | "CH" | "GB" | "BR" | "BH" | "ZA" | "AE" | "CA";
|
|
521
|
-
|
|
522
|
-
type WhatsappRegisterPhoneNumberRequestBody = {
|
|
523
|
-
messaging_product: "whatsapp";
|
|
524
|
-
pin: string;
|
|
525
|
-
data_localization_region?: WhatsappISOCountryCode;
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
type WhatsappWabaUploadEncryptionRequestBody = {
|
|
529
|
-
business_public_key: string;
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
declare const wabaEndpoints: {
|
|
533
|
-
updateEncryption: Endpoint<"/{number_id}/whatsapp_business_encryption", "post", {
|
|
534
|
-
body: WhatsappWabaUploadEncryptionRequestBody;
|
|
535
|
-
}, unknown>;
|
|
536
|
-
registerNumber: Endpoint<"/{number_id}/register", "post", {
|
|
537
|
-
body: WhatsappRegisterPhoneNumberRequestBody;
|
|
538
|
-
}, unknown>;
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
type WaIncomingErrorObject = {
|
|
542
|
-
code: number;
|
|
543
|
-
title: string;
|
|
544
|
-
message: string;
|
|
545
|
-
error_data: {
|
|
546
|
-
details: string;
|
|
547
|
-
};
|
|
548
|
-
};
|
|
549
|
-
type WaIncomingErrors = Array<WaIncomingErrorObject>;
|
|
550
|
-
|
|
551
|
-
type ConversationType = "authentication" | "service" | "utility" | "marketing" | "referral_conversation";
|
|
552
|
-
type WaIncomingMessageStatus = "delivered" | "read" | "sent";
|
|
553
|
-
type WaIncomingMessageStatuses = Array<{
|
|
554
|
-
id: string;
|
|
555
|
-
biz_opaque_callback_data: string;
|
|
556
|
-
conversation: {
|
|
557
|
-
id: string;
|
|
558
|
-
origin: {
|
|
559
|
-
type: ConversationType;
|
|
560
|
-
};
|
|
561
|
-
expiration_timestamp: number;
|
|
562
|
-
};
|
|
563
|
-
errors: WaIncomingErrors;
|
|
564
|
-
pricing: {
|
|
565
|
-
category: ConversationType;
|
|
566
|
-
pricing_model: "CBP";
|
|
567
|
-
};
|
|
568
|
-
recipient_id: string;
|
|
569
|
-
status: WaIncomingMessageStatus;
|
|
570
|
-
timestamp: number;
|
|
571
|
-
}>;
|
|
572
|
-
|
|
573
|
-
interface WaIncomingInteractiveObject {
|
|
574
|
-
type: "button_reply" | "list_reply" | "nfm_reply";
|
|
575
|
-
button_reply?: {
|
|
576
|
-
id: string;
|
|
577
|
-
title: string;
|
|
578
|
-
};
|
|
579
|
-
list_reply?: {
|
|
580
|
-
id: string;
|
|
581
|
-
title: string;
|
|
582
|
-
description: string;
|
|
583
|
-
};
|
|
584
|
-
nfm_reply?: {
|
|
585
|
-
response_json: string;
|
|
586
|
-
body: string;
|
|
587
|
-
name: "flow";
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
interface WaIncomingOrderObject {
|
|
591
|
-
catalog_id: string;
|
|
592
|
-
text: string;
|
|
593
|
-
product_items: Array<{
|
|
594
|
-
product_retailer_id: string;
|
|
595
|
-
quantity: number;
|
|
596
|
-
item_price: string;
|
|
597
|
-
currency: string;
|
|
598
|
-
}>;
|
|
599
|
-
}
|
|
600
|
-
interface WaIncomingReferralObject {
|
|
601
|
-
source_url: string;
|
|
602
|
-
source_type: string;
|
|
603
|
-
source_id: string;
|
|
604
|
-
headline: string;
|
|
605
|
-
body: string;
|
|
606
|
-
media_type: string;
|
|
607
|
-
image_url: string;
|
|
608
|
-
video_url: string;
|
|
609
|
-
thumbnail_url: string;
|
|
610
|
-
ctwa_clid: string;
|
|
611
|
-
}
|
|
612
|
-
interface WaIncomingStickerObject {
|
|
613
|
-
mime_type: string;
|
|
614
|
-
sha256: string;
|
|
615
|
-
id: string;
|
|
616
|
-
animated: string;
|
|
617
|
-
}
|
|
618
|
-
interface WaIncomingSystemObject {
|
|
619
|
-
body: string;
|
|
620
|
-
identity: string;
|
|
621
|
-
new_wa_id: string;
|
|
622
|
-
wa_id: string;
|
|
623
|
-
type: {
|
|
624
|
-
customer_changed_number: string;
|
|
625
|
-
customer_identity_changed: string;
|
|
626
|
-
};
|
|
627
|
-
customer_changed_number: string;
|
|
628
|
-
customer_identity_changed: string;
|
|
629
|
-
customer: string;
|
|
630
|
-
}
|
|
631
|
-
interface WaIncomingContextObject {
|
|
632
|
-
forwarded: boolean;
|
|
633
|
-
frequently_forwarded: boolean;
|
|
634
|
-
from: string;
|
|
635
|
-
id: string;
|
|
636
|
-
referred_product?: {
|
|
637
|
-
catalog_id: string;
|
|
638
|
-
product_retailer_id: string;
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
interface WaIncomingButtonObject {
|
|
642
|
-
payload: string;
|
|
643
|
-
text: string;
|
|
644
|
-
}
|
|
645
|
-
interface WaIncomingDocumentObject {
|
|
339
|
+
type: WhatsappReceivedMediaKind;
|
|
646
340
|
caption: string | null;
|
|
647
|
-
filename: string;
|
|
648
|
-
sha256: string;
|
|
649
341
|
mime_type: string;
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
statuses?: WaIncomingMessageStatuses;
|
|
720
|
-
};
|
|
721
|
-
field: "messages";
|
|
722
|
-
};
|
|
723
|
-
|
|
724
|
-
type WhatsappApplicationWebhookBody = {
|
|
725
|
-
/**
|
|
726
|
-
* Value will always be "whatsapp_business_account"
|
|
727
|
-
*/
|
|
728
|
-
object: "whatsapp_business_account";
|
|
729
|
-
/**
|
|
730
|
-
* An array of entry objects. Each entry object contains an array of changes objects. Meta will send multiple entries in case there's a big load on their systems.
|
|
731
|
-
*/
|
|
732
|
-
entry: Array<{
|
|
733
|
-
/**
|
|
734
|
-
* The WABA account id that is subscribed to the webhook. Useful when dealing with multiple numbers within the same company.
|
|
735
|
-
*/
|
|
736
|
-
id: string;
|
|
737
|
-
/**
|
|
738
|
-
* An array of changes objects. Each changes object contains the value of the change and the field that was changed. Meta will send multiple changes in case there's a big load on their systems.
|
|
739
|
-
*/
|
|
740
|
-
changes: Array<MessageField>;
|
|
741
|
-
}>;
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
type FlowData<K extends string = string> = Record<K, AnyType>;
|
|
745
|
-
|
|
746
|
-
interface FlowMetadata {
|
|
747
|
-
name: string;
|
|
748
|
-
categories: FlowCategory[];
|
|
749
|
-
application_id?: string;
|
|
750
|
-
endpoint_uri?: string;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
/**
|
|
754
|
-
* Cloud API Error Codes
|
|
755
|
-
*
|
|
756
|
-
* Enum representing specific error codes returned by the Cloud API.
|
|
757
|
-
*/
|
|
758
|
-
declare enum WhatsappErrorCode {
|
|
759
|
-
/**
|
|
760
|
-
* Error Code: 0
|
|
761
|
-
*
|
|
762
|
-
* Details:
|
|
763
|
-
* AuthException
|
|
764
|
-
*
|
|
765
|
-
* Description:
|
|
766
|
-
* We were unable to authenticate the app user. Typically this means the included access token has expired, been invalidated, or the app user has changed a setting to prevent all apps from accessing their data.
|
|
767
|
-
*
|
|
768
|
-
* Solution:
|
|
769
|
-
* We recommend that you get a new access token from the app user.
|
|
770
|
-
*
|
|
771
|
-
* HTTP Response:
|
|
772
|
-
* 401 - Unauthorized
|
|
773
|
-
*/
|
|
774
|
-
e0AuthException = 0,
|
|
775
|
-
/**
|
|
776
|
-
* Error Code: 3
|
|
777
|
-
*
|
|
778
|
-
* Details:
|
|
779
|
-
* API Method
|
|
780
|
-
*
|
|
781
|
-
* Description:
|
|
782
|
-
* Capability or permissions issue.
|
|
783
|
-
*
|
|
784
|
-
* Solution:
|
|
785
|
-
* Use the access token debugger to verify that your app has been granted the permissions required by the endpoint.
|
|
786
|
-
*
|
|
787
|
-
* HTTP Response:
|
|
788
|
-
* 500 - Internal Server Error
|
|
789
|
-
*/
|
|
790
|
-
e3ApiMethod = 3,
|
|
791
|
-
/**
|
|
792
|
-
* Error Code: 10
|
|
793
|
-
*
|
|
794
|
-
* Details:
|
|
795
|
-
* Permission Denied
|
|
796
|
-
*
|
|
797
|
-
* Description:
|
|
798
|
-
* Permission is either not granted or has been removed.
|
|
799
|
-
*
|
|
800
|
-
* Solution:
|
|
801
|
-
* Use the access token debugger to verify that your app has been granted the permissions required by the endpoint. Ensure that the phone number used to set the business public key is allowlisted.
|
|
802
|
-
*
|
|
803
|
-
* HTTP Response:
|
|
804
|
-
* 403 - Forbidden
|
|
805
|
-
*/
|
|
806
|
-
e10PermissionDenied = 10,
|
|
807
|
-
/**
|
|
808
|
-
* Error Code: 190
|
|
809
|
-
*
|
|
810
|
-
* Details:
|
|
811
|
-
* Access token has expired
|
|
812
|
-
*
|
|
813
|
-
* Description:
|
|
814
|
-
* Your access token has expired.
|
|
815
|
-
*
|
|
816
|
-
* Solution:
|
|
817
|
-
* Get a new access token.
|
|
818
|
-
*
|
|
819
|
-
* HTTP Response:
|
|
820
|
-
* 401 - Unauthorized
|
|
821
|
-
*/
|
|
822
|
-
e190AccessTokenExpired = 190,
|
|
823
|
-
/**
|
|
824
|
-
* Error Code: 200-299
|
|
825
|
-
*
|
|
826
|
-
* Details:
|
|
827
|
-
* API Permission
|
|
828
|
-
*
|
|
829
|
-
* Description:
|
|
830
|
-
* Permission is either not granted or has been removed within the 200-299 range of API Permission errors.
|
|
831
|
-
*
|
|
832
|
-
* Solution:
|
|
833
|
-
* Use the access token debugger to verify that your app has been granted the permissions required by the endpoint.
|
|
834
|
-
*
|
|
835
|
-
* HTTP Response:
|
|
836
|
-
* 403 - Forbidden
|
|
837
|
-
*/
|
|
838
|
-
e2xxApiPermission = 200,
|
|
839
|
-
/**
|
|
840
|
-
* Error Code: 368
|
|
841
|
-
*
|
|
842
|
-
* Details:
|
|
843
|
-
* Temporarily blocked for policies violations
|
|
844
|
-
*
|
|
845
|
-
* Description:
|
|
846
|
-
* The WhatsApp Business Account associated with the app has been restricted or disabled for violating a platform policy.
|
|
847
|
-
*
|
|
848
|
-
* Solution:
|
|
849
|
-
* See the Policy Enforcement document to learn about policy violations and how to resolve them.
|
|
850
|
-
*
|
|
851
|
-
* HTTP Response:
|
|
852
|
-
* 403 - Forbidden
|
|
853
|
-
*/
|
|
854
|
-
e368TemporarilyBlockedForPolicyViolations = 368,
|
|
855
|
-
/**
|
|
856
|
-
* Error Code: 130497
|
|
857
|
-
*
|
|
858
|
-
* Details:
|
|
859
|
-
* Business account is restricted from messaging users in this country.
|
|
860
|
-
*
|
|
861
|
-
* Description:
|
|
862
|
-
* The WhatsApp Business Account is restricted from messaging to users in certain countries.
|
|
863
|
-
*
|
|
864
|
-
* Solution:
|
|
865
|
-
* See WhatsApp Business Messaging Policy for details on allowed countries for messaging in your business category.
|
|
866
|
-
*
|
|
867
|
-
* HTTP Response:
|
|
868
|
-
* 403 - Forbidden
|
|
869
|
-
*/
|
|
870
|
-
e130497BusinessAccountRestrictedByCountry = 130497,
|
|
871
|
-
/**
|
|
872
|
-
* Error Code: 131031
|
|
873
|
-
*
|
|
874
|
-
* Details:
|
|
875
|
-
* Account has been locked
|
|
876
|
-
*
|
|
877
|
-
* Description:
|
|
878
|
-
* The WhatsApp Business Account associated with the app has been restricted or disabled for violating a platform policy, or we were unable to verify data included in the request against data set on the WhatsApp Business Account (e.g, the two-step pin included in the request is incorrect).
|
|
879
|
-
*
|
|
880
|
-
* Solution:
|
|
881
|
-
* See the Policy Enforcement document to learn about policy violations and how to resolve them. You can also use the Health Status API, which may provide additional insight into the reason or reasons for the account lock.
|
|
882
|
-
*
|
|
883
|
-
* HTTP Response:
|
|
884
|
-
* 403 - Forbidden
|
|
885
|
-
*/
|
|
886
|
-
e131031AccountLocked = 131031,
|
|
887
|
-
/**
|
|
888
|
-
* Error Code: 1
|
|
889
|
-
*
|
|
890
|
-
* Details:
|
|
891
|
-
* API Unknown
|
|
892
|
-
*
|
|
893
|
-
* Description:
|
|
894
|
-
* Invalid request or possible server error.
|
|
895
|
-
*
|
|
896
|
-
* Solution:
|
|
897
|
-
* Check the WhatsApp Business Platform Status page to see API status information. If there are no server outages, check the endpoint reference and verify that your request is formatted correctly and meets all endpoint requirements.
|
|
898
|
-
*
|
|
899
|
-
* HTTP Response:
|
|
900
|
-
* 400 - Bad Request
|
|
901
|
-
*/
|
|
902
|
-
e1ApiUnknown = 1,
|
|
903
|
-
/**
|
|
904
|
-
* Error Code: 2
|
|
905
|
-
*
|
|
906
|
-
* Details:
|
|
907
|
-
* API Service
|
|
908
|
-
*
|
|
909
|
-
* Description:
|
|
910
|
-
* Temporary due to downtime or due to being overloaded.
|
|
911
|
-
*
|
|
912
|
-
* Solution:
|
|
913
|
-
* Check the WhatsApp Business Platform Status page to see API status information before trying again.
|
|
914
|
-
*
|
|
915
|
-
* HTTP Response:
|
|
916
|
-
* 503 - Service Unavailable
|
|
917
|
-
*/
|
|
918
|
-
e2ApiService = 2,
|
|
919
|
-
/**
|
|
920
|
-
* Error Code: 33
|
|
921
|
-
*
|
|
922
|
-
* Details:
|
|
923
|
-
* Parameter value is not valid
|
|
924
|
-
*
|
|
925
|
-
* Description:
|
|
926
|
-
* The business phone number has been deleted.
|
|
927
|
-
*
|
|
928
|
-
* Solution:
|
|
929
|
-
* Verify that the business phone number is correct.
|
|
930
|
-
*
|
|
931
|
-
* HTTP Response:
|
|
932
|
-
* 400 - Bad Request
|
|
933
|
-
*/
|
|
934
|
-
e33ParameterValueNotValid = 33,
|
|
935
|
-
/**
|
|
936
|
-
* Error Code: 100
|
|
937
|
-
*
|
|
938
|
-
* Details:
|
|
939
|
-
* Invalid parameter
|
|
940
|
-
*
|
|
941
|
-
* Description:
|
|
942
|
-
* The request included one or more unsupported or misspelled parameters.
|
|
943
|
-
*
|
|
944
|
-
* Solution:
|
|
945
|
-
* See the endpoint's reference to determine which parameters are supported and how they are spelled. Ensure when setting the business public key, it is a valid 2048-bit RSA public key in PEM format. Ensure there is no mismatch between the phone number id you are registering and a previously stored phone number id. Ensure your parameter is under any length restriction for the type.
|
|
946
|
-
*
|
|
947
|
-
* HTTP Response:
|
|
948
|
-
* 400 - Bad Request
|
|
949
|
-
*/
|
|
950
|
-
e100InvalidParameter = 100,
|
|
951
|
-
/**
|
|
952
|
-
* Error Code: 130472
|
|
953
|
-
*
|
|
954
|
-
* Details:
|
|
955
|
-
* User's number is part of an experiment
|
|
956
|
-
*
|
|
957
|
-
* Description:
|
|
958
|
-
* Message was not sent as part of an experiment.
|
|
959
|
-
*
|
|
960
|
-
* Solution:
|
|
961
|
-
* See Marketing Message Experiment.
|
|
962
|
-
*
|
|
963
|
-
* HTTP Response:
|
|
964
|
-
* 400 - Bad Request
|
|
965
|
-
*/
|
|
966
|
-
e130472UserNumberPartOfExperiment = 130472,
|
|
967
|
-
/**
|
|
968
|
-
* Error Code: 131000
|
|
969
|
-
*
|
|
970
|
-
* Details:
|
|
971
|
-
* Something went wrong
|
|
972
|
-
*
|
|
973
|
-
* Description:
|
|
974
|
-
* Message failed to send due to an unknown error. When setting a business public key, it either failed to calculate the signature, call the GraphQL endpoint, or the GraphQL endpoint returned an error.
|
|
975
|
-
*
|
|
976
|
-
* Solution:
|
|
977
|
-
* Try again. If the error persists, open a Direct Support ticket.
|
|
978
|
-
*
|
|
979
|
-
* HTTP Response:
|
|
980
|
-
* 500 - Internal Server Error
|
|
981
|
-
*/
|
|
982
|
-
e131000SomethingWentWrong = 131000,
|
|
983
|
-
/**
|
|
984
|
-
* Error Code: 131005
|
|
985
|
-
*
|
|
986
|
-
* Details:
|
|
987
|
-
* Access denied
|
|
988
|
-
*
|
|
989
|
-
* Description:
|
|
990
|
-
* Permission is either not granted or has been removed.
|
|
991
|
-
*
|
|
992
|
-
* Solution:
|
|
993
|
-
* Use the access token debugger to verify that your app has been granted the permissions required by the endpoint.
|
|
994
|
-
*
|
|
995
|
-
* HTTP Response:
|
|
996
|
-
* 403 - Forbidden
|
|
997
|
-
*/
|
|
998
|
-
e131005AccessDenied = 131005,
|
|
999
|
-
/**
|
|
1000
|
-
* Error Code: 131008
|
|
1001
|
-
*
|
|
1002
|
-
* Details:
|
|
1003
|
-
* Required parameter is missing
|
|
1004
|
-
*
|
|
1005
|
-
* Description:
|
|
1006
|
-
* The request is missing a required parameter.
|
|
1007
|
-
*
|
|
1008
|
-
* Solution:
|
|
1009
|
-
* See the endpoint's reference to determine which parameters are required.
|
|
1010
|
-
*
|
|
1011
|
-
* HTTP Response:
|
|
1012
|
-
* 400 - Bad Request
|
|
1013
|
-
*/
|
|
1014
|
-
e131008RequiredParameterMissing = 131008,
|
|
1015
|
-
/**
|
|
1016
|
-
* Error Code: 131009
|
|
1017
|
-
*
|
|
1018
|
-
* Details:
|
|
1019
|
-
* Parameter value is not valid
|
|
1020
|
-
*
|
|
1021
|
-
* Description:
|
|
1022
|
-
* One or more parameter values are invalid.
|
|
1023
|
-
*
|
|
1024
|
-
* Solution:
|
|
1025
|
-
* See the endpoint's reference to determine which values are supported for each parameter, and see Phone Numbers to learn how to add a phone number to a WhatsApp Business Account.
|
|
1026
|
-
*
|
|
1027
|
-
* HTTP Response:
|
|
1028
|
-
* 400 - Bad Request
|
|
1029
|
-
*/
|
|
1030
|
-
e131009ParameterValueNotValid = 131009,
|
|
1031
|
-
/**
|
|
1032
|
-
* Error Code: 131016
|
|
1033
|
-
*
|
|
1034
|
-
* Details:
|
|
1035
|
-
* Service unavailable
|
|
1036
|
-
*
|
|
1037
|
-
* Description:
|
|
1038
|
-
* A service is temporarily unavailable.
|
|
1039
|
-
*
|
|
1040
|
-
* Solution:
|
|
1041
|
-
* Check the WhatsApp Business Platform Status page to see API status information before trying again.
|
|
1042
|
-
*
|
|
1043
|
-
* HTTP Response:
|
|
1044
|
-
* 500 - Internal Server Error
|
|
1045
|
-
*/
|
|
1046
|
-
e131016ServiceUnavailable = 131016,
|
|
1047
|
-
/**
|
|
1048
|
-
* Error Code: 131021
|
|
1049
|
-
*
|
|
1050
|
-
* Details:
|
|
1051
|
-
* Recipient cannot be sender
|
|
1052
|
-
*
|
|
1053
|
-
* Description:
|
|
1054
|
-
* The sender and recipient phone numbers are the same.
|
|
1055
|
-
*
|
|
1056
|
-
* Solution:
|
|
1057
|
-
* Send a message to a different phone number than the sender.
|
|
1058
|
-
*
|
|
1059
|
-
* HTTP Response:
|
|
1060
|
-
* 400 - Bad Request
|
|
1061
|
-
*/
|
|
1062
|
-
e131021RecipientCannotBeSender = 131021,
|
|
1063
|
-
/**
|
|
1064
|
-
* Error Code: 131026
|
|
1065
|
-
*
|
|
1066
|
-
* Details:
|
|
1067
|
-
* Message Undeliverable
|
|
1068
|
-
*
|
|
1069
|
-
* Description:
|
|
1070
|
-
* Unable to deliver message. Reasons can include: The recipient phone number is not a WhatsApp phone number. Recipient has not accepted our new Terms of Service and Privacy Policy. Recipient using an old WhatsApp version; must use the following WhatsApp version or greater: Android: 2.21.15.15, SMBA: 2.21.15.15, iOS: 2.21.170.4, SMBI: 2.21.170.4, KaiOS: 2.2130.10, Web: 2.2132.6.
|
|
1071
|
-
*
|
|
1072
|
-
* Solution:
|
|
1073
|
-
* Using a non-WhatsApp communication method, ask the WhatsApp user to: Confirm that they can actually send a message to your WhatsApp business phone number. Confirm that they have accepted our latest Terms of Service (Settings > Help, or Settings > Application information will prompt them to accept the latest terms/policies if they haven't done so already). Update to the latest version of the WhatsApp client.
|
|
1074
|
-
*
|
|
1075
|
-
* HTTP Response:
|
|
1076
|
-
* 400 - Bad Request
|
|
1077
|
-
*/
|
|
1078
|
-
e131026MessageUndeliverable = 131026,
|
|
1079
|
-
/**
|
|
1080
|
-
* Error Code: 131030
|
|
1081
|
-
*
|
|
1082
|
-
* Details:
|
|
1083
|
-
* Recipient not allowed in list
|
|
1084
|
-
*
|
|
1085
|
-
* Description:
|
|
1086
|
-
* Recipient phone number not in allowed list.
|
|
1087
|
-
*
|
|
1088
|
-
* Solution:
|
|
1089
|
-
* Add recipient phone number to recipient list and try again.
|
|
1090
|
-
*
|
|
1091
|
-
* HTTP Response:
|
|
1092
|
-
* 400 - Bad Request
|
|
1093
|
-
*/
|
|
1094
|
-
e131030RecipientNotAllowedInList = 131030,
|
|
1095
|
-
/**
|
|
1096
|
-
* Error Code: 131037
|
|
1097
|
-
*
|
|
1098
|
-
* Details:
|
|
1099
|
-
* WhatsApp provided number needs display name approval before message can be sent.
|
|
1100
|
-
*
|
|
1101
|
-
* Description:
|
|
1102
|
-
* The 555 business phone number used to send the request does not have an approved display name.
|
|
1103
|
-
*
|
|
1104
|
-
* Solution:
|
|
1105
|
-
* Change the 555 business phone number's display name. See our How to change your WhatsApp Business display name Help Center article to learn how.
|
|
1106
|
-
*
|
|
1107
|
-
* HTTP Response:
|
|
1108
|
-
* 400 - Bad Request
|
|
1109
|
-
*/
|
|
1110
|
-
e131037DisplayNameApprovalNeeded = 131037,
|
|
1111
|
-
/**
|
|
1112
|
-
* Error Code: 131042
|
|
1113
|
-
*
|
|
1114
|
-
* Details:
|
|
1115
|
-
* Business eligibility payment issue
|
|
1116
|
-
*
|
|
1117
|
-
* Description:
|
|
1118
|
-
* There was an error related to your payment method.
|
|
1119
|
-
*
|
|
1120
|
-
* Solution:
|
|
1121
|
-
* See About Billing For Your WhatsApp Business Account and verify that you have set up billing correctly. Common problems: Payment account is not attached to a WhatsApp Business Account, Credit line is over the limit, Credit line (Payment Account) not set or active, WhatsApp Business Account is deleted, WhatsApp Business Account is suspended, Timezone not set, Currency not set, MessagingFor request (On Behalf Of) is pending or declined.
|
|
1122
|
-
*
|
|
1123
|
-
* HTTP Response:
|
|
1124
|
-
* 400 - Bad Request
|
|
1125
|
-
*/
|
|
1126
|
-
e131042BusinessEligibilityPaymentIssue = 131042,
|
|
1127
|
-
/**
|
|
1128
|
-
* Error Code: 131045
|
|
1129
|
-
*
|
|
1130
|
-
* Details:
|
|
1131
|
-
* Incorrect certificate
|
|
1132
|
-
*
|
|
1133
|
-
* Description:
|
|
1134
|
-
* Message failed to send due to a phone number registration error.
|
|
1135
|
-
*
|
|
1136
|
-
* Solution:
|
|
1137
|
-
* Register the phone number before trying again.
|
|
1138
|
-
*
|
|
1139
|
-
* HTTP Response:
|
|
1140
|
-
* 500 - Internal Server Error
|
|
1141
|
-
*/
|
|
1142
|
-
e131045IncorrectCertificate = 131045,
|
|
1143
|
-
/**
|
|
1144
|
-
* Error Code: 131047
|
|
1145
|
-
*
|
|
1146
|
-
* Details:
|
|
1147
|
-
* Re-engagement message
|
|
1148
|
-
*
|
|
1149
|
-
* Description:
|
|
1150
|
-
* More than 24 hours have passed since the recipient last replied to the sender number.
|
|
1151
|
-
*
|
|
1152
|
-
* Solution:
|
|
1153
|
-
* Send the recipient a business-initiated message using a message template instead.
|
|
1154
|
-
*
|
|
1155
|
-
* HTTP Response:
|
|
1156
|
-
* 400 - Bad Request
|
|
1157
|
-
*/
|
|
1158
|
-
e131047ReEngagementMessage = 131047,
|
|
1159
|
-
/**
|
|
1160
|
-
* Error Code: 131049
|
|
1161
|
-
*
|
|
1162
|
-
* Details:
|
|
1163
|
-
* Meta chose not to deliver.
|
|
1164
|
-
*
|
|
1165
|
-
* Description:
|
|
1166
|
-
* This message was not delivered to maintain healthy ecosystem engagement.
|
|
1167
|
-
*
|
|
1168
|
-
* Solution:
|
|
1169
|
-
* Do not retry immediately if you do receive this error code and suspect it is due to the limit. Instead, retry in increasing larger time increments until the message is delivered, since the limit may be in effect for differing periods of time. See Per-User Marketing Template Message Limits for additional information.
|
|
1170
|
-
*
|
|
1171
|
-
* HTTP Response:
|
|
1172
|
-
* 400 - Bad Request
|
|
1173
|
-
*/
|
|
1174
|
-
e131049MetaChoseNotToDeliver = 131049,
|
|
1175
|
-
/**
|
|
1176
|
-
* Error Code: 131050
|
|
1177
|
-
*
|
|
1178
|
-
* Details:
|
|
1179
|
-
* User has stopped receipt of marketing messages.
|
|
1180
|
-
*
|
|
1181
|
-
* Description:
|
|
1182
|
-
* Unable to deliver the message. This recipient has chosen to stop receiving marketing messages on WhatsApp from your business.
|
|
1183
|
-
*
|
|
1184
|
-
* Solution:
|
|
1185
|
-
* Do not retry sending messages to this user as they will not be received. To be notified whenever a WhatsApp user stops or resumes delivery of marketing template messages from your business, subscribe to the user_preferences webhook.
|
|
1186
|
-
*
|
|
1187
|
-
* HTTP Response:
|
|
1188
|
-
* 400 - Bad Request
|
|
1189
|
-
*/
|
|
1190
|
-
e131050UserStoppedMarketingMessages = 131050,
|
|
1191
|
-
/**
|
|
1192
|
-
* Error Code: 131051
|
|
1193
|
-
*
|
|
1194
|
-
* Details:
|
|
1195
|
-
* Unsupported message type
|
|
1196
|
-
*
|
|
1197
|
-
* Description:
|
|
1198
|
-
* Unsupported message type.
|
|
1199
|
-
*
|
|
1200
|
-
* Solution:
|
|
1201
|
-
* See Messages for supported message types before trying again with a supported message type.
|
|
1202
|
-
*
|
|
1203
|
-
* HTTP Response:
|
|
1204
|
-
* 400 - Bad Request
|
|
1205
|
-
*/
|
|
1206
|
-
e131051UnsupportedMessageType = 131051,
|
|
1207
|
-
/**
|
|
1208
|
-
* Error Code: 131052
|
|
1209
|
-
*
|
|
1210
|
-
* Details:
|
|
1211
|
-
* Media download error
|
|
1212
|
-
*
|
|
1213
|
-
* Description:
|
|
1214
|
-
* Unable to download the media sent by the user.
|
|
1215
|
-
*
|
|
1216
|
-
* Solution:
|
|
1217
|
-
* We were unable to download media included in the WhatsApp user's message. For more information, refer to the error.error_data.details value in any messages webhooks triggered when this message was received. Ask the WhatsApp user to send you the media file using a non-WhatsApp method.
|
|
1218
|
-
*
|
|
1219
|
-
* HTTP Response:
|
|
1220
|
-
* 400 - Bad Request
|
|
1221
|
-
*/
|
|
1222
|
-
e131052MediaDownloadError = 131052,
|
|
1223
|
-
/**
|
|
1224
|
-
* Error Code: 131053
|
|
1225
|
-
*
|
|
1226
|
-
* Details:
|
|
1227
|
-
* Media upload error
|
|
1228
|
-
*
|
|
1229
|
-
* Description:
|
|
1230
|
-
* Unable to upload the media used in the message.
|
|
1231
|
-
*
|
|
1232
|
-
* Solution:
|
|
1233
|
-
* We were unable to upload the media for one or more reasons, such as an unsupported media type. For more information, refer to the error.error_data.details value in any messages webhooks triggered when this message fails to send. We recommend that you inspect any media files that are causing errors and confirm that they are in fact supported. For example, in UNIX you can use file inspection via the command line to determine its MIME type: file -I rejected-file.mov You can then confirm if its MIME type is supported. See Supported Media Types.
|
|
1234
|
-
*
|
|
1235
|
-
* HTTP Response:
|
|
1236
|
-
* 400 - Bad Request
|
|
1237
|
-
*/
|
|
1238
|
-
e131053MediaUploadError = 131053,
|
|
1239
|
-
/**
|
|
1240
|
-
* Error Code: 131057
|
|
1241
|
-
*
|
|
1242
|
-
* Details:
|
|
1243
|
-
* Account in maintenance mode
|
|
1244
|
-
*
|
|
1245
|
-
* Description:
|
|
1246
|
-
* Business Account is in maintenance mode. The WhatsApp Business Account is in maintenance mode. One reason for this could be that the account is undergoing a throughput upgrade.
|
|
1247
|
-
*
|
|
1248
|
-
* Solution:
|
|
1249
|
-
* (No specific solution provided, implies waiting or contact support.)
|
|
1250
|
-
*
|
|
1251
|
-
* HTTP Response:
|
|
1252
|
-
* 500 - Bad Request
|
|
1253
|
-
*/
|
|
1254
|
-
e131057AccountInMaintenanceMode = 131057,
|
|
1255
|
-
/**
|
|
1256
|
-
* Error Code: 132000
|
|
1257
|
-
*
|
|
1258
|
-
* Details:
|
|
1259
|
-
* Template Param Count Mismatch
|
|
1260
|
-
*
|
|
1261
|
-
* Description:
|
|
1262
|
-
* The number of variable parameter values included in the request did not match the number of variable parameters defined in the template.
|
|
1263
|
-
*
|
|
1264
|
-
* Solution:
|
|
1265
|
-
* See Message Template Guidelines and make sure the request includes all of the variable parameter values that have been defined in the template.
|
|
1266
|
-
*
|
|
1267
|
-
* HTTP Response:
|
|
1268
|
-
* 400 - Bad Request
|
|
1269
|
-
*/
|
|
1270
|
-
e132000TemplateParamCountMismatch = 132000,
|
|
1271
|
-
/**
|
|
1272
|
-
* Error Code: 132001
|
|
1273
|
-
*
|
|
1274
|
-
* Details:
|
|
1275
|
-
* Template does not exist
|
|
1276
|
-
*
|
|
1277
|
-
* Description:
|
|
1278
|
-
* The template does not exist in the specified language or the template has not been approved.
|
|
1279
|
-
*
|
|
1280
|
-
* Solution:
|
|
1281
|
-
* Make sure your template has been approved and the template name and language locale are correct. Please ensure you follow message template guidelines.
|
|
1282
|
-
*
|
|
1283
|
-
* HTTP Response:
|
|
1284
|
-
* 404 - Not Found
|
|
1285
|
-
*/
|
|
1286
|
-
e132001TemplateDoesNotExist = 132001,
|
|
1287
|
-
/**
|
|
1288
|
-
* Error Code: 132005
|
|
1289
|
-
*
|
|
1290
|
-
* Details:
|
|
1291
|
-
* Template Hydrated Text Too Long
|
|
1292
|
-
*
|
|
1293
|
-
* Description:
|
|
1294
|
-
* Translated text is too long.
|
|
1295
|
-
*
|
|
1296
|
-
* Solution:
|
|
1297
|
-
* Check the WhatsApp Manager to verify that your template has been translated. See Quality Rating and Template Status.
|
|
1298
|
-
*
|
|
1299
|
-
* HTTP Response:
|
|
1300
|
-
* 400 - Bad Request
|
|
1301
|
-
*/
|
|
1302
|
-
e132005TemplateHydratedTextTooLong = 132005,
|
|
1303
|
-
/**
|
|
1304
|
-
* Error Code: 132007
|
|
1305
|
-
*
|
|
1306
|
-
* Details:
|
|
1307
|
-
* Template Format Character Policy Violated
|
|
1308
|
-
*
|
|
1309
|
-
* Description:
|
|
1310
|
-
* Template content violates a WhatsApp policy.
|
|
1311
|
-
*
|
|
1312
|
-
* Solution:
|
|
1313
|
-
* See Rejection Reasons to determine possible reasons for violation.
|
|
1314
|
-
*
|
|
1315
|
-
* HTTP Response:
|
|
1316
|
-
* 400 - Bad Request
|
|
1317
|
-
*/
|
|
1318
|
-
e132007TemplateFormatCharacterPolicyViolated = 132007,
|
|
1319
|
-
/**
|
|
1320
|
-
* Error Code: 132012
|
|
1321
|
-
*
|
|
1322
|
-
* Details:
|
|
1323
|
-
* Template Parameter Format Mismatch
|
|
1324
|
-
*
|
|
1325
|
-
* Description:
|
|
1326
|
-
* Variable parameter values formatted incorrectly.
|
|
1327
|
-
*
|
|
1328
|
-
* Solution:
|
|
1329
|
-
* The variable parameter values included in the request are not using the format specified in the template. See Message Template Guidelines.
|
|
1330
|
-
*
|
|
1331
|
-
* HTTP Response:
|
|
1332
|
-
* 400 - Bad Request
|
|
1333
|
-
*/
|
|
1334
|
-
e132012TemplateParameterFormatMismatch = 132012,
|
|
1335
|
-
/**
|
|
1336
|
-
* Error Code: 132015
|
|
1337
|
-
*
|
|
1338
|
-
* Details:
|
|
1339
|
-
* Template is Paused
|
|
1340
|
-
*
|
|
1341
|
-
* Description:
|
|
1342
|
-
* Template is paused due to low quality so it cannot be sent in a template message.
|
|
1343
|
-
*
|
|
1344
|
-
* Solution:
|
|
1345
|
-
* Edit the template to improve its quality and try again once it is approved.
|
|
1346
|
-
*
|
|
1347
|
-
* HTTP Response:
|
|
1348
|
-
* 400 - Bad Request
|
|
1349
|
-
*/
|
|
1350
|
-
e132015TemplateIsPaused = 132015,
|
|
1351
|
-
/**
|
|
1352
|
-
* Error Code: 132016
|
|
1353
|
-
*
|
|
1354
|
-
* Details:
|
|
1355
|
-
* Template is Disabled
|
|
1356
|
-
*
|
|
1357
|
-
* Description:
|
|
1358
|
-
* Template has been paused too many times due to low quality and is now permanently disabled.
|
|
1359
|
-
*
|
|
1360
|
-
* Solution:
|
|
1361
|
-
* Create a new template with different content.
|
|
1362
|
-
*
|
|
1363
|
-
* HTTP Response:
|
|
1364
|
-
* 400 - Bad Request
|
|
1365
|
-
*/
|
|
1366
|
-
e132016TemplateIsDisabled = 132016,
|
|
1367
|
-
/**
|
|
1368
|
-
* Error Code: 132068
|
|
1369
|
-
*
|
|
1370
|
-
* Details:
|
|
1371
|
-
* Flow is blocked
|
|
1372
|
-
*
|
|
1373
|
-
* Description:
|
|
1374
|
-
* Flow is in blocked state.
|
|
1375
|
-
*
|
|
1376
|
-
* Solution:
|
|
1377
|
-
* Correct the Flow.
|
|
1378
|
-
*
|
|
1379
|
-
* HTTP Response:
|
|
1380
|
-
* 400 - Bad Request
|
|
1381
|
-
*/
|
|
1382
|
-
e132068FlowIsBlocked = 132068,
|
|
1383
|
-
/**
|
|
1384
|
-
* Error Code: 132069
|
|
1385
|
-
*
|
|
1386
|
-
* Details:
|
|
1387
|
-
* Flow is throttled
|
|
1388
|
-
*
|
|
1389
|
-
* Description:
|
|
1390
|
-
* Flow is in throttled state and 10 messages using this flow were already sent in the last hour.
|
|
1391
|
-
*
|
|
1392
|
-
* Solution:
|
|
1393
|
-
* Correct the Flow.
|
|
1394
|
-
*
|
|
1395
|
-
* HTTP Response:
|
|
1396
|
-
* 400 - Bad Request
|
|
1397
|
-
*/
|
|
1398
|
-
e132069FlowIsThrottled = 132069,
|
|
1399
|
-
/**
|
|
1400
|
-
* Error Code: 133000
|
|
1401
|
-
*
|
|
1402
|
-
* Details:
|
|
1403
|
-
* Incomplete Deregistration
|
|
1404
|
-
*
|
|
1405
|
-
* Description:
|
|
1406
|
-
* A previous deregistration attempt failed.
|
|
1407
|
-
*
|
|
1408
|
-
* Solution:
|
|
1409
|
-
* Deregister the number again before registering.
|
|
1410
|
-
*
|
|
1411
|
-
* HTTP Response:
|
|
1412
|
-
* 500 - Internal Server Error
|
|
1413
|
-
*/
|
|
1414
|
-
e133000IncompleteDeregistration = 133000,
|
|
1415
|
-
/**
|
|
1416
|
-
* Error Code: 133004
|
|
1417
|
-
*
|
|
1418
|
-
* Details:
|
|
1419
|
-
* Server Temporarily Unavailable
|
|
1420
|
-
*
|
|
1421
|
-
* Description:
|
|
1422
|
-
* Server is temporarily unavailable.
|
|
1423
|
-
*
|
|
1424
|
-
* Solution:
|
|
1425
|
-
* Check the WhatsApp Business Platform Status page to see API status information and check the response details value before trying again.
|
|
1426
|
-
*
|
|
1427
|
-
* HTTP Response:
|
|
1428
|
-
* 503 - Service Unavailable
|
|
1429
|
-
*/
|
|
1430
|
-
e133004ServerTemporarilyUnavailable = 133004,
|
|
1431
|
-
/**
|
|
1432
|
-
* Error Code: 133005
|
|
1433
|
-
*
|
|
1434
|
-
* Details:
|
|
1435
|
-
* Two step verification PIN Mismatch
|
|
1436
|
-
*
|
|
1437
|
-
* Description:
|
|
1438
|
-
* Two-step verification PIN incorrect.
|
|
1439
|
-
*
|
|
1440
|
-
* Solution:
|
|
1441
|
-
* Verify that the two-step verification PIN included in the request is correct. To reset the two-step verification PIN: Disable two-step verification. Send a POST request that includes the new PIN to the Phone Number endpoint.
|
|
1442
|
-
*
|
|
1443
|
-
* HTTP Response:
|
|
1444
|
-
* 400 - Bad Request
|
|
1445
|
-
*/
|
|
1446
|
-
e133005TwoStepVerificationPinMismatch = 133005,
|
|
1447
|
-
/**
|
|
1448
|
-
* Error Code: 133006
|
|
1449
|
-
*
|
|
1450
|
-
* Details:
|
|
1451
|
-
* Phone number re-verification needed
|
|
1452
|
-
*
|
|
1453
|
-
* Description:
|
|
1454
|
-
* Phone number needs to be verified before registering.
|
|
1455
|
-
*
|
|
1456
|
-
* Solution:
|
|
1457
|
-
* Verify the phone number before registering it.
|
|
1458
|
-
*
|
|
1459
|
-
* HTTP Response:
|
|
1460
|
-
* 400 - Bad Request
|
|
1461
|
-
*/
|
|
1462
|
-
e133006PhoneNumberReVerificationNeeded = 133006,
|
|
1463
|
-
/**
|
|
1464
|
-
* Error Code: 133008
|
|
1465
|
-
*
|
|
1466
|
-
* Details:
|
|
1467
|
-
* Too Many two step verification PIN Guesses
|
|
1468
|
-
*
|
|
1469
|
-
* Description:
|
|
1470
|
-
* Too many two-step verification PIN guesses for this phone number.
|
|
1471
|
-
*
|
|
1472
|
-
* Solution:
|
|
1473
|
-
* Try again after the amount of time specified in the details response value.
|
|
1474
|
-
*
|
|
1475
|
-
* HTTP Response:
|
|
1476
|
-
* 400 - Bad Request
|
|
1477
|
-
*/
|
|
1478
|
-
e133008TooManyTwoStepVerificationPinGuesses = 133008,
|
|
1479
|
-
/**
|
|
1480
|
-
* Error Code: 133009
|
|
1481
|
-
*
|
|
1482
|
-
* Details:
|
|
1483
|
-
* Two step verification PIN Guessed Too Fast
|
|
1484
|
-
*
|
|
1485
|
-
* Description:
|
|
1486
|
-
* Two-step verification PIN was entered too quickly.
|
|
1487
|
-
*
|
|
1488
|
-
* Solution:
|
|
1489
|
-
* Check the details response value before trying again.
|
|
1490
|
-
*
|
|
1491
|
-
* HTTP Response:
|
|
1492
|
-
* 400 - Bad Request
|
|
1493
|
-
*/
|
|
1494
|
-
e133009TwoStepVerificationPinGuessedTooFast = 133009,
|
|
1495
|
-
/**
|
|
1496
|
-
* Error Code: 133010
|
|
1497
|
-
*
|
|
1498
|
-
* Details:
|
|
1499
|
-
* Phone number Not Registered
|
|
1500
|
-
*
|
|
1501
|
-
* Description:
|
|
1502
|
-
* Phone number not registered on the WhatsApp Business Platform.
|
|
1503
|
-
*
|
|
1504
|
-
* Solution:
|
|
1505
|
-
* Register the phone number before trying again.
|
|
1506
|
-
*
|
|
1507
|
-
* HTTP Response:
|
|
1508
|
-
* 400 - Bad Request
|
|
1509
|
-
*/
|
|
1510
|
-
e133010PhoneNumberNotRegistered = 133010,
|
|
1511
|
-
/**
|
|
1512
|
-
* Error Code: 133015
|
|
1513
|
-
*
|
|
1514
|
-
* Details:
|
|
1515
|
-
* Please wait a few minutes before attempting to register this phone number
|
|
1516
|
-
*
|
|
1517
|
-
* Description:
|
|
1518
|
-
* The phone number you are attempting to register was recently deleted, and deletion has not yet completed.
|
|
1519
|
-
*
|
|
1520
|
-
* Solution:
|
|
1521
|
-
* Wait 5 minutes before re-trying the request.
|
|
1522
|
-
*
|
|
1523
|
-
* HTTP Response:
|
|
1524
|
-
* 400 - Bad Request
|
|
1525
|
-
*/
|
|
1526
|
-
e133015PhoneNumberDeletionPending = 133015,
|
|
1527
|
-
/**
|
|
1528
|
-
* Error Code: 134011
|
|
1529
|
-
*
|
|
1530
|
-
* Details:
|
|
1531
|
-
* WhatsApp Payments terms of service has not been accepted
|
|
1532
|
-
*
|
|
1533
|
-
* Description:
|
|
1534
|
-
* Message failed to send because WhatsApp Payments terms of service acceptance is pending for this WhatsApp Business Account.
|
|
1535
|
-
*
|
|
1536
|
-
* Solution:
|
|
1537
|
-
* Accept the WhatsApp Payments terms of service using the link provided in the error message before trying again.
|
|
1538
|
-
*
|
|
1539
|
-
* HTTP Response:
|
|
1540
|
-
* 400 - Bad Request
|
|
1541
|
-
*/
|
|
1542
|
-
e134011PaymentsTermsNotAccepted = 134011,
|
|
1543
|
-
/**
|
|
1544
|
-
* Error Code: 135000
|
|
1545
|
-
*
|
|
1546
|
-
* Details:
|
|
1547
|
-
* Generic user error
|
|
1548
|
-
*
|
|
1549
|
-
* Description:
|
|
1550
|
-
* Message failed to send because of an unknown error with your request parameters.
|
|
1551
|
-
*
|
|
1552
|
-
* Solution:
|
|
1553
|
-
* See the endpoint's reference to determine if you are querying the endpoint using the correct syntax. Contact customer support if you continue receiving this error code in response.
|
|
1554
|
-
*
|
|
1555
|
-
* HTTP Response:
|
|
1556
|
-
* 400 - Bad Request
|
|
1557
|
-
*/
|
|
1558
|
-
e135000GenericUserError = 135000,
|
|
1559
|
-
/**
|
|
1560
|
-
* Error Code: 2593107
|
|
1561
|
-
*
|
|
1562
|
-
* Details:
|
|
1563
|
-
* Synchronization Request limit exceeded
|
|
1564
|
-
*
|
|
1565
|
-
* Description:
|
|
1566
|
-
* You have exceeded the maximum number of times to call the synchronization API for this phone number.
|
|
1567
|
-
*
|
|
1568
|
-
* Solution:
|
|
1569
|
-
* You can only call this endpoint once to synchronize the business phone number contacts and once to synchronize its messaging history. See Onboarding business app users. Offboard the business customer and re-onboard them.
|
|
1570
|
-
*
|
|
1571
|
-
* HTTP Response:
|
|
1572
|
-
* 400 - Bad Request
|
|
1573
|
-
*/
|
|
1574
|
-
e2593107SynchronizationRequestLimitExceeded = 2593107,
|
|
1575
|
-
/**
|
|
1576
|
-
* Error Code: 2593108
|
|
1577
|
-
*
|
|
1578
|
-
* Details:
|
|
1579
|
-
* Synchronization Request made outside of allowed time window
|
|
1580
|
-
*
|
|
1581
|
-
* Description:
|
|
1582
|
-
* Synchronization request can only be made within 24 hours of onboarding.
|
|
1583
|
-
*
|
|
1584
|
-
* Solution:
|
|
1585
|
-
* You can only initiate contacts and messaging history synchronization of an onboarded WhatsApp Business app user within 24 hours of onboarding the user. See Onboarding business app users. Offboard the user and re-onboard them.
|
|
1586
|
-
*
|
|
1587
|
-
* HTTP Response:
|
|
1588
|
-
* 400 - Bad Request
|
|
1589
|
-
*/
|
|
1590
|
-
e2593108SynchronizationRequestOutsideTimeWindow = 2593108,
|
|
1591
|
-
/**
|
|
1592
|
-
* Error Code: 4
|
|
1593
|
-
*
|
|
1594
|
-
* Details:
|
|
1595
|
-
* API Too Many Calls
|
|
1596
|
-
*
|
|
1597
|
-
* Description:
|
|
1598
|
-
* The app has reached its API call rate limit.
|
|
1599
|
-
*
|
|
1600
|
-
* Solution:
|
|
1601
|
-
* Load the app in the App Dashboard and view the Application Rate Limit section to verify that the app has reached its rate limit. If it has, try again later or reduce the frequency or amount of API queries the app is making.
|
|
1602
|
-
*
|
|
1603
|
-
* HTTP Response:
|
|
1604
|
-
* 400 - Bad Request
|
|
1605
|
-
*/
|
|
1606
|
-
e4ApiTooManyCalls = 4,
|
|
1607
|
-
/**
|
|
1608
|
-
* Error Code: 80007
|
|
1609
|
-
*
|
|
1610
|
-
* Details:
|
|
1611
|
-
* Rate limit issues
|
|
1612
|
-
*
|
|
1613
|
-
* Description:
|
|
1614
|
-
* The WhatsApp Business Account has reached its rate limit.
|
|
1615
|
-
*
|
|
1616
|
-
* Solution:
|
|
1617
|
-
* See WhatsApp Business Account Rate Limits. Try again later or reduce the frequency or amount of API queries the app is making.
|
|
1618
|
-
*
|
|
1619
|
-
* HTTP Response:
|
|
1620
|
-
* 400 - Bad Request
|
|
1621
|
-
*/
|
|
1622
|
-
e80007RateLimitIssues = 80007,
|
|
1623
|
-
/**
|
|
1624
|
-
* Error Code: 130429
|
|
1625
|
-
*
|
|
1626
|
-
* Details:
|
|
1627
|
-
* Rate limit hit
|
|
1628
|
-
*
|
|
1629
|
-
* Description:
|
|
1630
|
-
* Cloud API message throughput has been reached.
|
|
1631
|
-
*
|
|
1632
|
-
* Solution:
|
|
1633
|
-
* The app has reached the API's throughput limit. See Throughput. Try again later or reduce the frequency with which the app sends messages.
|
|
1634
|
-
*
|
|
1635
|
-
* HTTP Response:
|
|
1636
|
-
* 400 - Bad Request
|
|
1637
|
-
*/
|
|
1638
|
-
e130429RateLimitHit = 130429,
|
|
1639
|
-
/**
|
|
1640
|
-
* Error Code: 131048
|
|
1641
|
-
*
|
|
1642
|
-
* Details:
|
|
1643
|
-
* Spam rate limit hit
|
|
1644
|
-
*
|
|
1645
|
-
* Description:
|
|
1646
|
-
* Message failed to send because there are restrictions on how many messages can be sent from this phone number. This may be because too many previous messages were blocked or flagged as spam.
|
|
1647
|
-
*
|
|
1648
|
-
* Solution:
|
|
1649
|
-
* Check your quality status in the WhatsApp Manager and see the Quality-Based Rate Limits documentation for more information.
|
|
1650
|
-
*
|
|
1651
|
-
* HTTP Response:
|
|
1652
|
-
* 400 - Bad Request
|
|
1653
|
-
*/
|
|
1654
|
-
e131048SpamRateLimitHit = 131048,
|
|
1655
|
-
/**
|
|
1656
|
-
* Error Code: 131056
|
|
1657
|
-
*
|
|
1658
|
-
* Details:
|
|
1659
|
-
* (Business Account, Consumer Account) pair rate limit hit
|
|
1660
|
-
*
|
|
1661
|
-
* Description:
|
|
1662
|
-
* Too many messages sent from the sender phone number to the same recipient phone number in a short period of time.
|
|
1663
|
-
*
|
|
1664
|
-
* Solution:
|
|
1665
|
-
* Wait and retry the operation, if you intend to send messages to the same phone number. You can still send messages to a different phone number without waiting.
|
|
1666
|
-
*
|
|
1667
|
-
* HTTP Response:
|
|
1668
|
-
* 400 - Bad Request
|
|
1669
|
-
*/
|
|
1670
|
-
e131056BusinessConsumerPairRateLimitHit = 131056,
|
|
1671
|
-
/**
|
|
1672
|
-
* Error Code: 133016
|
|
1673
|
-
*
|
|
1674
|
-
* Details:
|
|
1675
|
-
* Account register deregister rate limit exceeded
|
|
1676
|
-
*
|
|
1677
|
-
* Description:
|
|
1678
|
-
* Registration or Deregistration failed because there were too many attempts for this phone number in a short period of time.
|
|
1679
|
-
*
|
|
1680
|
-
* Solution:
|
|
1681
|
-
* The business phone number is being blocked because it has reached its registration/deregistration attempt limit. Try again once the number is unblocked. See Limitations in the Registration document.
|
|
1682
|
-
*
|
|
1683
|
-
* HTTP Response:
|
|
1684
|
-
* 400 - Bad Request
|
|
1685
|
-
*/
|
|
1686
|
-
e133016AccountRegisterDeregisterRateLimitExceeded = 133016
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
type WaSDKFlowPayload = WhatsappFlowDecryptedWebhookBody;
|
|
1690
|
-
type WaSDKFlowDecryptedWebhookBody = {
|
|
1691
|
-
payload: WaSDKFlowPayload;
|
|
1692
|
-
encryptionMetadata: WhatsappFlowEncryptionData;
|
|
1693
|
-
};
|
|
1694
|
-
type WaSDKFlowExchangeEventPayload = WaSDKFlowDecryptedWebhookBody & {
|
|
1695
|
-
pingResponse: WhatsappFlowPingResponse;
|
|
1696
|
-
};
|
|
1697
|
-
|
|
1698
|
-
declare function decryptFlowBody(body: WhatsappFlowEncryptedWebhookBody): WaSDKFlowDecryptedWebhookBody;
|
|
1699
|
-
|
|
1700
|
-
declare function generateWabaEncryption(): Promise<{
|
|
1701
|
-
passphrase: `${string}-${string}-${string}-${string}-${string}`;
|
|
1702
|
-
publicKey: string;
|
|
1703
|
-
privateKey: string;
|
|
1704
|
-
}>;
|
|
1705
|
-
|
|
1706
|
-
type WebhookSignatureChallengeArguments = {
|
|
1707
|
-
rawBody: string;
|
|
1708
|
-
untrustedSignature: string;
|
|
1709
|
-
};
|
|
1710
|
-
declare function verifySignature(request: Request, rawBody: string): Promise<boolean>;
|
|
1711
|
-
|
|
1712
|
-
declare function verifyHub(request: Request): string | false;
|
|
1713
|
-
|
|
1714
|
-
interface BaseMessageReceivedEventPayload {
|
|
1715
|
-
id: string;
|
|
1716
|
-
type: WaIncomingMessageType;
|
|
1717
|
-
timestamp: number;
|
|
1718
|
-
metadata: {
|
|
1719
|
-
forwarded?: boolean;
|
|
1720
|
-
frequentlyForwarded?: boolean;
|
|
1721
|
-
};
|
|
1722
|
-
}
|
|
1723
|
-
type MessageReceivedEventPayload = BaseMessageReceivedEventPayload & {
|
|
1724
|
-
chatId: string;
|
|
1725
|
-
text: string | null;
|
|
1726
|
-
reply?: string;
|
|
1727
|
-
interaction?: {
|
|
1728
|
-
button?: {
|
|
1729
|
-
id: string | null;
|
|
1730
|
-
title: string;
|
|
1731
|
-
payload: string | null;
|
|
1732
|
-
};
|
|
1733
|
-
selectedOption?: {
|
|
1734
|
-
id: string;
|
|
1735
|
-
title: string;
|
|
1736
|
-
description: string;
|
|
1737
|
-
};
|
|
1738
|
-
flowResponse?: {
|
|
1739
|
-
flow_token: string;
|
|
1740
|
-
} & {
|
|
1741
|
-
[key: string]: AnyType;
|
|
1742
|
-
};
|
|
1743
|
-
};
|
|
1744
|
-
media?: {
|
|
1745
|
-
id: string;
|
|
1746
|
-
caption: string | null;
|
|
1747
|
-
mime_type: string;
|
|
1748
|
-
type: "audio" | "document" | "image" | "video";
|
|
1749
|
-
filename?: string;
|
|
1750
|
-
sha256?: string;
|
|
1751
|
-
};
|
|
1752
|
-
};
|
|
1753
|
-
|
|
1754
|
-
interface MessageStatusUpdateEvent {
|
|
1755
|
-
messageId: string;
|
|
1756
|
-
metadata: string;
|
|
1757
|
-
timestamp: number;
|
|
1758
|
-
errors: WaIncomingErrors;
|
|
1759
|
-
status: WaIncomingMessageStatuses;
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
type FlowUpdateEventPayload = {
|
|
1763
|
-
event: string;
|
|
342
|
+
filename?: string;
|
|
343
|
+
sha256?: string;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/models/webhook/webhooks/messages/message-status.i-webhook.d.ts
|
|
348
|
+
interface WhatsappMessageStatusWebhook {
|
|
349
|
+
id: string;
|
|
350
|
+
timestamp: number;
|
|
351
|
+
metadata: {
|
|
352
|
+
forwarded?: boolean;
|
|
353
|
+
frequentlyForwarded?: boolean;
|
|
354
|
+
};
|
|
355
|
+
errors: WhatsappApiErrors;
|
|
356
|
+
status: WhatsappApiWebhookMessageStatus;
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/models/webhook/i-webhook.d.ts
|
|
360
|
+
interface WhatsappWebhook {
|
|
361
|
+
health?: string;
|
|
362
|
+
flow?: WhatsappWebhookFlow;
|
|
363
|
+
message?: {
|
|
364
|
+
received?: WhatsappMessageReceivedWebhook[];
|
|
365
|
+
status?: WhatsappMessageStatusWebhook[];
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
type WhatsappWebhookType = keyof WhatsappWebhook;
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/models/webhook/services/guards/hub.i-guard.d.ts
|
|
371
|
+
type WhatsappHubGuard = (request: Request) => false | string;
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/models/webhook/services/guards/signature.guard.d.ts
|
|
374
|
+
type WhatsappSignature = (request: Request, rawBody: string) => false | string;
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/models/webhook/webhooks/flows/flow-update.i-webhook.d.ts
|
|
377
|
+
type WhatsappWebhookFlowUpdate = {
|
|
378
|
+
flowId: string;
|
|
379
|
+
event: string;
|
|
380
|
+
message: string;
|
|
381
|
+
};
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/features/flows/actions/create.d.ts
|
|
384
|
+
declare function create<J extends Exact<WhatsappFlowJSON, J>>(body: Omit<CreateFlowRequestWrapper, "flow_json"> & {
|
|
385
|
+
flow_json?: J;
|
|
386
|
+
}): Promise<_apostlejs_whatsapp_api0.WhatsappApiCreateFlowResponse>;
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/features/flows/actions/delete.d.ts
|
|
389
|
+
declare function deleteFlow(flow_id: string): Promise<_apostlejs_whatsapp_api0.WhatsappApiDeleteFlowResponse>;
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/features/flows/actions/get.d.ts
|
|
392
|
+
declare function get(flow_id: string, query?: {
|
|
393
|
+
fields: Array<keyof WhatsappApiFlowDetail>;
|
|
394
|
+
}): Promise<WhatsappApiFlowDetail>;
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/features/flows/actions/get-many.d.ts
|
|
397
|
+
declare function getMany(): Promise<_apostlejs_whatsapp_api0.WhatsappApiGetManyFlowsResponse>;
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/features/flows/actions/get-preview.d.ts
|
|
400
|
+
declare function getPreview(flow_id: string, query?: WhatsappGetFlowWebPreviewPageRequestQuery): Promise<string>;
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/features/flows/actions/publish.d.ts
|
|
403
|
+
declare function publish(flow_id: string): Promise<_apostlejs_whatsapp_api0.WhatsappApiPublishFlowResponse>;
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/features/flows/actions/update-json.d.ts
|
|
406
|
+
type UpdateFlowJsonResult = {
|
|
407
|
+
success: boolean;
|
|
408
|
+
validation_errors: Array<{
|
|
409
|
+
error: string;
|
|
410
|
+
error_type: string;
|
|
1764
411
|
message: string;
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
412
|
+
line_start: number;
|
|
413
|
+
line_end: number;
|
|
414
|
+
column_start: number;
|
|
415
|
+
column_end: number;
|
|
416
|
+
}>;
|
|
417
|
+
};
|
|
418
|
+
declare function updateJson<J extends Exact<WhatsappFlowJSON, J>>(flow_id: string, json: J): Promise<UpdateFlowJsonResult>;
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/features/flows/actions/update-metadata.d.ts
|
|
421
|
+
declare function updateMetadata(flow_id: string, metadata: WhatsappFlowMetadata): Promise<_apostlejs_whatsapp_api0.WhatsappApiUpdateFlowMetadataResponse>;
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/features/flows/crypto/decrypt-flow-body.d.ts
|
|
424
|
+
declare const decryptFlowBody: WhatsappFlowWebhookDecryptor;
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region src/features/flows/crypto/decrypt-flow-media.d.ts
|
|
427
|
+
declare const decryptFlowMedia: WhatsappFlowMediaDecryptor;
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/features/flows/crypto/encrypt-flow-response.d.ts
|
|
430
|
+
declare const encryptFlowResponse: WhatsappFlowResponseEncryptor;
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/features/flows/adapters/flow-response.adapter.d.ts
|
|
433
|
+
declare const flowResponseAdapter: {
|
|
434
|
+
toGraph(flow_token: string, response: WhatsappApiWebhookFlowResponse): WhatsappApiWebhookFlowResponse;
|
|
435
|
+
};
|
|
436
|
+
declare namespace index_d_exports$4 {
|
|
437
|
+
export { UpdateFlowJsonResult, create, decryptFlowBody, decryptFlowMedia, deleteFlow, encryptFlowResponse, flowResponseAdapter, get, getMany, getPreview, publish, updateJson, updateMetadata };
|
|
438
|
+
}
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/features/i18n/adapters/language-tag.adapter.d.ts
|
|
441
|
+
declare const languageTagAdapter: {
|
|
442
|
+
toGraph(languageTag: `${WhatsappLanguageTag}`): WhatsappApiLanguageTag;
|
|
443
|
+
};
|
|
444
|
+
declare namespace index_d_exports$3 {
|
|
445
|
+
export { languageTagAdapter };
|
|
446
|
+
}
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/features/messages/actions/send.d.ts
|
|
449
|
+
declare function send(body: WhatsappSendMessageRequest): Promise<_apostlejs_whatsapp_api0.WhatsappApiSendMessageResponse>;
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/features/messages/actions/show-typing-indicator.d.ts
|
|
452
|
+
declare function showTypingIndicator(params: WhatsappShowTypingIndicatorRequest): Promise<_apostlejs_whatsapp_api0.WhatsappApiShowTypingIndicatorResponse>;
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/features/messages/adapters/message.adapter.d.ts
|
|
455
|
+
type MessageFragment = Omit<WhatsappApiSendMessageRequest, "messaging_product" | "to">;
|
|
456
|
+
declare const messageAdapter: {
|
|
457
|
+
toGraph(message: WhatsappMessage, chatId: string): MessageFragment;
|
|
458
|
+
};
|
|
459
|
+
declare namespace index_d_exports$2 {
|
|
460
|
+
export { MessageFragment, messageAdapter, send, showTypingIndicator };
|
|
461
|
+
}
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region src/features/waba/actions/register-number.d.ts
|
|
1792
464
|
interface RegisterNumberPayload {
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
}
|
|
1796
|
-
declare function registerNumber({
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
declare
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
payload: FlowPayload;
|
|
1838
|
-
}
|
|
1839
|
-
interface DataExchangeFlowConfig extends BaseFlowConfig {
|
|
1840
|
-
action?: "data_exchange";
|
|
1841
|
-
payload?: FlowPayload;
|
|
1842
|
-
}
|
|
1843
|
-
type FlowConfig = NavigateFlowConfig | DataExchangeFlowConfig;
|
|
1844
|
-
type WaSDKOutgoingFlowMessage = Omit<WaInteractiveBase, "type"> & {
|
|
1845
|
-
type: "flow";
|
|
1846
|
-
flow: FlowConfig;
|
|
1847
|
-
};
|
|
1848
|
-
|
|
1849
|
-
type WaSDKOutgoingListMessage = Omit<WaInteractiveBase, "type"> & {
|
|
1850
|
-
type: "list";
|
|
1851
|
-
list: {
|
|
1852
|
-
button: string;
|
|
1853
|
-
sections: Array<{
|
|
1854
|
-
rows: Array<{
|
|
1855
|
-
id: string;
|
|
1856
|
-
title: string;
|
|
1857
|
-
description?: string;
|
|
1858
|
-
}>;
|
|
1859
|
-
title: string;
|
|
1860
|
-
}>;
|
|
1861
|
-
};
|
|
1862
|
-
};
|
|
1863
|
-
|
|
1864
|
-
type WaSDKOutgoingMediaMessage = {
|
|
1865
|
-
type: "media";
|
|
1866
|
-
sticker: {
|
|
1867
|
-
ref: string;
|
|
1868
|
-
};
|
|
1869
|
-
} | {
|
|
1870
|
-
type: "media";
|
|
1871
|
-
image: {
|
|
1872
|
-
ref: string;
|
|
1873
|
-
caption?: string;
|
|
1874
|
-
};
|
|
1875
|
-
} | {
|
|
1876
|
-
type: "media";
|
|
1877
|
-
document: {
|
|
1878
|
-
ref: string;
|
|
1879
|
-
caption?: string;
|
|
1880
|
-
filename?: string;
|
|
1881
|
-
};
|
|
1882
|
-
} | {
|
|
1883
|
-
type: "media";
|
|
1884
|
-
audio: {
|
|
1885
|
-
ref: string;
|
|
1886
|
-
};
|
|
1887
|
-
} | {
|
|
1888
|
-
type: "media";
|
|
1889
|
-
video: {
|
|
1890
|
-
ref: string;
|
|
1891
|
-
caption?: string;
|
|
1892
|
-
};
|
|
1893
|
-
};
|
|
1894
|
-
|
|
1895
|
-
/**
|
|
1896
|
-
* This follows the BCP 47 language tag format.
|
|
1897
|
-
*/
|
|
1898
|
-
declare enum BCP47LanguageTag {
|
|
1899
|
-
AR_SA = "ar-SA",
|
|
1900
|
-
BN_BD = "bn-BD",
|
|
1901
|
-
BN_IN = "bn-IN",
|
|
1902
|
-
CS_CZ = "cs-CZ",
|
|
1903
|
-
DA_DK = "da-DK",
|
|
1904
|
-
DE_AT = "de-AT",
|
|
1905
|
-
DE_CH = "de-CH",
|
|
1906
|
-
DE_DE = "de-DE",
|
|
1907
|
-
EL_GR = "el-GR",
|
|
1908
|
-
EN_AU = "en-AU",
|
|
1909
|
-
EN_CA = "en-CA",
|
|
1910
|
-
EN_GB = "en-GB",
|
|
1911
|
-
EN_IE = "en-IE",
|
|
1912
|
-
EN_IN = "en-IN",
|
|
1913
|
-
EN_NZ = "en-NZ",
|
|
1914
|
-
EN_US = "en-US",
|
|
1915
|
-
EN_ZA = "en-ZA",
|
|
1916
|
-
ES_AR = "es-AR",
|
|
1917
|
-
ES_CL = "es-CL",
|
|
1918
|
-
ES_CO = "es-CO",
|
|
1919
|
-
ES_ES = "es-ES",
|
|
1920
|
-
ES_MX = "es-MX",
|
|
1921
|
-
ES_US = "es-US",
|
|
1922
|
-
FI_FI = "fi-FI",
|
|
1923
|
-
FR_BE = "fr-BE",
|
|
1924
|
-
FR_CA = "fr-CA",
|
|
1925
|
-
FR_CH = "fr-CH",
|
|
1926
|
-
FR_FR = "fr-FR",
|
|
1927
|
-
HE_IL = "he-IL",
|
|
1928
|
-
HI_IN = "hi-IN",
|
|
1929
|
-
HU_HU = "hu-HU",
|
|
1930
|
-
ID_ID = "id-ID",
|
|
1931
|
-
IT_CH = "it-CH",
|
|
1932
|
-
IT_IT = "it-IT",
|
|
1933
|
-
JA_JP = "ja-JP",
|
|
1934
|
-
KO_KR = "ko-KR",
|
|
1935
|
-
NL_BE = "nl-BE",
|
|
1936
|
-
NL_NL = "nl-NL",
|
|
1937
|
-
NO_NO = "no-NO",
|
|
1938
|
-
PL_PL = "pl-PL",
|
|
1939
|
-
PT_BR = "pt-BR",
|
|
1940
|
-
PT_PT = "pt-PT",
|
|
1941
|
-
RO_RO = "ro-RO",
|
|
1942
|
-
RU_RU = "ru-RU",
|
|
1943
|
-
SK_SK = "sk-SK",
|
|
1944
|
-
SV_SE = "sv-SE",
|
|
1945
|
-
TA_IN = "ta-IN",
|
|
1946
|
-
TA_LK = "ta-LK",
|
|
1947
|
-
TH_TH = "th-TH",
|
|
1948
|
-
TR_TR = "tr-TR",
|
|
1949
|
-
ZH_CN = "zh-CN",
|
|
1950
|
-
ZH_HK = "zh-HK",
|
|
1951
|
-
ZH_TW = "zh-TW"
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
type WaSDKOutgoingTemplateMessage = Omit<WaOutgoingTemplateMessage, "namespace" | "language"> & {
|
|
1955
|
-
type: "template";
|
|
1956
|
-
language: `${BCP47LanguageTag}`;
|
|
1957
|
-
};
|
|
1958
|
-
|
|
1959
|
-
type WaSDKOutgoingTextMessage = {
|
|
1960
|
-
type: "text";
|
|
1961
|
-
text: string;
|
|
1962
|
-
previewUrl?: boolean;
|
|
1963
|
-
};
|
|
1964
|
-
|
|
1965
|
-
type WaSDKSendMessageData = WaSDKButtonMessage | WaSDKOutgoingFlowMessage | WaSDKOutgoingListMessage | WaSDKOutgoingTextMessage | WaSDKOutgoingTemplateMessage | WaSDKOutgoingMediaMessage | WaSDKOutgoingContactMessage;
|
|
1966
|
-
|
|
1967
|
-
interface WaSDKSendMessageConfig {
|
|
1968
|
-
showUrlPreviewImage?: boolean;
|
|
1969
|
-
metadata?: string;
|
|
1970
|
-
to: string;
|
|
1971
|
-
reply?: string;
|
|
1972
|
-
}
|
|
1973
|
-
type WaSDKSendMessageBody = WaSDKSendMessageConfig & {
|
|
1974
|
-
message: WaSDKSendMessageData;
|
|
1975
|
-
};
|
|
1976
|
-
|
|
1977
|
-
declare function send(body: WaSDKSendMessageBody): Promise<WhatsappSendMessageResponse>;
|
|
1978
|
-
|
|
1979
|
-
declare const actions: {
|
|
1980
|
-
messages: {
|
|
1981
|
-
send: typeof send;
|
|
1982
|
-
showTypingIndicator: typeof showTypingIndicator;
|
|
1983
|
-
};
|
|
1984
|
-
media: {
|
|
1985
|
-
retrieve: typeof retrieveMedia;
|
|
1986
|
-
};
|
|
1987
|
-
flows: {
|
|
1988
|
-
create(body: Omit<WhatsappCreateFlowRequestBody, "flow_json"> & {
|
|
1989
|
-
flow_json?: Record<string, AnyType>;
|
|
1990
|
-
}): Promise<WhatsappCreateFlowResponse>;
|
|
1991
|
-
updateMetadata(flow_id: string, body: WhatsappFlowUpdateMetadataRequestBody): Promise<WhatsappFlowUpdateMetadataResponse>;
|
|
1992
|
-
updateJson(flow_id: string, json: Record<string, AnyType>): Promise<WhatsappUpdateFlowJsonResponse | {
|
|
1993
|
-
success: true;
|
|
1994
|
-
validation_errors: never[];
|
|
1995
|
-
}>;
|
|
1996
|
-
getPreview(flow_id: string, query?: WhatsappGetFlowWebPreviewPageRequestQuery): Promise<string>;
|
|
1997
|
-
get(flow_id: string, query?: {
|
|
1998
|
-
fields: Array<keyof WhatsappGetFlowsRequestResponse>;
|
|
1999
|
-
}): Promise<WhatsappGetManyFlowsRequestResponse>;
|
|
2000
|
-
getMany(): Promise<WhatsappGetManyFlowsRequestResponse>;
|
|
2001
|
-
publish(flow_id: string): Promise<WhatsappPublishFlowResponse>;
|
|
2002
|
-
delete: typeof _delete;
|
|
2003
|
-
};
|
|
2004
|
-
waba: {
|
|
2005
|
-
registerNumber: typeof registerNumber;
|
|
2006
|
-
encryption: {
|
|
2007
|
-
upload: typeof uploadWabaEncryption;
|
|
2008
|
-
};
|
|
2009
|
-
};
|
|
2010
|
-
};
|
|
2011
|
-
|
|
2012
|
-
declare const parsers: {
|
|
2013
|
-
toGraph: {
|
|
2014
|
-
sendMessage: (body: WaSDKSendMessageBody) => WhatsappSendMessageRequestBody<any> | WhatsappSendMessageRequestBody<"interactive"> | WhatsappSendMessageRequestBody<"text"> | WhatsappSendMessageRequestBody<"template"> | WhatsappSendMessageRequestBody<"contacts">;
|
|
2015
|
-
flowResponse: (flow_token: string, response: WhatsappFlowResponse) => WhatsappFlowResponse;
|
|
2016
|
-
};
|
|
2017
|
-
toSDK: {
|
|
2018
|
-
webhook: typeof webhook;
|
|
2019
|
-
};
|
|
2020
|
-
};
|
|
2021
|
-
|
|
2022
|
-
declare const toGraphLanguageTag: (languageTag: `${BCP47LanguageTag}`) => WhatsappLanguageTag;
|
|
2023
|
-
|
|
2024
|
-
type MessageReceivedEvent = Defined<WaSDKEventPayload["application"]["messageReceived"]>[0];
|
|
2025
|
-
|
|
2026
|
-
declare const security: {
|
|
2027
|
-
verifyHub: typeof verifyHub;
|
|
2028
|
-
verifySignature: typeof verifySignature;
|
|
2029
|
-
generateWabaEncryption: typeof generateWabaEncryption;
|
|
2030
|
-
decryptFlowBody: typeof decryptFlowBody;
|
|
2031
|
-
encryptFlowResponse: typeof encryptFlowResponse;
|
|
2032
|
-
decryptFlowMedia: typeof decryptFlowMedia;
|
|
2033
|
-
};
|
|
2034
|
-
|
|
2035
|
-
type WaSDKGetFlowWebPreviewPageRequestQuery = {
|
|
2036
|
-
flow_action: "data_exchange" | "navigate";
|
|
2037
|
-
phone_number: string;
|
|
2038
|
-
interactive?: boolean;
|
|
2039
|
-
recipient_id?: string;
|
|
2040
|
-
flow_action_payload?: {
|
|
2041
|
-
screen: string;
|
|
2042
|
-
data: Record<string, AnyType>;
|
|
2043
|
-
};
|
|
2044
|
-
flow_parameters?: FlowParameters;
|
|
2045
|
-
};
|
|
2046
|
-
type FlowParameters = Record<string, string | number>;
|
|
2047
|
-
|
|
2048
|
-
declare const createContactUrl: (phone: string, prefilled?: string) => string;
|
|
2049
|
-
|
|
2050
|
-
declare const flows: {
|
|
2051
|
-
createToken: ({ chatId, flow_name, flow_parameters, flow_identifier, }: {
|
|
2052
|
-
chatId: string;
|
|
2053
|
-
flow_name: string;
|
|
2054
|
-
flow_parameters?: Record<string, string | number>;
|
|
2055
|
-
flow_identifier?: string;
|
|
2056
|
-
}) => string;
|
|
2057
|
-
getName: (token: string) => string;
|
|
2058
|
-
destructureFlowToken: (token: string) => {
|
|
2059
|
-
paramsString: string;
|
|
2060
|
-
flowName: string;
|
|
2061
|
-
chatId: string;
|
|
2062
|
-
flowIdentifier: string;
|
|
2063
|
-
flowParameters: Record<string, string>;
|
|
2064
|
-
};
|
|
2065
|
-
};
|
|
2066
|
-
|
|
2067
|
-
declare const utils: {
|
|
2068
|
-
flows: {
|
|
2069
|
-
createToken: ({ chatId, flow_name, flow_parameters, flow_identifier, }: {
|
|
2070
|
-
chatId: string;
|
|
2071
|
-
flow_name: string;
|
|
2072
|
-
flow_parameters?: Record<string, string | number>;
|
|
2073
|
-
flow_identifier?: string;
|
|
2074
|
-
}) => string;
|
|
2075
|
-
getName: (token: string) => string;
|
|
2076
|
-
destructureFlowToken: (token: string) => {
|
|
2077
|
-
paramsString: string;
|
|
2078
|
-
flowName: string;
|
|
2079
|
-
chatId: string;
|
|
2080
|
-
flowIdentifier: string;
|
|
2081
|
-
flowParameters: Record<string, string>;
|
|
2082
|
-
};
|
|
2083
|
-
};
|
|
2084
|
-
createContactUrl: (phone: string, prefilled?: string) => string;
|
|
2085
|
-
};
|
|
2086
|
-
|
|
2087
|
-
type WhatsappSDKSettings = {
|
|
2088
|
-
GRAPH_API_VERSION: string;
|
|
2089
|
-
META_APP_ACCESS_TOKEN: string;
|
|
2090
|
-
META_APP_ID: string;
|
|
2091
|
-
META_APP_SECRET: string;
|
|
2092
|
-
WHATSAPP_MESSAGE_NAMESPACE: string;
|
|
2093
|
-
WHATSAPP_WEBHOOK_KEY: string;
|
|
2094
|
-
WHATSAPP_NUMBER_ID: string;
|
|
2095
|
-
WHATSAPP_ACCOUNT_ID: string;
|
|
2096
|
-
WHATSAPP_ACCOUNT_ENCRYPTION_PUBLIC_KEY: string;
|
|
2097
|
-
WHATSAPP_ACCOUNT_ENCRYPTION_PRIVATE_KEY: string;
|
|
2098
|
-
WHATSAPP_ACCOUNT_ENCRYPTION_PASSPHRASE: string;
|
|
2099
|
-
WHATSAPP_FLOWS_MODE: string;
|
|
2100
|
-
};
|
|
2101
|
-
|
|
2102
|
-
declare const createWhatsapp: () => {
|
|
2103
|
-
settings: {
|
|
2104
|
-
setup: (stg?: Partial<WhatsappSDKSettings>) => void;
|
|
2105
|
-
get: (key: keyof WhatsappSDKSettings) => string;
|
|
2106
|
-
};
|
|
2107
|
-
sdk: {
|
|
2108
|
-
actions: {
|
|
2109
|
-
messages: {
|
|
2110
|
-
send: typeof send;
|
|
2111
|
-
showTypingIndicator: typeof showTypingIndicator;
|
|
2112
|
-
};
|
|
2113
|
-
media: {
|
|
2114
|
-
retrieve: typeof retrieveMedia;
|
|
2115
|
-
};
|
|
2116
|
-
flows: {
|
|
2117
|
-
create(body: Omit<WhatsappCreateFlowRequestBody, "flow_json"> & {
|
|
2118
|
-
flow_json?: Record<string, AnyType>;
|
|
2119
|
-
}): Promise<WhatsappCreateFlowResponse>;
|
|
2120
|
-
updateMetadata(flow_id: string, body: WhatsappFlowUpdateMetadataRequestBody): Promise<WhatsappFlowUpdateMetadataResponse>;
|
|
2121
|
-
updateJson(flow_id: string, json: Record<string, AnyType>): Promise<WhatsappUpdateFlowJsonResponse | {
|
|
2122
|
-
success: true;
|
|
2123
|
-
validation_errors: never[];
|
|
2124
|
-
}>;
|
|
2125
|
-
getPreview(flow_id: string, query?: WhatsappGetFlowWebPreviewPageRequestQuery): Promise<string>;
|
|
2126
|
-
get(flow_id: string, query?: {
|
|
2127
|
-
fields: Array<keyof WhatsappGetFlowsRequestResponse>;
|
|
2128
|
-
}): Promise<WhatsappGetManyFlowsRequestResponse>;
|
|
2129
|
-
getMany(): Promise<WhatsappGetManyFlowsRequestResponse>;
|
|
2130
|
-
publish(flow_id: string): Promise<WhatsappPublishFlowResponse>;
|
|
2131
|
-
delete: typeof _delete;
|
|
2132
|
-
};
|
|
2133
|
-
waba: {
|
|
2134
|
-
registerNumber: typeof registerNumber;
|
|
2135
|
-
encryption: {
|
|
2136
|
-
upload: typeof uploadWabaEncryption;
|
|
2137
|
-
};
|
|
2138
|
-
};
|
|
2139
|
-
};
|
|
2140
|
-
flows: {
|
|
2141
|
-
createToken: ({ chatId, flow_name, flow_parameters, flow_identifier, }: {
|
|
2142
|
-
chatId: string;
|
|
2143
|
-
flow_name: string;
|
|
2144
|
-
flow_parameters?: Record<string, string | number>;
|
|
2145
|
-
flow_identifier?: string;
|
|
2146
|
-
}) => string;
|
|
2147
|
-
getName: (token: string) => string;
|
|
2148
|
-
destructureFlowToken: (token: string) => {
|
|
2149
|
-
paramsString: string;
|
|
2150
|
-
flowName: string;
|
|
2151
|
-
chatId: string;
|
|
2152
|
-
flowIdentifier: string;
|
|
2153
|
-
flowParameters: Record<string, string>;
|
|
2154
|
-
};
|
|
2155
|
-
};
|
|
2156
|
-
parsers: {
|
|
2157
|
-
toGraph: {
|
|
2158
|
-
sendMessage: (body: WaSDKSendMessageBody) => WhatsappSendMessageRequestBody<any> | WhatsappSendMessageRequestBody<"interactive"> | WhatsappSendMessageRequestBody<"text"> | WhatsappSendMessageRequestBody<"template"> | WhatsappSendMessageRequestBody<"contacts">;
|
|
2159
|
-
flowResponse: (flow_token: string, response: WhatsappFlowResponse) => WhatsappFlowResponse;
|
|
2160
|
-
};
|
|
2161
|
-
toSDK: {
|
|
2162
|
-
webhook: typeof webhook;
|
|
2163
|
-
};
|
|
2164
|
-
};
|
|
2165
|
-
security: {
|
|
2166
|
-
verifyHub: typeof verifyHub;
|
|
2167
|
-
verifySignature: typeof verifySignature;
|
|
2168
|
-
generateWabaEncryption: typeof generateWabaEncryption;
|
|
2169
|
-
decryptFlowBody: typeof decryptFlowBody;
|
|
2170
|
-
encryptFlowResponse: typeof encryptFlowResponse;
|
|
2171
|
-
decryptFlowMedia: typeof decryptFlowMedia;
|
|
2172
|
-
};
|
|
2173
|
-
utils: {
|
|
2174
|
-
flows: {
|
|
2175
|
-
createToken: ({ chatId, flow_name, flow_parameters, flow_identifier, }: {
|
|
2176
|
-
chatId: string;
|
|
2177
|
-
flow_name: string;
|
|
2178
|
-
flow_parameters?: Record<string, string | number>;
|
|
2179
|
-
flow_identifier?: string;
|
|
2180
|
-
}) => string;
|
|
2181
|
-
getName: (token: string) => string;
|
|
2182
|
-
destructureFlowToken: (token: string) => {
|
|
2183
|
-
paramsString: string;
|
|
2184
|
-
flowName: string;
|
|
2185
|
-
chatId: string;
|
|
2186
|
-
flowIdentifier: string;
|
|
2187
|
-
flowParameters: Record<string, string>;
|
|
2188
|
-
};
|
|
2189
|
-
};
|
|
2190
|
-
createContactUrl: (phone: string, prefilled?: string) => string;
|
|
2191
|
-
};
|
|
2192
|
-
toGraphLanguageTag: (languageTag: `${BCP47LanguageTag}`) => WhatsappLanguageTag;
|
|
2193
|
-
};
|
|
2194
|
-
graph: {
|
|
2195
|
-
endpoints: {
|
|
2196
|
-
flows: {
|
|
2197
|
-
create: Endpoint<"/{waba_id}/flows", "post", {
|
|
2198
|
-
body: WhatsappCreateFlowRequestBody;
|
|
2199
|
-
}, WhatsappCreateFlowResponse>;
|
|
2200
|
-
updateMetadata: Endpoint<"/{flow_id}", "post", {
|
|
2201
|
-
body: WhatsappFlowUpdateMetadataRequestBody;
|
|
2202
|
-
}, WhatsappFlowUpdateMetadataResponse>;
|
|
2203
|
-
readMany: Endpoint<"/{waba_id}/flows", "get", IRequest, WhatsappGetManyFlowsRequestResponse>;
|
|
2204
|
-
delete: Endpoint<"/{flow_id}", "delete", IRequest, WhatsappDeleteFlowResponse>;
|
|
2205
|
-
read: Endpoint<"/{flow_id}", "get", {
|
|
2206
|
-
query: WhatsappGetFlowsRequestQuery;
|
|
2207
|
-
}, WhatsappGetManyFlowsRequestResponse>;
|
|
2208
|
-
updateJson: Endpoint<"/{flow_id}/assets", "post", {
|
|
2209
|
-
body: WhatsappUpdateFlowJsonRequestBody;
|
|
2210
|
-
}, WhatsappUpdateFlowJsonResponse>;
|
|
2211
|
-
getPreview: Endpoint<"/{flow_id}?fields=preview.invalidate(false)", "get", IRequest, WhatsappGetFlowWebPreviewURLResponse>;
|
|
2212
|
-
publish: Endpoint<"/{flow_id}/publish", "post", IRequest, WhatsappPublishFlowResponse>;
|
|
2213
|
-
};
|
|
2214
|
-
messages: {
|
|
2215
|
-
send: Endpoint<"/{number_id}/messages", "post", {
|
|
2216
|
-
body: WhatsappSendMessageRequestBody<any>;
|
|
2217
|
-
}, WhatsappSendMessageResponse>;
|
|
2218
|
-
showTypingIndicator: Endpoint<"/{number_id}/messages", "post", {
|
|
2219
|
-
body: WhatsappShowTypingIndicatorRequestBody;
|
|
2220
|
-
}, WhatsappShowTypingIndicatorRequestResponse>;
|
|
2221
|
-
};
|
|
2222
|
-
waba: {
|
|
2223
|
-
updateEncryption: Endpoint<"/{number_id}/whatsapp_business_encryption", "post", {
|
|
2224
|
-
body: WhatsappWabaUploadEncryptionRequestBody;
|
|
2225
|
-
}, unknown>;
|
|
2226
|
-
registerNumber: Endpoint<"/{number_id}/register", "post", {
|
|
2227
|
-
body: WhatsappRegisterPhoneNumberRequestBody;
|
|
2228
|
-
}, unknown>;
|
|
2229
|
-
};
|
|
2230
|
-
media: {
|
|
2231
|
-
fetch: Endpoint<"/{media_id}", "get", {
|
|
2232
|
-
query: {
|
|
2233
|
-
phone_number_id?: string;
|
|
2234
|
-
};
|
|
2235
|
-
}, WhatsappMediaRetrieveRequestResponse>;
|
|
2236
|
-
};
|
|
2237
|
-
};
|
|
2238
|
-
};
|
|
2239
|
-
};
|
|
2240
|
-
|
|
2241
|
-
export { BCP47LanguageTag, type BaseMessageReceivedEventPayload, type ConversationType, type DataExchangeFlowConfig, type FlowAction, type FlowCanSendMessageStatus, type FlowCategory, type FlowConfig, type FlowData, type FlowMediaData, type FlowMetadata, type FlowParameters, type FlowScreen, type FlowStatus, type FlowUpdateEventPayload, type FlowValidationError, type MediaTypes, type MessageField, type MessageReceivedEvent, type MessageReceivedEventPayload, type MessageStatusUpdateEvent, type MetadataObject, type NavigateFlowConfig, type RegisterNumberPayload, type RetrieveMediaPayload, type WaIncomingAudioObject, type WaIncomingButtonObject, type WaIncomingContactObject, type WaIncomingContacts, type WaIncomingContextObject, type WaIncomingDocumentObject, type WaIncomingErrorObject, type WaIncomingErrors, type WaIncomingIdentityObject, type WaIncomingImageObject, type WaIncomingInteractiveObject, type WaIncomingMessageStatus, type WaIncomingMessageStatuses, type WaIncomingMessageType, type WaIncomingMessages, type WaIncomingOrderObject, type WaIncomingReferralObject, type WaIncomingStickerObject, type WaIncomingSystemObject, type WaIncomingTextObject, type WaIncomingVideoObject, type WaInteractiveAction, type WaInteractiveActionType, type WaInteractiveBase, type WaInteractiveBody, type WaInteractiveFooter, type WaInteractiveHeader, type WaMessageType, type WaOutgoingAudioMessage, type WaOutgoingContactsMessage, type WaOutgoingDocumentMessage, type WaOutgoingImageMessage, type WaOutgoingInteractiveMessage, type WaOutgoingLocationMessage, type WaOutgoingMessage, type WaOutgoingReactionMessage, type WaOutgoingStickerMessage, type WaOutgoingTemplateMessage, type WaOutgoingTextMessage, type WaOutgoingVideoMessage, type WaSDKButtonMessage, type WaSDKEvent, type WaSDKEventPayload, type WaSDKEventType, type WaSDKFlowDecryptedWebhookBody, type WaSDKFlowExchangeEventPayload, type WaSDKFlowPayload, type WaSDKGetFlowWebPreviewPageRequestQuery, type WaSDKOutgoingContactMessage, type WaSDKOutgoingFlowMessage, type WaSDKOutgoingListMessage, type WaSDKOutgoingMediaMessage, type WaSDKOutgoingTemplateMessage, type WaSDKOutgoingTextMessage, type WaSDKSendMessageBody, type WaSDKSendMessageConfig, type WaSDKSendMessageData, type WebhookSignatureChallengeArguments, type WhatsappApplicationWebhookBody, type WhatsappCreateFlowRequestBody, type WhatsappCreateFlowResponse, type WhatsappDeleteFlowResponse, WhatsappErrorCode, type WhatsappFlowDecryptedWebhookBody, type WhatsappFlowEncryptedWebhookBody, type WhatsappFlowEncryptionData, type WhatsappFlowErrorMessages, type WhatsappFlowInfo, type WhatsappFlowPingResponse, type WhatsappFlowResponse, type WhatsappFlowUpdateMetadataRequestBody, type WhatsappFlowUpdateMetadataResponse, type WhatsappGetFlowWebPreviewPageRequestQuery, type WhatsappGetFlowWebPreviewURLResponse, type WhatsappGetFlowsRequestQuery, type WhatsappGetFlowsRequestResponse, type WhatsappGetManyFlowsRequestResponse, type WhatsappISOCountryCode, type WhatsappLanguageTag, type WhatsappMediaRetrieveRequestResponse, type WhatsappPublishFlowResponse, type WhatsappRegisterPhoneNumberRequestBody, type WhatsappSDKShowTypingIndicatorParams, type WhatsappSendMessageRequestBody, type WhatsappSendMessageRequestConfig, type WhatsappSendMessageResponse, type WhatsappShowTypingIndicatorRequestBody, type WhatsappShowTypingIndicatorRequestResponse, type WhatsappUpdateFlowJsonRequestBody, type WhatsappUpdateFlowJsonResponse, type WhatsappWabaUploadEncryptionRequestBody, actions, createContactUrl, createWhatsapp, endpoints, flows, flowsEndpoints, mediaEndpoints, messagesEndpoints, parsers, security, toGraphLanguageTag, utils, wabaEndpoints };
|
|
465
|
+
pin: string;
|
|
466
|
+
dataRegion?: WhatsappApiIsoCountryCode;
|
|
467
|
+
}
|
|
468
|
+
declare function registerNumber({
|
|
469
|
+
pin,
|
|
470
|
+
dataRegion
|
|
471
|
+
}: RegisterNumberPayload): Promise<void>;
|
|
472
|
+
//#endregion
|
|
473
|
+
//#region src/features/waba/actions/upload-encryption.d.ts
|
|
474
|
+
declare function uploadEncryption(publicKey: string): Promise<void>;
|
|
475
|
+
declare namespace index_d_exports$1 {
|
|
476
|
+
export { RegisterNumberPayload, registerNumber, uploadEncryption };
|
|
477
|
+
}
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/features/webhook/adapters/message-received.adapter.d.ts
|
|
480
|
+
declare const messageReceivedAdapter: {
|
|
481
|
+
fromGraph(message: WhatsappApiWebhookMessageObject): WhatsappMessageReceivedWebhook;
|
|
482
|
+
};
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region src/features/webhook/guards/guard-hub.d.ts
|
|
485
|
+
declare const guardHub: WhatsappHubGuard;
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/features/webhook/guards/guard-signature.d.ts
|
|
488
|
+
declare function guardSignature(request: Request, rawBody: string): Promise<boolean>;
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region src/features/webhook/webhook.d.ts
|
|
491
|
+
declare function webhook(request: Request): Promise<WhatsappWebhook>;
|
|
492
|
+
declare namespace index_d_exports {
|
|
493
|
+
export { guardHub, guardSignature, messageReceivedAdapter, webhook };
|
|
494
|
+
}
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/client/client.d.ts
|
|
497
|
+
declare const createWhatsapp: (config?: WhatsappConfig) => {
|
|
498
|
+
flows: typeof index_d_exports$4;
|
|
499
|
+
i18n: typeof index_d_exports$3;
|
|
500
|
+
messages: typeof index_d_exports$2;
|
|
501
|
+
waba: typeof index_d_exports$1;
|
|
502
|
+
webhook: typeof index_d_exports;
|
|
503
|
+
};
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/client/normalize-pem-key.d.ts
|
|
506
|
+
declare function normalizePemKey(key: string | undefined): string | undefined;
|
|
507
|
+
//#endregion
|
|
508
|
+
export { ChatURL, FlowToken, WabaEncryption, type WhatsappButtonMessage, type WhatsappConfig, type WhatsappContactMessage, type WhatsappContext, type WhatsappFlowEncryptionMetadata, type WhatsappFlowJSON, type WhatsappFlowMediaDecryptor, type WhatsappFlowMessage, type WhatsappFlowMetadata, type WhatsappFlowParameters, type WhatsappFlowResponseEncryptor, type WhatsappFlowWebhookDecryptor, type WhatsappGetFlowWebPreviewPageRequestQuery, type WhatsappHubGuard, WhatsappLanguageTag, type WhatsappListMessage, type WhatsappMediaMessage, type WhatsappMessage, type WhatsappMessageReceivedWebhook, type WhatsappMessageStatusWebhook, type WhatsappReceivedMediaKind, type WhatsappSendMessageRequest, type WhatsappShowTypingIndicatorRequest, type WhatsappSignature, type WhatsappTemplateMessage, type WhatsappTextMessage, type WhatsappWabaEncryptionGenerator, type WhatsappWebhook, type WhatsappWebhookFlow, type WhatsappWebhookFlowUpdate, type WhatsappWebhookType, createWhatsapp, normalizePemKey };
|