@oficialapi/sdk 4.0.0 → 5.0.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.d.mts +116 -40
- package/dist/index.d.ts +116 -40
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -87,19 +87,22 @@ interface SendWhatsAppTemplateParams {
|
|
|
87
87
|
interface SendWhatsAppButtonsParams {
|
|
88
88
|
token: string;
|
|
89
89
|
sender: string;
|
|
90
|
-
|
|
90
|
+
text: string;
|
|
91
91
|
buttons: Array<{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
id: string;
|
|
95
|
-
title: string;
|
|
96
|
-
};
|
|
92
|
+
id: string;
|
|
93
|
+
title: string;
|
|
97
94
|
}>;
|
|
95
|
+
media?: {
|
|
96
|
+
type: string;
|
|
97
|
+
url: string;
|
|
98
|
+
};
|
|
98
99
|
}
|
|
99
100
|
interface SendWhatsAppListParams {
|
|
100
101
|
token: string;
|
|
101
102
|
sender: string;
|
|
102
|
-
|
|
103
|
+
headerText: string;
|
|
104
|
+
bodyText: string;
|
|
105
|
+
footerText?: string;
|
|
103
106
|
buttonText: string;
|
|
104
107
|
sections: Array<{
|
|
105
108
|
title: string;
|
|
@@ -112,13 +115,16 @@ interface SendWhatsAppListParams {
|
|
|
112
115
|
}
|
|
113
116
|
interface ReplyWhatsAppParams {
|
|
114
117
|
token: string;
|
|
115
|
-
|
|
118
|
+
sender: string;
|
|
116
119
|
messageText: string;
|
|
120
|
+
replyMessageId?: string;
|
|
121
|
+
preview_url?: boolean;
|
|
117
122
|
}
|
|
118
123
|
interface ReactWhatsAppParams {
|
|
119
124
|
token: string;
|
|
120
|
-
|
|
125
|
+
sender: string;
|
|
121
126
|
emoji: string;
|
|
127
|
+
message_id?: string;
|
|
122
128
|
}
|
|
123
129
|
interface CreateTemplateParams {
|
|
124
130
|
token: string;
|
|
@@ -149,47 +155,113 @@ interface UploadMediaParams {
|
|
|
149
155
|
interface SendOrderDetailsParams {
|
|
150
156
|
token: string;
|
|
151
157
|
sender: string;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
price: number;
|
|
158
|
-
}>;
|
|
159
|
-
orderTotal: number;
|
|
158
|
+
headerText?: string;
|
|
159
|
+
bodyText: string;
|
|
160
|
+
footerText?: string;
|
|
161
|
+
reference_id: string;
|
|
162
|
+
type: 'digital-goods' | 'physical-goods';
|
|
160
163
|
currency: string;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
total_amount: {
|
|
165
|
+
value: number;
|
|
166
|
+
offset: number;
|
|
167
|
+
description?: string;
|
|
168
|
+
};
|
|
169
|
+
order: {
|
|
170
|
+
status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
|
|
171
|
+
catalog_id?: string;
|
|
172
|
+
items: Array<{
|
|
173
|
+
retailer_id: string;
|
|
174
|
+
name: string;
|
|
175
|
+
amount: {
|
|
176
|
+
value: number;
|
|
177
|
+
offset: number;
|
|
178
|
+
description?: string;
|
|
179
|
+
};
|
|
180
|
+
quantity: number;
|
|
181
|
+
sale_amount?: {
|
|
182
|
+
value: number;
|
|
183
|
+
offset: number;
|
|
184
|
+
description?: string;
|
|
185
|
+
};
|
|
186
|
+
}>;
|
|
187
|
+
subtotal: {
|
|
188
|
+
value: number;
|
|
189
|
+
offset: number;
|
|
190
|
+
description?: string;
|
|
191
|
+
};
|
|
192
|
+
tax: {
|
|
193
|
+
value: number;
|
|
194
|
+
offset: number;
|
|
195
|
+
description?: string;
|
|
196
|
+
};
|
|
197
|
+
shipping?: {
|
|
198
|
+
value: number;
|
|
199
|
+
offset: number;
|
|
200
|
+
description?: string;
|
|
201
|
+
};
|
|
202
|
+
discount?: {
|
|
203
|
+
value: number;
|
|
204
|
+
offset: number;
|
|
205
|
+
description?: string;
|
|
206
|
+
discount_program_name?: string;
|
|
207
|
+
};
|
|
208
|
+
expiration?: {
|
|
209
|
+
timestamp: string;
|
|
210
|
+
description: string;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
payment_settings?: Array<{
|
|
214
|
+
type: 'pix_dynamic_code' | 'payment_link' | 'boleto' | 'offsite_card_pay';
|
|
215
|
+
pix_dynamic_code?: {
|
|
216
|
+
code: string;
|
|
217
|
+
merchant_name: string;
|
|
218
|
+
key: string;
|
|
219
|
+
key_type: 'CPF' | 'CNPJ' | 'EMAIL' | 'PHONE' | 'EVP';
|
|
220
|
+
};
|
|
221
|
+
payment_link?: {
|
|
222
|
+
uri: string;
|
|
223
|
+
};
|
|
224
|
+
boleto?: {
|
|
225
|
+
digitable_line: string;
|
|
226
|
+
};
|
|
227
|
+
offsite_card_pay?: {
|
|
228
|
+
last_four_digits: string;
|
|
229
|
+
credential_id: string;
|
|
230
|
+
};
|
|
164
231
|
}>;
|
|
165
232
|
}
|
|
166
233
|
interface SendOrderStatusParams {
|
|
167
234
|
token: string;
|
|
168
235
|
sender: string;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
236
|
+
bodyText: string;
|
|
237
|
+
footerText?: string;
|
|
238
|
+
reference_id: string;
|
|
239
|
+
order_status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
|
|
240
|
+
status_description?: string;
|
|
241
|
+
payment_status?: 'pending' | 'captured' | 'failed';
|
|
242
|
+
payment_timestamp?: number;
|
|
172
243
|
}
|
|
173
244
|
interface SendWhatsAppAudioParams {
|
|
174
245
|
token: string;
|
|
175
246
|
sender: string;
|
|
176
|
-
|
|
247
|
+
mediaId: string;
|
|
248
|
+
voice?: boolean;
|
|
177
249
|
}
|
|
178
250
|
interface SendWhatsAppStickerParams {
|
|
179
251
|
token: string;
|
|
180
252
|
sender: string;
|
|
181
|
-
|
|
253
|
+
mediaId: string;
|
|
182
254
|
}
|
|
183
255
|
interface SendWhatsAppVideoParams {
|
|
184
256
|
token: string;
|
|
185
257
|
sender: string;
|
|
186
|
-
|
|
258
|
+
mediaId: string;
|
|
187
259
|
caption?: string;
|
|
188
260
|
}
|
|
189
261
|
interface SendWhatsAppDocumentParams {
|
|
190
262
|
token: string;
|
|
191
263
|
sender: string;
|
|
192
|
-
|
|
264
|
+
mediaId: string;
|
|
193
265
|
filename?: string;
|
|
194
266
|
caption?: string;
|
|
195
267
|
}
|
|
@@ -246,30 +318,34 @@ interface SendWhatsAppLocationParams {
|
|
|
246
318
|
interface SendWhatsAppLocationRequestParams {
|
|
247
319
|
token: string;
|
|
248
320
|
sender: string;
|
|
249
|
-
|
|
321
|
+
bodyText: string;
|
|
322
|
+
headerText?: string;
|
|
323
|
+
footerText?: string;
|
|
250
324
|
}
|
|
251
325
|
interface SendWhatsAppCtaUrlParams {
|
|
252
326
|
token: string;
|
|
253
327
|
sender: string;
|
|
254
|
-
|
|
328
|
+
bodyText: string;
|
|
255
329
|
buttonText: string;
|
|
256
330
|
url: string;
|
|
331
|
+
header?: {
|
|
332
|
+
type: 'text' | 'image' | 'video' | 'document';
|
|
333
|
+
text?: string;
|
|
334
|
+
link?: string;
|
|
335
|
+
};
|
|
336
|
+
footerText?: string;
|
|
257
337
|
}
|
|
258
338
|
interface SendWhatsAppMediaCarouselParams {
|
|
259
339
|
token: string;
|
|
260
340
|
sender: string;
|
|
341
|
+
bodyText: string;
|
|
261
342
|
cards: Array<{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
description: string;
|
|
269
|
-
actions: Array<{
|
|
270
|
-
type: 'link';
|
|
271
|
-
value: string;
|
|
272
|
-
}>;
|
|
343
|
+
cardIndex: number;
|
|
344
|
+
headerType: 'image' | 'video';
|
|
345
|
+
headerLink: string;
|
|
346
|
+
bodyText: string;
|
|
347
|
+
buttonText: string;
|
|
348
|
+
url: string;
|
|
273
349
|
}>;
|
|
274
350
|
}
|
|
275
351
|
interface DownloadWhatsAppMediaParams {
|
package/dist/index.d.ts
CHANGED
|
@@ -87,19 +87,22 @@ interface SendWhatsAppTemplateParams {
|
|
|
87
87
|
interface SendWhatsAppButtonsParams {
|
|
88
88
|
token: string;
|
|
89
89
|
sender: string;
|
|
90
|
-
|
|
90
|
+
text: string;
|
|
91
91
|
buttons: Array<{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
id: string;
|
|
95
|
-
title: string;
|
|
96
|
-
};
|
|
92
|
+
id: string;
|
|
93
|
+
title: string;
|
|
97
94
|
}>;
|
|
95
|
+
media?: {
|
|
96
|
+
type: string;
|
|
97
|
+
url: string;
|
|
98
|
+
};
|
|
98
99
|
}
|
|
99
100
|
interface SendWhatsAppListParams {
|
|
100
101
|
token: string;
|
|
101
102
|
sender: string;
|
|
102
|
-
|
|
103
|
+
headerText: string;
|
|
104
|
+
bodyText: string;
|
|
105
|
+
footerText?: string;
|
|
103
106
|
buttonText: string;
|
|
104
107
|
sections: Array<{
|
|
105
108
|
title: string;
|
|
@@ -112,13 +115,16 @@ interface SendWhatsAppListParams {
|
|
|
112
115
|
}
|
|
113
116
|
interface ReplyWhatsAppParams {
|
|
114
117
|
token: string;
|
|
115
|
-
|
|
118
|
+
sender: string;
|
|
116
119
|
messageText: string;
|
|
120
|
+
replyMessageId?: string;
|
|
121
|
+
preview_url?: boolean;
|
|
117
122
|
}
|
|
118
123
|
interface ReactWhatsAppParams {
|
|
119
124
|
token: string;
|
|
120
|
-
|
|
125
|
+
sender: string;
|
|
121
126
|
emoji: string;
|
|
127
|
+
message_id?: string;
|
|
122
128
|
}
|
|
123
129
|
interface CreateTemplateParams {
|
|
124
130
|
token: string;
|
|
@@ -149,47 +155,113 @@ interface UploadMediaParams {
|
|
|
149
155
|
interface SendOrderDetailsParams {
|
|
150
156
|
token: string;
|
|
151
157
|
sender: string;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
price: number;
|
|
158
|
-
}>;
|
|
159
|
-
orderTotal: number;
|
|
158
|
+
headerText?: string;
|
|
159
|
+
bodyText: string;
|
|
160
|
+
footerText?: string;
|
|
161
|
+
reference_id: string;
|
|
162
|
+
type: 'digital-goods' | 'physical-goods';
|
|
160
163
|
currency: string;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
total_amount: {
|
|
165
|
+
value: number;
|
|
166
|
+
offset: number;
|
|
167
|
+
description?: string;
|
|
168
|
+
};
|
|
169
|
+
order: {
|
|
170
|
+
status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
|
|
171
|
+
catalog_id?: string;
|
|
172
|
+
items: Array<{
|
|
173
|
+
retailer_id: string;
|
|
174
|
+
name: string;
|
|
175
|
+
amount: {
|
|
176
|
+
value: number;
|
|
177
|
+
offset: number;
|
|
178
|
+
description?: string;
|
|
179
|
+
};
|
|
180
|
+
quantity: number;
|
|
181
|
+
sale_amount?: {
|
|
182
|
+
value: number;
|
|
183
|
+
offset: number;
|
|
184
|
+
description?: string;
|
|
185
|
+
};
|
|
186
|
+
}>;
|
|
187
|
+
subtotal: {
|
|
188
|
+
value: number;
|
|
189
|
+
offset: number;
|
|
190
|
+
description?: string;
|
|
191
|
+
};
|
|
192
|
+
tax: {
|
|
193
|
+
value: number;
|
|
194
|
+
offset: number;
|
|
195
|
+
description?: string;
|
|
196
|
+
};
|
|
197
|
+
shipping?: {
|
|
198
|
+
value: number;
|
|
199
|
+
offset: number;
|
|
200
|
+
description?: string;
|
|
201
|
+
};
|
|
202
|
+
discount?: {
|
|
203
|
+
value: number;
|
|
204
|
+
offset: number;
|
|
205
|
+
description?: string;
|
|
206
|
+
discount_program_name?: string;
|
|
207
|
+
};
|
|
208
|
+
expiration?: {
|
|
209
|
+
timestamp: string;
|
|
210
|
+
description: string;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
payment_settings?: Array<{
|
|
214
|
+
type: 'pix_dynamic_code' | 'payment_link' | 'boleto' | 'offsite_card_pay';
|
|
215
|
+
pix_dynamic_code?: {
|
|
216
|
+
code: string;
|
|
217
|
+
merchant_name: string;
|
|
218
|
+
key: string;
|
|
219
|
+
key_type: 'CPF' | 'CNPJ' | 'EMAIL' | 'PHONE' | 'EVP';
|
|
220
|
+
};
|
|
221
|
+
payment_link?: {
|
|
222
|
+
uri: string;
|
|
223
|
+
};
|
|
224
|
+
boleto?: {
|
|
225
|
+
digitable_line: string;
|
|
226
|
+
};
|
|
227
|
+
offsite_card_pay?: {
|
|
228
|
+
last_four_digits: string;
|
|
229
|
+
credential_id: string;
|
|
230
|
+
};
|
|
164
231
|
}>;
|
|
165
232
|
}
|
|
166
233
|
interface SendOrderStatusParams {
|
|
167
234
|
token: string;
|
|
168
235
|
sender: string;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
236
|
+
bodyText: string;
|
|
237
|
+
footerText?: string;
|
|
238
|
+
reference_id: string;
|
|
239
|
+
order_status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
|
|
240
|
+
status_description?: string;
|
|
241
|
+
payment_status?: 'pending' | 'captured' | 'failed';
|
|
242
|
+
payment_timestamp?: number;
|
|
172
243
|
}
|
|
173
244
|
interface SendWhatsAppAudioParams {
|
|
174
245
|
token: string;
|
|
175
246
|
sender: string;
|
|
176
|
-
|
|
247
|
+
mediaId: string;
|
|
248
|
+
voice?: boolean;
|
|
177
249
|
}
|
|
178
250
|
interface SendWhatsAppStickerParams {
|
|
179
251
|
token: string;
|
|
180
252
|
sender: string;
|
|
181
|
-
|
|
253
|
+
mediaId: string;
|
|
182
254
|
}
|
|
183
255
|
interface SendWhatsAppVideoParams {
|
|
184
256
|
token: string;
|
|
185
257
|
sender: string;
|
|
186
|
-
|
|
258
|
+
mediaId: string;
|
|
187
259
|
caption?: string;
|
|
188
260
|
}
|
|
189
261
|
interface SendWhatsAppDocumentParams {
|
|
190
262
|
token: string;
|
|
191
263
|
sender: string;
|
|
192
|
-
|
|
264
|
+
mediaId: string;
|
|
193
265
|
filename?: string;
|
|
194
266
|
caption?: string;
|
|
195
267
|
}
|
|
@@ -246,30 +318,34 @@ interface SendWhatsAppLocationParams {
|
|
|
246
318
|
interface SendWhatsAppLocationRequestParams {
|
|
247
319
|
token: string;
|
|
248
320
|
sender: string;
|
|
249
|
-
|
|
321
|
+
bodyText: string;
|
|
322
|
+
headerText?: string;
|
|
323
|
+
footerText?: string;
|
|
250
324
|
}
|
|
251
325
|
interface SendWhatsAppCtaUrlParams {
|
|
252
326
|
token: string;
|
|
253
327
|
sender: string;
|
|
254
|
-
|
|
328
|
+
bodyText: string;
|
|
255
329
|
buttonText: string;
|
|
256
330
|
url: string;
|
|
331
|
+
header?: {
|
|
332
|
+
type: 'text' | 'image' | 'video' | 'document';
|
|
333
|
+
text?: string;
|
|
334
|
+
link?: string;
|
|
335
|
+
};
|
|
336
|
+
footerText?: string;
|
|
257
337
|
}
|
|
258
338
|
interface SendWhatsAppMediaCarouselParams {
|
|
259
339
|
token: string;
|
|
260
340
|
sender: string;
|
|
341
|
+
bodyText: string;
|
|
261
342
|
cards: Array<{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
description: string;
|
|
269
|
-
actions: Array<{
|
|
270
|
-
type: 'link';
|
|
271
|
-
value: string;
|
|
272
|
-
}>;
|
|
343
|
+
cardIndex: number;
|
|
344
|
+
headerType: 'image' | 'video';
|
|
345
|
+
headerLink: string;
|
|
346
|
+
bodyText: string;
|
|
347
|
+
buttonText: string;
|
|
348
|
+
url: string;
|
|
273
349
|
}>;
|
|
274
350
|
}
|
|
275
351
|
interface DownloadWhatsAppMediaParams {
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* @version 1.0.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
var f="https://api.oficialapi.com.br",r=class{constructor(e){this.config={clientId:e.clientId,clientSecret:e.clientSecret,timeout:e.timeout||3e4,maxRetries:e.maxRetries||3,retryDelay:e.retryDelay||1e3,headers:e.headers||{}},this.axiosInstance=I__default.default.create({baseURL:f,timeout:this.config.timeout,headers:{"Content-Type":"application/json",...this.config.headers}}),this.setupInterceptors();}setupInterceptors(){this.axiosInstance.interceptors.request.use(e=>{if(e.url?.includes("/auth/token"))return e;let t=e;return t.accessToken&&e.headers&&(e.headers.Authorization=`Bearer ${t.accessToken}`),e},e=>Promise.reject(e)),this.axiosInstance.interceptors.response.use(e=>e,async e=>{let t=e.config;if(!t)return Promise.reject(this.formatError(e));if((!e.response||e.response.status>=500&&e.response.status<600)&&(!t._retryCount||t._retryCount<this.config.maxRetries)){t._retryCount=(t._retryCount||0)+1;let i=this.config.retryDelay*t._retryCount;return await new Promise(s=>setTimeout(s,i)),this.axiosInstance(t)}return Promise.reject(this.formatError(e))});}formatError(e){if(e.response){let t=e.response.data,n=t?.error?.message||t?.message||e.message,i=t?.error?.details||[],s=new Error(n);return s.status=e.response.status,s.data=e.response.data,s.details=i,s}return e.request?new Error("Erro de conex\xE3o com a API. Verifique sua conex\xE3o com a internet."):e}async get(e,t,n){let i={...n,accessToken:t};return (await this.axiosInstance.get(e,i)).data}async post(e,t,n,i){let s={...i,accessToken:n};return (await this.axiosInstance.post(e,t,s)).data}async put(e,t,n,i){let s={...i,accessToken:n};return (await this.axiosInstance.put(e,t,s)).data}async delete(e,t,n,i){let s={...i,accessToken:t,data:n};return (await this.axiosInstance.delete(e,s)).data}async upload(e,t,n,i="file",s){let a=new FormData;if(t instanceof Buffer){let k=new Blob([t]);a.append(i,k);}else a.append(i,t);s&&Object.entries(s).forEach(([k,C])=>{a.append(k,typeof C=="string"?C:JSON.stringify(C));});let y={headers:{"Content-Type":"multipart/form-data"},accessToken:n};return (await this.axiosInstance.post(e,a,y)).data}};var d=class{constructor(e){this.httpClient=e;}async getToken(e,t){let n=await this.httpClient.post("/api/v1/auth/token",{client_id:e,client_secret:t});if(!n.success||!n.data)throw new Error(n.error?.message||"Falha ao obter token");return n.data}};var p=class{constructor(e){this.httpClient=e;}async list(e){let t=await this.httpClient.get("/api/v1/channels",e);if(!t.success||!t.data)throw new Error(t.error?.message||"Falha ao listar canais");return Array.isArray(t.data)?t.data:[t.data]}};var l=class{constructor(e){this.httpClient=e;}async createWebhook(e,t){let n=await this.httpClient.post("/api/v1/integrations",{url:e.url,expiresInDays:e.expiresInDays},t);if(!n.success||!n.data)throw new Error(n.error?.message||"Falha ao criar webhook");return n.data}};var c=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/whatsapp/send-message",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/send-template",{token:e.token,sender:e.sender,templateName:e.templateName,languageCode:e.languageCode,components:e.components},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/whatsapp/send-buttons",{token:e.token,sender:e.sender,messageText:e.messageText,buttons:e.buttons},t)}async sendList(e,t){return this.httpClient.post("/api/v1/whatsapp/send-list",{token:e.token,sender:e.sender,messageText:e.messageText,buttonText:e.buttonText,sections:e.sections},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/reply-message",{token:e.token,messageId:e.messageId,messageText:e.messageText},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/react-message",{token:e.token,messageId:e.messageId,emoji:e.emoji},t)}async createTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/create-template",{token:e.token,name:e.name,language:e.language,category:e.category,components:e.components},t)}async listTemplates(e,t){return this.httpClient.get(`/api/v1/whatsapp/templates?token=${encodeURIComponent(e)}`,t)}async getTemplate(e,t,n){return this.httpClient.get(`/api/v1/whatsapp/templates/${t}?token=${encodeURIComponent(e)}`,n)}async uploadMedia(e,t){return this.httpClient.upload("/api/v1/whatsapp/upload-media",e.file,t,"file",{token:e.token,filename:e.filename})}async sendOrderDetails(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-details",{token:e.token,sender:e.sender,orderId:e.orderId,orderItems:e.orderItems,orderTotal:e.orderTotal,currency:e.currency,paymentMethods:e.paymentMethods},t)}async sendOrderStatus(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-status",{token:e.token,sender:e.sender,orderId:e.orderId,status:e.status,messageText:e.messageText},t)}async sendAudio(e,t){return this.httpClient.post("/api/v1/whatsapp/send-audio",{token:e.token,sender:e.sender,audioUrl:e.audioUrl},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/whatsapp/send-sticker",{token:e.token,sender:e.sender,stickerUrl:e.stickerUrl},t)}async sendVideo(e,t){return this.httpClient.post("/api/v1/whatsapp/send-video",{token:e.token,sender:e.sender,videoUrl:e.videoUrl,caption:e.caption},t)}async sendDocument(e,t){return this.httpClient.post("/api/v1/whatsapp/send-document",{token:e.token,sender:e.sender,documentUrl:e.documentUrl,filename:e.filename,caption:e.caption},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/whatsapp/send-contact",{token:e.token,sender:e.sender,contacts:e.contacts},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location",{token:e.token,sender:e.sender,latitude:e.latitude,longitude:e.longitude,name:e.name,address:e.address},t)}async sendLocationRequest(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location-request",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendCtaUrl(e,t){return this.httpClient.post("/api/v1/whatsapp/send-cta-url",{token:e.token,sender:e.sender,messageText:e.messageText,buttonText:e.buttonText,url:e.url},t)}async sendMediaCarousel(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media-carousel",{token:e.token,sender:e.sender,cards:e.cards},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/download-media",{token:e.token,url:e.url},t)}};var h=class{constructor(e){this.httpClient=e;}async sendMessage(e,t){return this.httpClient.post("/api/v1/telegram/send-message",{token:e.token,chatId:e.chatId,text:e.text,parseMode:e.parseMode,replyToMessageId:e.replyToMessageId,disableNotification:e.disableNotification},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/telegram/send-media",{token:e.token,chatId:e.chatId,fileUrl:e.fileUrl,type:e.type,caption:e.caption,parseMode:e.parseMode,replyToMessageId:e.replyToMessageId},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/telegram/send-buttons",{token:e.token,chatId:e.chatId,text:e.text,buttons:e.buttons,parseMode:e.parseMode},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/telegram/send-location",{token:e.token,chatId:e.chatId,latitude:e.latitude,longitude:e.longitude,livePeriod:e.livePeriod},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/telegram/send-contact",{token:e.token,chatId:e.chatId,phoneNumber:e.phoneNumber,firstName:e.firstName,lastName:e.lastName,vcard:e.vcard},t)}async sendPoll(e,t){return this.httpClient.post("/api/v1/telegram/send-poll",{token:e.token,chatId:e.chatId,question:e.question,options:e.options,isAnonymous:e.isAnonymous,type:e.type,correctOptionId:e.correctOptionId},t)}async sendVenue(e,t){return this.httpClient.post("/api/v1/telegram/send-venue",{token:e.token,chatId:e.chatId,latitude:e.latitude,longitude:e.longitude,title:e.title,address:e.address,foursquareId:e.foursquareId},t)}async sendDice(e,t){return this.httpClient.post("/api/v1/telegram/send-dice",{token:e.token,chatId:e.chatId,emoji:e.emoji},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/telegram/send-sticker",{token:e.token,chatId:e.chatId,stickerUrl:e.stickerUrl},t)}async sendVoice(e,t){return this.httpClient.post("/api/v1/telegram/send-voice",{token:e.token,chatId:e.chatId,voiceUrl:e.voiceUrl,caption:e.caption,duration:e.duration},t)}async sendVideoNote(e,t){return this.httpClient.post("/api/v1/telegram/send-video-note",{token:e.token,chatId:e.chatId,videoNoteUrl:e.videoNoteUrl,duration:e.duration,length:e.length},t)}async sendMediaGroup(e,t){return this.httpClient.post("/api/v1/telegram/send-media-group",{token:e.token,chatId:e.chatId,media:e.media},t)}async sendReplyKeyboard(e,t){return this.httpClient.post("/api/v1/telegram/send-reply-keyboard",{token:e.token,chatId:e.chatId,text:e.text,keyboard:e.keyboard,resizeKeyboard:e.resizeKeyboard,oneTimeKeyboard:e.oneTimeKeyboard},t)}async editMessage(e,t){return this.httpClient.post("/api/v1/telegram/edit-message",{token:e.token,chatId:e.chatId,messageId:e.messageId,text:e.text,parseMode:e.parseMode},t)}async deleteMessage(e,t){return this.httpClient.post("/api/v1/telegram/delete-message",{token:e.token,chatId:e.chatId,messageId:e.messageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/telegram/download-media",{token:e.token,fileId:e.fileId},t)}};var g=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/webchat/send-text",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/webchat/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendCarousel(e,t){return this.httpClient.post("/api/v1/webchat/send-carousel",{token:e.token,sender:e.sender,cards:e.cards},t)}async sendForm(e,t){return this.httpClient.post("/api/v1/webchat/send-form",{token:e.token,sender:e.sender,title:e.title,fields:e.fields,submitButtonText:e.submitButtonText},t)}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/webchat/send-quick-replies",{token:e.token,sender:e.sender,messageText:e.messageText,quickReplies:e.quickReplies},t)}async sendCard(e,t){return this.httpClient.post("/api/v1/webchat/send-card",{token:e.token,sender:e.sender,title:e.title,description:e.description,imageUrl:e.imageUrl,buttons:e.buttons},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/webchat/send-buttons",{token:e.token,sender:e.sender,messageText:e.messageText,buttons:e.buttons},t)}};var m=class{constructor(e){this.httpClient=e;}async listPosts(e,t){return this.httpClient.post("/api/v1/facebook/list-posts",{token:e.token,pageId:e.pageId,limit:e.limit},t)}async listComments(e,t){return this.httpClient.post("/api/v1/facebook/list-comments",{token:e.token,postId:e.postId,limit:e.limit},t)}async createPost(e,t){return this.httpClient.post("/api/v1/facebook/create-post",{token:e.token,pageId:e.pageId,message:e.message,link:e.link},t)}async replyComment(e,t){return this.httpClient.post("/api/v1/facebook/reply-comment",{token:e.token,commentId:e.commentId,message:e.message},t)}async deleteComment(e,t){return this.httpClient.post("/api/v1/facebook/delete-comment",{token:e.token,commentId:e.commentId},t)}async sendText(e,t){return this.httpClient.post("/api/v1/facebook/send-text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/facebook/send-media",{token:e.token,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/facebook/send-buttons",{token:e.token,recipientId:e.recipientId,message:e.message,buttons:e.buttons},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/facebook/send-sticker",{token:e.token,recipientId:e.recipientId,stickerId:e.stickerId},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/facebook/reply-message",{token:e.token,messageId:e.messageId,message:e.message},t)}async replyMedia(e,t){return this.httpClient.post("/api/v1/facebook/reply-media",{token:e.token,messageId:e.messageId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sharePost(e,t){return this.httpClient.post("/api/v1/facebook/share-post",{token:e.token,mediaId:e.mediaId,recipientId:e.recipientId},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/facebook/user-profile",{token:e.token,userId:e.userId},t)}async getPageProfile(e,t){return this.httpClient.post("/api/v1/facebook/page-profile",{token:e.token,pageId:e.pageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/facebook/download-media",{token:e.token,url:e.url},t)}};var u=class{constructor(e){this.httpClient=e;}async sendPrivateReply(e,t){return this.httpClient.post("/api/v1/instagram/private-reply",{token:e.token,commentId:e.commentId,message:e.message},t)}async sendText(e,t){return this.httpClient.post("/api/v1/instagram/messages/text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/instagram/messages/media",{token:e.token,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendImages(e,t){return this.httpClient.post("/api/v1/instagram/messages/images",{token:e.token,recipientId:e.recipientId,images:e.images},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/instagram/messages/sticker",{token:e.token,recipientId:e.recipientId,stickerType:e.stickerType},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/instagram/messages/reaction",{token:e.token,messageId:e.messageId,reactionType:e.reactionType},t)}async removeReaction(e,t){return this.httpClient.delete("/api/v1/instagram/messages/reaction",t,{token:e.token,recipientId:e.recipientId,messageId:e.messageId})}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/instagram/messages/quick-replies",{token:e.token,recipientId:e.recipientId,message:e.message,quickReplies:e.quickReplies},t)}async sendGenericTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/generic-template",{token:e.token,recipientId:e.recipientId,elements:e.elements},t)}async sendButtonTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/button-template",{token:e.token,recipientId:e.recipientId,text:e.text,buttons:e.buttons},t)}async sendSenderAction(e,t){return this.httpClient.post("/api/v1/instagram/messages/sender-action",{token:e.token,recipientId:e.recipientId,action:e.action},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/instagram/user-profile",{token:e.token,userId:e.userId},t)}async listPosts(e,t){return this.httpClient.post("/api/v1/instagram/posts",{token:e.token,userId:e.userId,limit:e.limit},t)}async getBusinessProfile(e,t){return this.httpClient.post("/api/v1/instagram/business-profile",{token:e.token},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/instagram/download-media",{token:e.token,url:e.url},t)}};var P=class{constructor(e){this.httpClient=new r(e),this.auth=new d(this.httpClient),this.channels=new p(this.httpClient),this.integrations=new l(this.httpClient),this.whatsapp=new c(this.httpClient),this.telegram=new h(this.httpClient),this.webchat=new g(this.httpClient),this.facebook=new m(this.httpClient),this.instagram=new u(this.httpClient);}},j=P;
|
|
7
|
-
exports.OficialAPISDK=
|
|
6
|
+
var f="https://api.oficialapi.com.br",a=class{constructor(e){this.config={clientId:e.clientId,clientSecret:e.clientSecret,timeout:e.timeout||3e4,maxRetries:e.maxRetries||3,retryDelay:e.retryDelay||1e3,headers:e.headers||{}},this.axiosInstance=I__default.default.create({baseURL:f,timeout:this.config.timeout,headers:{"Content-Type":"application/json",...this.config.headers}}),this.setupInterceptors();}setupInterceptors(){this.axiosInstance.interceptors.request.use(e=>{if(e.url?.includes("/auth/token"))return e;let t=e;return t.accessToken&&e.headers&&(e.headers.Authorization=`Bearer ${t.accessToken}`),e},e=>Promise.reject(e)),this.axiosInstance.interceptors.response.use(e=>e,async e=>{let t=e.config;if(!t)return Promise.reject(this.formatError(e));if((!e.response||e.response.status>=500&&e.response.status<600)&&(!t._retryCount||t._retryCount<this.config.maxRetries)){t._retryCount=(t._retryCount||0)+1;let i=this.config.retryDelay*t._retryCount;return await new Promise(s=>setTimeout(s,i)),this.axiosInstance(t)}return Promise.reject(this.formatError(e))});}formatError(e){if(e.response){let t=e.response.data,n=t?.error?.message||t?.message||e.message,i=t?.error?.details||[],s=new Error(n);return s.status=e.response.status,s.data=e.response.data,s.details=i,s}return e.request?new Error("Erro de conex\xE3o com a API. Verifique sua conex\xE3o com a internet."):e}async get(e,t,n){let i={...n,accessToken:t};return (await this.axiosInstance.get(e,i)).data}async post(e,t,n,i){let s={...i,accessToken:n};return (await this.axiosInstance.post(e,t,s)).data}async put(e,t,n,i){let s={...i,accessToken:n};return (await this.axiosInstance.put(e,t,s)).data}async delete(e,t,n,i){let s={...i,accessToken:t,data:n};return (await this.axiosInstance.delete(e,s)).data}async upload(e,t,n,i="file",s){let r=new FormData;if(t instanceof Buffer){let k=new Blob([t]);r.append(i,k);}else r.append(i,t);s&&Object.entries(s).forEach(([k,y])=>{r.append(k,typeof y=="string"?y:JSON.stringify(y));});let P={headers:{"Content-Type":"multipart/form-data"},accessToken:n};return (await this.axiosInstance.post(e,r,P)).data}};var d=class{constructor(e){this.httpClient=e;}async getToken(e,t){let n=await this.httpClient.post("/api/v1/auth/token",{client_id:e,client_secret:t});if(!n.success||!n.data)throw new Error(n.error?.message||"Falha ao obter token");return n.data}};var c=class{constructor(e){this.httpClient=e;}async list(e){let t=await this.httpClient.get("/api/v1/channels",e);if(!t.success||!t.data)throw new Error(t.error?.message||"Falha ao listar canais");return Array.isArray(t.data)?t.data:[t.data]}};var l=class{constructor(e){this.httpClient=e;}async createWebhook(e,t){let n=await this.httpClient.post("/api/v1/integrations",{url:e.url,expiresInDays:e.expiresInDays},t);if(!n.success||!n.data)throw new Error(n.error?.message||"Falha ao criar webhook");return n.data}};var p=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/whatsapp/send-message",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/send-template",{token:e.token,sender:e.sender,templateName:e.templateName,languageCode:e.languageCode,components:e.components},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/whatsapp/send-buttons",{token:e.token,sender:e.sender,text:e.text,buttons:e.buttons,...e.media&&{media:e.media}},t)}async sendList(e,t){return this.httpClient.post("/api/v1/whatsapp/send-list",{token:e.token,sender:e.sender,headerText:e.headerText,bodyText:e.bodyText,buttonText:e.buttonText,sections:e.sections,...e.footerText&&{footerText:e.footerText}},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/reply-message",{token:e.token,sender:e.sender,messageText:e.messageText,...e.replyMessageId&&{replyMessageId:e.replyMessageId},...e.preview_url!==void 0&&{preview_url:e.preview_url}},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/react-message",{token:e.token,sender:e.sender,emoji:e.emoji,...e.message_id&&{message_id:e.message_id}},t)}async createTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/create-template",{token:e.token,name:e.name,language:e.language,category:e.category,components:e.components},t)}async listTemplates(e,t){return this.httpClient.get(`/api/v1/whatsapp/templates?token=${encodeURIComponent(e)}`,t)}async getTemplate(e,t,n){return this.httpClient.get(`/api/v1/whatsapp/templates/${t}?token=${encodeURIComponent(e)}`,n)}async uploadMedia(e,t){return this.httpClient.upload("/api/v1/whatsapp/upload-media",e.file,t,"file",{token:e.token,filename:e.filename})}async sendOrderDetails(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-details",{token:e.token,sender:e.sender,...e.headerText&&{headerText:e.headerText},bodyText:e.bodyText,...e.footerText&&{footerText:e.footerText},reference_id:e.reference_id,type:e.type,currency:e.currency,total_amount:e.total_amount,order:e.order,...e.payment_settings&&{payment_settings:e.payment_settings}},t)}async sendOrderStatus(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-status",{token:e.token,sender:e.sender,bodyText:e.bodyText,...e.footerText&&{footerText:e.footerText},reference_id:e.reference_id,order_status:e.order_status,...e.status_description&&{status_description:e.status_description},...e.payment_status&&{payment_status:e.payment_status},...e.payment_timestamp!==void 0&&{payment_timestamp:e.payment_timestamp}},t)}async sendAudio(e,t){return this.httpClient.post("/api/v1/whatsapp/send-audio",{token:e.token,sender:e.sender,mediaId:e.mediaId,...e.voice!==void 0&&{voice:e.voice}},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/whatsapp/send-sticker",{token:e.token,sender:e.sender,mediaId:e.mediaId},t)}async sendVideo(e,t){return this.httpClient.post("/api/v1/whatsapp/send-video",{token:e.token,sender:e.sender,mediaId:e.mediaId,...e.caption&&{caption:e.caption}},t)}async sendDocument(e,t){return this.httpClient.post("/api/v1/whatsapp/send-document",{token:e.token,sender:e.sender,mediaId:e.mediaId,...e.filename&&{filename:e.filename},...e.caption&&{caption:e.caption}},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/whatsapp/send-contact",{token:e.token,sender:e.sender,contacts:e.contacts},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location",{token:e.token,sender:e.sender,latitude:e.latitude,longitude:e.longitude,name:e.name,address:e.address},t)}async sendLocationRequest(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location-request",{token:e.token,sender:e.sender,bodyText:e.bodyText,...e.headerText&&{headerText:e.headerText},...e.footerText&&{footerText:e.footerText}},t)}async sendCtaUrl(e,t){return this.httpClient.post("/api/v1/whatsapp/send-cta-url",{token:e.token,sender:e.sender,bodyText:e.bodyText,buttonText:e.buttonText,url:e.url,...e.header&&{header:e.header},...e.footerText&&{footerText:e.footerText}},t)}async sendMediaCarousel(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media-carousel",{token:e.token,sender:e.sender,bodyText:e.bodyText,cards:e.cards},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/download-media",{token:e.token,url:e.url},t)}};var h=class{constructor(e){this.httpClient=e;}async sendMessage(e,t){return this.httpClient.post("/api/v1/telegram/send-message",{token:e.token,chatId:e.chatId,text:e.text,parseMode:e.parseMode,replyToMessageId:e.replyToMessageId,disableNotification:e.disableNotification},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/telegram/send-media",{token:e.token,chatId:e.chatId,fileUrl:e.fileUrl,type:e.type,caption:e.caption,parseMode:e.parseMode,replyToMessageId:e.replyToMessageId},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/telegram/send-buttons",{token:e.token,chatId:e.chatId,text:e.text,buttons:e.buttons,parseMode:e.parseMode},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/telegram/send-location",{token:e.token,chatId:e.chatId,latitude:e.latitude,longitude:e.longitude,livePeriod:e.livePeriod},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/telegram/send-contact",{token:e.token,chatId:e.chatId,phoneNumber:e.phoneNumber,firstName:e.firstName,lastName:e.lastName,vcard:e.vcard},t)}async sendPoll(e,t){return this.httpClient.post("/api/v1/telegram/send-poll",{token:e.token,chatId:e.chatId,question:e.question,options:e.options,isAnonymous:e.isAnonymous,type:e.type,correctOptionId:e.correctOptionId},t)}async sendVenue(e,t){return this.httpClient.post("/api/v1/telegram/send-venue",{token:e.token,chatId:e.chatId,latitude:e.latitude,longitude:e.longitude,title:e.title,address:e.address,foursquareId:e.foursquareId},t)}async sendDice(e,t){return this.httpClient.post("/api/v1/telegram/send-dice",{token:e.token,chatId:e.chatId,emoji:e.emoji},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/telegram/send-sticker",{token:e.token,chatId:e.chatId,stickerUrl:e.stickerUrl},t)}async sendVoice(e,t){return this.httpClient.post("/api/v1/telegram/send-voice",{token:e.token,chatId:e.chatId,voiceUrl:e.voiceUrl,caption:e.caption,duration:e.duration},t)}async sendVideoNote(e,t){return this.httpClient.post("/api/v1/telegram/send-video-note",{token:e.token,chatId:e.chatId,videoNoteUrl:e.videoNoteUrl,duration:e.duration,length:e.length},t)}async sendMediaGroup(e,t){return this.httpClient.post("/api/v1/telegram/send-media-group",{token:e.token,chatId:e.chatId,media:e.media},t)}async sendReplyKeyboard(e,t){return this.httpClient.post("/api/v1/telegram/send-reply-keyboard",{token:e.token,chatId:e.chatId,text:e.text,keyboard:e.keyboard,resizeKeyboard:e.resizeKeyboard,oneTimeKeyboard:e.oneTimeKeyboard},t)}async editMessage(e,t){return this.httpClient.post("/api/v1/telegram/edit-message",{token:e.token,chatId:e.chatId,messageId:e.messageId,text:e.text,parseMode:e.parseMode},t)}async deleteMessage(e,t){return this.httpClient.post("/api/v1/telegram/delete-message",{token:e.token,chatId:e.chatId,messageId:e.messageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/telegram/download-media",{token:e.token,fileId:e.fileId},t)}};var g=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/webchat/send-text",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/webchat/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendCarousel(e,t){return this.httpClient.post("/api/v1/webchat/send-carousel",{token:e.token,sender:e.sender,cards:e.cards},t)}async sendForm(e,t){return this.httpClient.post("/api/v1/webchat/send-form",{token:e.token,sender:e.sender,title:e.title,fields:e.fields,submitButtonText:e.submitButtonText},t)}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/webchat/send-quick-replies",{token:e.token,sender:e.sender,messageText:e.messageText,quickReplies:e.quickReplies},t)}async sendCard(e,t){return this.httpClient.post("/api/v1/webchat/send-card",{token:e.token,sender:e.sender,title:e.title,description:e.description,imageUrl:e.imageUrl,buttons:e.buttons},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/webchat/send-buttons",{token:e.token,sender:e.sender,messageText:e.messageText,buttons:e.buttons},t)}};var u=class{constructor(e){this.httpClient=e;}async listPosts(e,t){return this.httpClient.post("/api/v1/facebook/list-posts",{token:e.token,pageId:e.pageId,limit:e.limit},t)}async listComments(e,t){return this.httpClient.post("/api/v1/facebook/list-comments",{token:e.token,postId:e.postId,limit:e.limit},t)}async createPost(e,t){return this.httpClient.post("/api/v1/facebook/create-post",{token:e.token,pageId:e.pageId,message:e.message,link:e.link},t)}async replyComment(e,t){return this.httpClient.post("/api/v1/facebook/reply-comment",{token:e.token,commentId:e.commentId,message:e.message},t)}async deleteComment(e,t){return this.httpClient.post("/api/v1/facebook/delete-comment",{token:e.token,commentId:e.commentId},t)}async sendText(e,t){return this.httpClient.post("/api/v1/facebook/send-text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/facebook/send-media",{token:e.token,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/facebook/send-buttons",{token:e.token,recipientId:e.recipientId,message:e.message,buttons:e.buttons},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/facebook/send-sticker",{token:e.token,recipientId:e.recipientId,stickerId:e.stickerId},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/facebook/reply-message",{token:e.token,messageId:e.messageId,message:e.message},t)}async replyMedia(e,t){return this.httpClient.post("/api/v1/facebook/reply-media",{token:e.token,messageId:e.messageId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sharePost(e,t){return this.httpClient.post("/api/v1/facebook/share-post",{token:e.token,mediaId:e.mediaId,recipientId:e.recipientId},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/facebook/user-profile",{token:e.token,userId:e.userId},t)}async getPageProfile(e,t){return this.httpClient.post("/api/v1/facebook/page-profile",{token:e.token,pageId:e.pageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/facebook/download-media",{token:e.token,url:e.url},t)}};var m=class{constructor(e){this.httpClient=e;}async sendPrivateReply(e,t){return this.httpClient.post("/api/v1/instagram/private-reply",{token:e.token,commentId:e.commentId,message:e.message},t)}async sendText(e,t){return this.httpClient.post("/api/v1/instagram/messages/text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/instagram/messages/media",{token:e.token,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendImages(e,t){return this.httpClient.post("/api/v1/instagram/messages/images",{token:e.token,recipientId:e.recipientId,images:e.images},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/instagram/messages/sticker",{token:e.token,recipientId:e.recipientId,stickerType:e.stickerType},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/instagram/messages/reaction",{token:e.token,messageId:e.messageId,reactionType:e.reactionType},t)}async removeReaction(e,t){return this.httpClient.delete("/api/v1/instagram/messages/reaction",t,{token:e.token,recipientId:e.recipientId,messageId:e.messageId})}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/instagram/messages/quick-replies",{token:e.token,recipientId:e.recipientId,message:e.message,quickReplies:e.quickReplies},t)}async sendGenericTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/generic-template",{token:e.token,recipientId:e.recipientId,elements:e.elements},t)}async sendButtonTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/button-template",{token:e.token,recipientId:e.recipientId,text:e.text,buttons:e.buttons},t)}async sendSenderAction(e,t){return this.httpClient.post("/api/v1/instagram/messages/sender-action",{token:e.token,recipientId:e.recipientId,action:e.action},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/instagram/user-profile",{token:e.token,userId:e.userId},t)}async listPosts(e,t){return this.httpClient.post("/api/v1/instagram/posts",{token:e.token,userId:e.userId,limit:e.limit},t)}async getBusinessProfile(e,t){return this.httpClient.post("/api/v1/instagram/business-profile",{token:e.token},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/instagram/download-media",{token:e.token,url:e.url},t)}};var C=class{constructor(e){this.httpClient=new a(e),this.auth=new d(this.httpClient),this.channels=new c(this.httpClient),this.integrations=new l(this.httpClient),this.whatsapp=new p(this.httpClient),this.telegram=new h(this.httpClient),this.webchat=new g(this.httpClient),this.facebook=new u(this.httpClient),this.instagram=new m(this.httpClient);}},j=C;
|
|
7
|
+
exports.OficialAPISDK=C;exports.default=j;//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|