@oficialapi/sdk 5.0.0 → 7.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/README.md CHANGED
@@ -39,6 +39,14 @@ const accessToken = tokenResponse.access_token;
39
39
 
40
40
  ### WhatsApp
41
41
 
42
+ > **⚠️ Nota Importante:** Alguns métodos requerem upload prévio da mídia para obter o `mediaId` antes de enviar. Isso se aplica a:
43
+ > - `sendAudio` - Use `uploadMedia` primeiro para obter o `mediaId`
44
+ > - `sendVideo` - Use `uploadMedia` primeiro para obter o `mediaId`
45
+ > - `sendDocument` - Use `uploadMedia` primeiro para obter o `mediaId`
46
+ > - `sendSticker` - Use `uploadMedia` primeiro para obter o `mediaId`
47
+ >
48
+ > O método `sendMedia` ainda aceita `fileUrl` diretamente para imagens e outros tipos de mídia.
49
+
42
50
  #### Enviar Mensagem de Texto
43
51
 
44
52
  ```typescript
@@ -54,6 +62,7 @@ console.log(result.data.messageId);
54
62
  #### Enviar Mídia
55
63
 
56
64
  ```typescript
65
+ // Enviar imagem
57
66
  await sdk.whatsapp.sendMedia({
58
67
  token: 'sk_live_...',
59
68
  sender: '5511999999999',
@@ -61,19 +70,35 @@ await sdk.whatsapp.sendMedia({
61
70
  type: 'image',
62
71
  caption: 'Veja esta imagem!'
63
72
  }, accessToken);
73
+
74
+ // Enviar documento com nome de arquivo
75
+ await sdk.whatsapp.sendMedia({
76
+ token: 'sk_live_...',
77
+ sender: '5511999999999',
78
+ fileUrl: 'https://example.com/documento.pdf',
79
+ type: 'document',
80
+ caption: 'Confira este documento',
81
+ fileName: 'meu_documento.pdf' // Opcional: se não fornecido, será extraído da URL
82
+ }, accessToken);
64
83
  ```
65
84
 
85
+ **Nota:** O parâmetro `fileName` é opcional e usado apenas para documentos. Se não fornecido e o tipo for `document`, o nome do arquivo será extraído automaticamente da URL.
86
+
66
87
  #### Enviar Template
67
88
 
89
+ Os templates do WhatsApp suportam diferentes tipos de componentes e parâmetros. Veja os exemplos abaixo:
90
+
91
+ **Template simples com apenas BODY:**
92
+
68
93
  ```typescript
69
94
  await sdk.whatsapp.sendTemplate({
70
95
  token: 'sk_live_...',
71
96
  sender: '5511999999999',
72
- templateName: 'welcome_message',
97
+ templateName: 'hello_world',
73
98
  languageCode: 'pt_BR',
74
99
  components: [
75
100
  {
76
- type: 'body',
101
+ type: 'BODY',
77
102
  parameters: [
78
103
  { type: 'text', text: 'João' }
79
104
  ]
@@ -82,29 +107,122 @@ await sdk.whatsapp.sendTemplate({
82
107
  }, accessToken);
83
108
  ```
84
109
 
110
+ **Template com HEADER com documento PDF:**
111
+
112
+ ```typescript
113
+ await sdk.whatsapp.sendTemplate({
114
+ token: 'sk_live_...',
115
+ sender: '555199579150',
116
+ templateName: 'order_confirmation_pdf',
117
+ languageCode: 'en_US',
118
+ components: [
119
+ {
120
+ type: 'HEADER',
121
+ parameters: [
122
+ {
123
+ type: 'document',
124
+ document: {
125
+ link: 'https://seusite.com/recibos/860198-230332.pdf',
126
+ filename: 'order_860198-230332.pdf'
127
+ }
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ type: 'BODY',
133
+ parameters: [
134
+ { type: 'text', text: 'Pablo' },
135
+ { type: 'text', text: '860198-230332' }
136
+ ]
137
+ }
138
+ ]
139
+ }, accessToken);
140
+ ```
141
+
142
+ **Template com HEADER com imagem:**
143
+
144
+ ```typescript
145
+ await sdk.whatsapp.sendTemplate({
146
+ token: 'sk_live_...',
147
+ sender: '5511999999999',
148
+ templateName: 'promotion_notification',
149
+ languageCode: 'pt_BR',
150
+ components: [
151
+ {
152
+ type: 'HEADER',
153
+ parameters: [
154
+ {
155
+ type: 'image',
156
+ image: {
157
+ link: 'https://seusite.com/imagens/promocao.jpg'
158
+ }
159
+ }
160
+ ]
161
+ },
162
+ {
163
+ type: 'BODY',
164
+ parameters: [
165
+ { type: 'text', text: 'Maria' },
166
+ { type: 'text', text: 'R$ 150,00' }
167
+ ]
168
+ }
169
+ ]
170
+ }, accessToken);
171
+ ```
172
+
173
+ **Template com HEADER com texto dinâmico:**
174
+
175
+ ```typescript
176
+ await sdk.whatsapp.sendTemplate({
177
+ token: 'sk_live_...',
178
+ sender: '5511999999999',
179
+ templateName: 'seasonal_promotion',
180
+ languageCode: 'pt_BR',
181
+ components: [
182
+ {
183
+ type: 'HEADER',
184
+ parameters: [
185
+ {
186
+ type: 'text',
187
+ text: 'Promoção de Verão'
188
+ }
189
+ ]
190
+ },
191
+ {
192
+ type: 'BODY',
193
+ parameters: [
194
+ { type: 'text', text: 'Ana' },
195
+ { type: 'text', text: '25%' }
196
+ ]
197
+ }
198
+ ]
199
+ }, accessToken);
200
+ ```
201
+
202
+ **Nota:** Os tipos de componentes devem ser em maiúsculas (`HEADER`, `BODY`, `BUTTONS`). Para documentos no HEADER, o campo `filename` é opcional mas recomendado para melhor experiência do usuário.
203
+
85
204
  #### Enviar Botões
86
205
 
87
206
  ```typescript
88
207
  await sdk.whatsapp.sendButtons({
89
208
  token: 'sk_live_...',
90
209
  sender: '5511999999999',
91
- messageText: 'Escolha uma opção:',
210
+ text: 'Escolha uma opção:',
92
211
  buttons: [
93
212
  {
94
- type: 'reply',
95
- reply: {
96
- id: 'option1',
97
- title: 'Opção 1'
98
- }
213
+ id: 'option1',
214
+ title: 'Opção 1'
99
215
  },
100
216
  {
101
- type: 'reply',
102
- reply: {
103
- id: 'option2',
104
- title: 'Opção 2'
105
- }
217
+ id: 'option2',
218
+ title: 'Opção 2'
106
219
  }
107
- ]
220
+ ],
221
+ // Opcional: incluir mídia (imagem) no topo da mensagem
222
+ media: {
223
+ type: 'image',
224
+ url: 'https://example.com/image.jpg'
225
+ }
108
226
  }, accessToken);
109
227
  ```
110
228
 
@@ -114,7 +232,9 @@ await sdk.whatsapp.sendButtons({
114
232
  await sdk.whatsapp.sendList({
115
233
  token: 'sk_live_...',
116
234
  sender: '5511999999999',
117
- messageText: 'Escolha um produto:',
235
+ headerText: 'Escolha um produto:',
236
+ bodyText: 'Selecione uma opção abaixo:',
237
+ footerText: 'Equipe de Vendas', // Opcional
118
238
  buttonText: 'Ver Produtos',
119
239
  sections: [
120
240
  {
@@ -177,33 +297,45 @@ await sdk.whatsapp.sendLocation({
177
297
  #### Enviar Áudio
178
298
 
179
299
  ```typescript
300
+ // Áudio básico (requer upload prévio da mídia)
180
301
  await sdk.whatsapp.sendAudio({
181
302
  token: 'sk_live_...',
182
303
  sender: '5511999999999',
183
- audioUrl: 'https://example.com/audio.ogg'
304
+ mediaId: '1013859600285441', // ID da mídia após upload
305
+ voice: false // Opcional: false para áudio básico
306
+ }, accessToken);
307
+
308
+ // Mensagem de voz (arquivo .ogg codec OPUS)
309
+ await sdk.whatsapp.sendAudio({
310
+ token: 'sk_live_...',
311
+ sender: '5511999999999',
312
+ mediaId: '1013859600285441',
313
+ voice: true // true para mensagem de voz
184
314
  }, accessToken);
185
315
  ```
186
316
 
187
317
  #### Enviar Vídeo
188
318
 
189
319
  ```typescript
320
+ // Requer upload prévio da mídia para obter o mediaId
190
321
  await sdk.whatsapp.sendVideo({
191
322
  token: 'sk_live_...',
192
323
  sender: '5511999999999',
193
- videoUrl: 'https://example.com/video.mp4',
194
- caption: 'Veja este vídeo!'
324
+ mediaId: '1166846181421424', // ID da mídia após upload
325
+ caption: 'Veja este vídeo!' // Opcional
195
326
  }, accessToken);
196
327
  ```
197
328
 
198
329
  #### Enviar Documento
199
330
 
200
331
  ```typescript
332
+ // Requer upload prévio da mídia para obter o mediaId
201
333
  await sdk.whatsapp.sendDocument({
202
334
  token: 'sk_live_...',
203
335
  sender: '5511999999999',
204
- documentUrl: 'https://example.com/document.pdf',
205
- filename: 'documento.pdf',
206
- caption: 'Aqui está o documento'
336
+ mediaId: '1376223850470843', // ID da mídia após upload
337
+ filename: 'documento.pdf', // Opcional
338
+ caption: 'Aqui está o documento' // Opcional
207
339
  }, accessToken);
208
340
  ```
209
341
 
@@ -213,25 +345,66 @@ await sdk.whatsapp.sendDocument({
213
345
  await sdk.whatsapp.sendOrderDetails({
214
346
  token: 'sk_live_...',
215
347
  sender: '5511999999999',
216
- orderId: 'ORDER123',
217
- orderItems: [
218
- {
219
- item_code: 'ITEM001',
220
- description: 'Produto 1',
221
- quantity: 2,
222
- price: 50.00
223
- }
224
- ],
225
- orderTotal: 100.00,
348
+ headerText: 'Confirmação de Pedido', // Opcional
349
+ bodyText: 'Seu pedido #12345 está pronto para pagamento!',
350
+ footerText: 'Obrigado por comprar conosco!', // Opcional
351
+ reference_id: 'pedido_12345_1704067200', // ID único do pedido
352
+ type: 'digital-goods', // ou 'physical-goods'
226
353
  currency: 'BRL',
227
- paymentMethods: [
354
+ total_amount: {
355
+ value: 50000, // Valor em centavos (500.00)
356
+ offset: 100, // Fator de ajuste (sempre 100 para BRL)
357
+ description: 'Total do pedido' // Opcional
358
+ },
359
+ order: {
360
+ status: 'pending',
361
+ items: [
362
+ {
363
+ retailer_id: '1234567',
364
+ name: 'Produto 1',
365
+ amount: {
366
+ value: 50000,
367
+ offset: 100
368
+ },
369
+ quantity: 2
370
+ }
371
+ ],
372
+ subtotal: {
373
+ value: 50000,
374
+ offset: 100
375
+ },
376
+ tax: {
377
+ value: 0,
378
+ offset: 100,
379
+ description: 'Sem impostos'
380
+ },
381
+ shipping: { // Opcional
382
+ value: 1000,
383
+ offset: 100,
384
+ description: 'Frete'
385
+ },
386
+ discount: { // Opcional
387
+ value: 5000,
388
+ offset: 100,
389
+ description: 'Desconto',
390
+ discount_program_name: 'Promoção'
391
+ }
392
+ },
393
+ payment_settings: [ // Opcional, máximo 2 métodos
228
394
  {
229
- type: 'PIX',
230
- name: 'PIX'
395
+ type: 'pix_dynamic_code',
396
+ pix_dynamic_code: {
397
+ code: '00020101021226700014br.gov.bcb.pix2548pix.example.com...',
398
+ merchant_name: 'Minha Empresa Ltda',
399
+ key: '39580525000189',
400
+ key_type: 'CNPJ' // CPF, CNPJ, EMAIL, PHONE ou EVP
401
+ }
231
402
  },
232
403
  {
233
- type: 'CREDIT_CARD',
234
- name: 'Cartão de Crédito'
404
+ type: 'payment_link',
405
+ payment_link: {
406
+ uri: 'https://pagamento.exemplo.com/pedido/123'
407
+ }
235
408
  }
236
409
  ]
237
410
  }, accessToken);
@@ -243,19 +416,24 @@ await sdk.whatsapp.sendOrderDetails({
243
416
  await sdk.whatsapp.sendOrderStatus({
244
417
  token: 'sk_live_...',
245
418
  sender: '5511999999999',
246
- orderId: 'ORDER123',
247
- status: 'SHIPPED',
248
- messageText: 'Seu pedido foi enviado!'
419
+ bodyText: 'Seu pedido foi enviado!',
420
+ footerText: 'Obrigado!', // Opcional
421
+ reference_id: 'pedido_12345_1704067200', // Mesmo ID usado em sendOrderDetails
422
+ order_status: 'shipped', // pending, processing, partially-shipped, shipped, completed, canceled
423
+ status_description: 'Sua encomenda foi despachada pelos Correios', // Opcional
424
+ payment_status: 'captured', // Opcional: pending, captured, failed
425
+ payment_timestamp: 1722445231 // Opcional: timestamp do pagamento em segundos
249
426
  }, accessToken);
250
427
  ```
251
428
 
252
429
  #### Enviar Sticker
253
430
 
254
431
  ```typescript
432
+ // Requer upload prévio da mídia para obter o mediaId
255
433
  await sdk.whatsapp.sendSticker({
256
434
  token: 'sk_live_...',
257
435
  sender: '5511999999999',
258
- stickerUrl: 'https://example.com/sticker.webp'
436
+ mediaId: '798882015472548' // ID da mídia após upload (.webp até 500KB para animado, 100KB para estático)
259
437
  }, accessToken);
260
438
  ```
261
439
 
@@ -265,7 +443,9 @@ await sdk.whatsapp.sendSticker({
265
443
  await sdk.whatsapp.sendLocationRequest({
266
444
  token: 'sk_live_...',
267
445
  sender: '5511999999999',
268
- messageText: 'Por favor, compartilhe sua localização'
446
+ bodyText: 'Por favor, compartilhe sua localização para entregarmos seu pedido.',
447
+ headerText: 'Confirme sua entrega', // Opcional (máximo 60 caracteres)
448
+ footerText: 'Sua privacidade é importante' // Opcional (máximo 60 caracteres)
269
449
  }, accessToken);
270
450
  ```
271
451
 
@@ -275,9 +455,15 @@ await sdk.whatsapp.sendLocationRequest({
275
455
  await sdk.whatsapp.sendCtaUrl({
276
456
  token: 'sk_live_...',
277
457
  sender: '5511999999999',
278
- messageText: 'Confira nosso site!',
279
- buttonText: 'Acessar',
280
- url: 'https://example.com'
458
+ bodyText: 'Confira nosso site!',
459
+ buttonText: 'Acessar', // Máximo 20 caracteres
460
+ url: 'https://example.com',
461
+ header: { // Opcional: cabeçalho com mídia
462
+ type: 'image', // ou 'video', 'document', 'text'
463
+ link: 'https://example.com/banner.jpg' // Para image/video/document
464
+ // ou text: 'Título' para tipo text
465
+ },
466
+ footerText: 'Ofertas válidas até 30/11' // Opcional (máximo 60 caracteres)
281
467
  }, accessToken);
282
468
  ```
283
469
 
@@ -287,20 +473,23 @@ await sdk.whatsapp.sendCtaUrl({
287
473
  await sdk.whatsapp.sendMediaCarousel({
288
474
  token: 'sk_live_...',
289
475
  sender: '5511999999999',
290
- cards: [
476
+ bodyText: 'Confira nossas ofertas da semana!', // Obrigatório
477
+ cards: [ // 2 a 10 cartões
291
478
  {
292
- card_index: 0,
293
- media: { link: 'https://example.com/image1.jpg' },
294
- title: 'Produto 1',
295
- description: 'Descrição do produto 1',
296
- actions: [{ type: 'link', value: 'https://example.com/product1' }]
479
+ cardIndex: 0,
480
+ headerType: 'image', // ou 'video'
481
+ headerLink: 'https://example.com/image1.jpg',
482
+ bodyText: 'Oferta especial!', // Máximo 160 caracteres
483
+ buttonText: 'Comprar agora', // Máximo 20 caracteres
484
+ url: 'https://example.com/product1'
297
485
  },
298
486
  {
299
- card_index: 1,
300
- media: { link: 'https://example.com/image2.jpg' },
301
- title: 'Produto 2',
302
- description: 'Descrição do produto 2',
303
- actions: [{ type: 'link', value: 'https://example.com/product2' }]
487
+ cardIndex: 1,
488
+ headerType: 'image',
489
+ headerLink: 'https://example.com/image2.jpg',
490
+ bodyText: 'Novo lançamento!',
491
+ buttonText: 'Ver detalhes',
492
+ url: 'https://example.com/product2'
304
493
  }
305
494
  ]
306
495
  }, accessToken);
@@ -326,8 +515,10 @@ console.log(media.data.size); // Tamanho em bytes
326
515
  ```typescript
327
516
  await sdk.whatsapp.replyMessage({
328
517
  token: 'sk_live_...',
329
- messageId: 'wamid.xxx',
330
- messageText: 'Esta é uma resposta!'
518
+ sender: '5511999999999', // Obrigatório
519
+ messageText: 'Esta é uma resposta!',
520
+ replyMessageId: 'wamid.xxx', // Opcional: ID da mensagem a responder
521
+ preview_url: false // Opcional: se true, mostra preview de URLs no texto
331
522
  }, accessToken);
332
523
  ```
333
524
 
@@ -336,8 +527,9 @@ await sdk.whatsapp.replyMessage({
336
527
  ```typescript
337
528
  await sdk.whatsapp.reactMessage({
338
529
  token: 'sk_live_...',
339
- messageId: 'wamid.xxx',
340
- emoji: '👍'
530
+ sender: '5511999999999', // Obrigatório
531
+ emoji: '👍', // Emoji da reação
532
+ message_id: 'wamid.xxx' // Opcional: ID da mensagem específica a reagir
341
533
  }, accessToken);
342
534
  ```
343
535
 
@@ -364,13 +556,16 @@ await sdk.whatsapp.createTemplate({
364
556
  ]
365
557
  }, accessToken);
366
558
 
367
- // Upload de mídia para template
559
+ // Upload de mídia para template ou uso em mensagens
368
560
  const file = new File(['...'], 'image.jpg', { type: 'image/jpeg' });
369
- await sdk.whatsapp.uploadMedia({
561
+ const uploadResult = await sdk.whatsapp.uploadMedia({
370
562
  token: 'sk_live_...',
371
563
  file: file,
372
564
  filename: 'image.jpg'
373
565
  }, accessToken);
566
+
567
+ // Use o mediaId retornado em sendAudio, sendVideo, sendDocument ou sendSticker
568
+ const mediaId = uploadResult.data.handle; // Formato: "4::aW1hZ2UtMTIzNDU2Nzg5MGCE..."
374
569
  ```
375
570
 
376
571
  ### Telegram
package/dist/index.d.mts CHANGED
@@ -58,6 +58,7 @@ interface SendWhatsAppMediaParams {
58
58
  fileUrl: string;
59
59
  type: 'image' | 'video' | 'audio' | 'document';
60
60
  caption?: string;
61
+ fileName?: string;
61
62
  }
62
63
  interface SendWhatsAppTemplateParams {
63
64
  token: string;
@@ -65,19 +66,26 @@ interface SendWhatsAppTemplateParams {
65
66
  templateName: string;
66
67
  languageCode: string;
67
68
  components?: Array<{
68
- type: 'header' | 'body' | 'button';
69
+ type: 'HEADER' | 'BODY' | 'BUTTONS';
69
70
  parameters?: Array<{
70
- type: 'text' | 'image' | 'document' | 'video';
71
- text?: string;
72
- image?: {
71
+ type: 'text';
72
+ text: string;
73
+ } | {
74
+ type: 'image';
75
+ image: {
73
76
  link?: string;
74
77
  id?: string;
75
78
  };
76
- document?: {
79
+ } | {
80
+ type: 'document';
81
+ document: {
77
82
  link?: string;
78
83
  id?: string;
84
+ filename?: string;
79
85
  };
80
- video?: {
86
+ } | {
87
+ type: 'video';
88
+ video: {
81
89
  link?: string;
82
90
  id?: string;
83
91
  };
package/dist/index.d.ts CHANGED
@@ -58,6 +58,7 @@ interface SendWhatsAppMediaParams {
58
58
  fileUrl: string;
59
59
  type: 'image' | 'video' | 'audio' | 'document';
60
60
  caption?: string;
61
+ fileName?: string;
61
62
  }
62
63
  interface SendWhatsAppTemplateParams {
63
64
  token: string;
@@ -65,19 +66,26 @@ interface SendWhatsAppTemplateParams {
65
66
  templateName: string;
66
67
  languageCode: string;
67
68
  components?: Array<{
68
- type: 'header' | 'body' | 'button';
69
+ type: 'HEADER' | 'BODY' | 'BUTTONS';
69
70
  parameters?: Array<{
70
- type: 'text' | 'image' | 'document' | 'video';
71
- text?: string;
72
- image?: {
71
+ type: 'text';
72
+ text: string;
73
+ } | {
74
+ type: 'image';
75
+ image: {
73
76
  link?: string;
74
77
  id?: string;
75
78
  };
76
- document?: {
79
+ } | {
80
+ type: 'document';
81
+ document: {
77
82
  link?: string;
78
83
  id?: string;
84
+ filename?: string;
79
85
  };
80
- video?: {
86
+ } | {
87
+ type: 'video';
88
+ video: {
81
89
  link?: string;
82
90
  id?: string;
83
91
  };
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",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;
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,...e.fileName&&{fileName:e.fileName}},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
7
  exports.OficialAPISDK=C;exports.default=j;//# sourceMappingURL=index.js.map
8
8
  //# sourceMappingURL=index.js.map