@oficialapi/sdk 6.0.0 → 8.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
@@ -62,6 +62,7 @@ console.log(result.data.messageId);
62
62
  #### Enviar Mídia
63
63
 
64
64
  ```typescript
65
+ // Enviar imagem
65
66
  await sdk.whatsapp.sendMedia({
66
67
  token: 'sk_live_...',
67
68
  sender: '5511999999999',
@@ -69,19 +70,35 @@ await sdk.whatsapp.sendMedia({
69
70
  type: 'image',
70
71
  caption: 'Veja esta imagem!'
71
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);
72
83
  ```
73
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
+
74
87
  #### Enviar Template
75
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
+
76
93
  ```typescript
77
94
  await sdk.whatsapp.sendTemplate({
78
95
  token: 'sk_live_...',
79
96
  sender: '5511999999999',
80
- templateName: 'welcome_message',
97
+ templateName: 'hello_world',
81
98
  languageCode: 'pt_BR',
82
99
  components: [
83
100
  {
84
- type: 'body',
101
+ type: 'BODY',
85
102
  parameters: [
86
103
  { type: 'text', text: 'João' }
87
104
  ]
@@ -90,6 +107,100 @@ await sdk.whatsapp.sendTemplate({
90
107
  }, accessToken);
91
108
  ```
92
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
+
93
204
  #### Enviar Botões
94
205
 
95
206
  ```typescript
@@ -230,32 +341,35 @@ await sdk.whatsapp.sendDocument({
230
341
 
231
342
  #### Enviar Pedido com Opções de Pagamento
232
343
 
344
+ > **⚠️ Nota Importante:** O status do pedido deve ser `pending` ao usar `sendOrderDetails`. Use `sendOrderStatus` para atualizar o status após o pagamento.
345
+
346
+ **Exemplo 1: Pedido Digital com PIX**
347
+
233
348
  ```typescript
234
349
  await sdk.whatsapp.sendOrderDetails({
235
- token: 'sk_live_...',
350
+ token: 'sk_live_9999999999999999999999999',
236
351
  sender: '5511999999999',
237
- headerText: 'Confirmação de Pedido', // Opcional
352
+ headerText: 'Confirmação de Pedido',
238
353
  bodyText: 'Seu pedido #12345 está pronto para pagamento!',
239
- footerText: 'Obrigado por comprar conosco!', // Opcional
240
- reference_id: 'pedido_12345_1704067200', // ID único do pedido
241
- type: 'digital-goods', // ou 'physical-goods'
354
+ footerText: 'Obrigado por comprar conosco!',
355
+ reference_id: 'pedido_12345_1704067200',
356
+ type: 'digital-goods',
242
357
  currency: 'BRL',
243
358
  total_amount: {
244
- value: 50000, // Valor em centavos (500.00)
245
- offset: 100, // Fator de ajuste (sempre 100 para BRL)
246
- description: 'Total do pedido' // Opcional
359
+ value: 50000,
360
+ offset: 100
247
361
  },
248
362
  order: {
249
- status: 'pending',
363
+ status: 'pending', // OBRIGATÓRIO: deve ser 'pending' para review_and_pay
250
364
  items: [
251
365
  {
252
366
  retailer_id: '1234567',
253
- name: 'Produto 1',
367
+ name: 'Cake',
254
368
  amount: {
255
369
  value: 50000,
256
370
  offset: 100
257
371
  },
258
- quantity: 2
372
+ quantity: 1
259
373
  }
260
374
  ],
261
375
  subtotal: {
@@ -266,39 +380,248 @@ await sdk.whatsapp.sendOrderDetails({
266
380
  value: 0,
267
381
  offset: 100,
268
382
  description: 'Sem impostos'
383
+ }
384
+ },
385
+ payment_settings: [
386
+ {
387
+ type: 'pix_dynamic_code',
388
+ pix_dynamic_code: {
389
+ code: '00020101021226700014br.gov.bcb.pix2548pix.example.com...',
390
+ merchant_name: 'Minha Empresa Ltda',
391
+ key: '39580525000189',
392
+ key_type: 'CNPJ'
393
+ }
394
+ }
395
+ ]
396
+ }, accessToken);
397
+ ```
398
+
399
+ **Exemplo 2: Pedido Digital com Link de Pagamento**
400
+
401
+ ```typescript
402
+ await sdk.whatsapp.sendOrderDetails({
403
+ token: 'sk_live_9999999999999999999999999',
404
+ sender: '5511999999999',
405
+ bodyText: 'Sua fatura está disponível para pagamento!',
406
+ reference_id: 'fatura_67890_1704067200',
407
+ type: 'digital-goods',
408
+ currency: 'BRL',
409
+ total_amount: {
410
+ value: 150000,
411
+ offset: 100
412
+ },
413
+ order: {
414
+ status: 'pending',
415
+ items: [
416
+ {
417
+ retailer_id: 'item_001',
418
+ name: 'Serviço Premium',
419
+ amount: {
420
+ value: 150000,
421
+ offset: 100
422
+ },
423
+ quantity: 1
424
+ }
425
+ ],
426
+ subtotal: {
427
+ value: 150000,
428
+ offset: 100
269
429
  },
270
- shipping: { // Opcional
271
- value: 1000,
272
- offset: 100,
273
- description: 'Frete'
430
+ tax: {
431
+ value: 0,
432
+ offset: 100
433
+ }
434
+ },
435
+ payment_settings: [
436
+ {
437
+ type: 'payment_link',
438
+ payment_link: {
439
+ uri: 'https://pagamento.exemplo.com/fatura/67890'
440
+ }
441
+ }
442
+ ]
443
+ }, accessToken);
444
+ ```
445
+
446
+ **Exemplo 3: Pedido Digital com Boleto**
447
+
448
+ ```typescript
449
+ await sdk.whatsapp.sendOrderDetails({
450
+ token: 'sk_live_9999999999999999999999999',
451
+ sender: '5511999999999',
452
+ bodyText: 'Sua inscrição está confirmada! Efetue o pagamento via boleto.',
453
+ reference_id: 'inscricao_11111_1704067200',
454
+ type: 'digital-goods',
455
+ currency: 'BRL',
456
+ total_amount: {
457
+ value: 29900,
458
+ offset: 100
459
+ },
460
+ order: {
461
+ status: 'pending',
462
+ items: [
463
+ {
464
+ retailer_id: 'curso_001',
465
+ name: 'Curso de Programação',
466
+ amount: {
467
+ value: 29900,
468
+ offset: 100
469
+ },
470
+ quantity: 1
471
+ }
472
+ ],
473
+ subtotal: {
474
+ value: 29900,
475
+ offset: 100
476
+ },
477
+ tax: {
478
+ value: 0,
479
+ offset: 100
480
+ }
481
+ },
482
+ payment_settings: [
483
+ {
484
+ type: 'boleto',
485
+ boleto: {
486
+ digitable_line: '03399026944140000002628346101018898510000008848'
487
+ }
488
+ }
489
+ ]
490
+ }, accessToken);
491
+ ```
492
+
493
+ **Exemplo 4: Pedido Físico com Múltiplas Formas de Pagamento (PIX + Link)**
494
+
495
+ ```typescript
496
+ await sdk.whatsapp.sendOrderDetails({
497
+ token: 'sk_live_9999999999999999999999999',
498
+ sender: '5511999999999',
499
+ bodyText: 'Seu pedido está pronto! Escolha a forma de pagamento:',
500
+ reference_id: 'pedido_completo_22222_1704067200',
501
+ type: 'physical-goods',
502
+ currency: 'BRL',
503
+ total_amount: {
504
+ value: 262400, // subtotal (259900) + tax (0) + shipping (2500) - discount (0)
505
+ offset: 100
506
+ },
507
+ order: {
508
+ status: 'pending',
509
+ catalog_id: '1234567890',
510
+ items: [
511
+ {
512
+ retailer_id: 'produto_001',
513
+ name: 'Camiseta Básica',
514
+ amount: {
515
+ value: 79000,
516
+ offset: 100
517
+ },
518
+ quantity: 2
519
+ },
520
+ {
521
+ retailer_id: 'produto_002',
522
+ name: 'Calça Jeans',
523
+ amount: {
524
+ value: 101900,
525
+ offset: 100
526
+ },
527
+ quantity: 1
528
+ }
529
+ ],
530
+ subtotal: {
531
+ value: 259900,
532
+ offset: 100
533
+ },
534
+ tax: {
535
+ value: 0,
536
+ offset: 100
274
537
  },
275
- discount: { // Opcional
276
- value: 5000,
538
+ shipping: {
539
+ value: 2500,
277
540
  offset: 100,
278
- description: 'Desconto',
279
- discount_program_name: 'Promoção'
541
+ description: 'Frete via SEDEX'
280
542
  }
281
543
  },
282
- payment_settings: [ // Opcional, máximo 2 métodos
544
+ payment_settings: [
283
545
  {
284
546
  type: 'pix_dynamic_code',
285
547
  pix_dynamic_code: {
286
548
  code: '00020101021226700014br.gov.bcb.pix2548pix.example.com...',
287
- merchant_name: 'Minha Empresa Ltda',
288
- key: '39580525000189',
289
- key_type: 'CNPJ' // CPF, CNPJ, EMAIL, PHONE ou EVP
549
+ merchant_name: 'Minha Loja Virtual',
550
+ key: 'minhaloja@email.com',
551
+ key_type: 'EMAIL'
290
552
  }
291
553
  },
292
554
  {
293
555
  type: 'payment_link',
294
556
  payment_link: {
295
- uri: 'https://pagamento.exemplo.com/pedido/123'
557
+ uri: 'https://minhaloja.com/pagar/22222'
558
+ }
559
+ }
560
+ ]
561
+ }, accessToken);
562
+ ```
563
+
564
+ **Exemplo 5: Pedido com Desconto (Black Friday)**
565
+
566
+ ```typescript
567
+ await sdk.whatsapp.sendOrderDetails({
568
+ token: 'sk_live_9999999999999999999999999',
569
+ sender: '5511999999999',
570
+ bodyText: 'Black Friday! Seu pedido com desconto especial:',
571
+ reference_id: 'black_friday_33333_1704067200',
572
+ type: 'digital-goods',
573
+ currency: 'BRL',
574
+ total_amount: {
575
+ value: 39900, // subtotal (49900) + tax (0) + shipping (0) - discount (10000)
576
+ offset: 100
577
+ },
578
+ order: {
579
+ status: 'pending',
580
+ items: [
581
+ {
582
+ retailer_id: 'bf_001',
583
+ name: 'Pacote Premium',
584
+ amount: {
585
+ value: 49900,
586
+ offset: 100
587
+ },
588
+ quantity: 1
589
+ }
590
+ ],
591
+ subtotal: {
592
+ value: 49900,
593
+ offset: 100
594
+ },
595
+ tax: {
596
+ value: 0,
597
+ offset: 100
598
+ },
599
+ discount: {
600
+ value: 10000,
601
+ offset: 100,
602
+ description: 'Desconto Black Friday 20%',
603
+ discount_program_name: 'Black Friday 2024'
604
+ }
605
+ },
606
+ payment_settings: [
607
+ {
608
+ type: 'pix_dynamic_code',
609
+ pix_dynamic_code: {
610
+ code: '00020101021226700014br.gov.bcb.pix2548pix.example.com...',
611
+ merchant_name: 'Black Friday Loja',
612
+ key: '5511999999999',
613
+ key_type: 'PHONE'
296
614
  }
297
615
  }
298
616
  ]
299
617
  }, accessToken);
300
618
  ```
301
619
 
620
+ **Importante:**
621
+ - O `total_amount.value` deve ser igual a: `subtotal + tax + shipping - discount`
622
+ - O status do pedido deve ser `pending` ao usar `sendOrderDetails`
623
+ - Use `sendOrderStatus` para atualizar o status após o pagamento
624
+
302
625
  #### Atualizar Status do Pedido
303
626
 
304
627
  ```typescript
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