@oficialapi/sdk 8.0.0 → 9.0.1

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
@@ -768,16 +768,504 @@ await sdk.whatsapp.createTemplate({
768
768
  ]
769
769
  }, accessToken);
770
770
 
771
- // Upload de mídia para template ou uso em mensagens
772
- const file = new File(['...'], 'image.jpg', { type: 'image/jpeg' });
771
+ #### Upload de Mídia
772
+
773
+ O método `uploadMedia` é usado para fazer upload de arquivos (imagens, vídeos, áudios, documentos) que serão usados em templates ou enviados via `sendAudio`, `sendVideo`, `sendDocument` ou `sendSticker`.
774
+
775
+ **Exemplo 1: Upload de imagem sem filename (opcional)**
776
+
777
+ ```typescript
778
+ // Em ambiente Node.js
779
+ import fs from 'fs';
780
+
781
+ const fileBuffer = fs.readFileSync('./imagem.jpg');
782
+ const uploadResult = await sdk.whatsapp.uploadMedia({
783
+ token: 'sk_live_...',
784
+ file: fileBuffer
785
+ // filename é opcional
786
+ }, accessToken);
787
+
788
+ const mediaId = uploadResult.data.handle; // "4::aW1hZ2UtMTIzNDU2Nzg5MGCE..."
789
+ ```
790
+
791
+ **Exemplo 2: Upload de imagem com filename**
792
+
793
+ ```typescript
794
+
795
+ import fs from 'fs';
796
+
797
+ const fileBuffer = fs.readFileSync('./imagem.jpg');
798
+ const uploadResult = await sdk.whatsapp.uploadMedia({
799
+ token: 'sk_live_...',
800
+ file: fileBuffer,
801
+ filename: 'minha_imagem.jpg'
802
+ }, accessToken);
803
+
804
+ const mediaId = uploadResult.data.handle;
805
+ ```
806
+
807
+ **Exemplo 3: Upload de vídeo (Node.js)**
808
+
809
+ ```typescript
810
+ import fs from 'fs';
811
+
812
+ const videoBuffer = fs.readFileSync('./video.mp4');
813
+ const uploadResult = await sdk.whatsapp.uploadMedia({
814
+ token: 'sk_live_...',
815
+ file: videoBuffer,
816
+ filename: 'meu_video.mp4'
817
+ }, accessToken);
818
+
819
+ // Use o mediaId para enviar o vídeo
820
+ await sdk.whatsapp.sendVideo({
821
+ token: 'sk_live_...',
822
+ sender: '5511999999999',
823
+ mediaId: uploadResult.data.handle,
824
+ caption: 'Confira este vídeo!'
825
+ }, accessToken);
826
+ ```
827
+
828
+
829
+ ```typescript
830
+ import fs from 'fs';
831
+
832
+ const pdfBuffer = fs.readFileSync('./documento.pdf');
833
+ const uploadResult = await sdk.whatsapp.uploadMedia({
834
+ token: 'sk_live_...',
835
+ file: pdfBuffer,
836
+ filename: 'documento_importante.pdf'
837
+ }, accessToken);
838
+
839
+
840
+ await sdk.whatsapp.sendDocument({
841
+ token: 'sk_live_...',
842
+ sender: '5511999999999',
843
+ mediaId: uploadResult.data.handle,
844
+ filename: 'documento_importante.pdf',
845
+ caption: 'Aqui está o documento solicitado'
846
+ }, accessToken);
847
+ ```
848
+
849
+
850
+ ```typescript
851
+ import fs from 'fs';
852
+
853
+ const audioBuffer = fs.readFileSync('./audio.ogg');
854
+ const uploadResult = await sdk.whatsapp.uploadMedia({
855
+ token: 'sk_live_...',
856
+ file: audioBuffer,
857
+ filename: 'mensagem_audio.ogg'
858
+ }, accessToken);
859
+
860
+
861
+ await sdk.whatsapp.sendAudio({
862
+ token: 'sk_live_...',
863
+ sender: '5511999999999',
864
+ mediaId: uploadResult.data.handle,
865
+ voice: true // true para mensagem de voz
866
+ }, accessToken);
867
+ ```
868
+
869
+ **Exemplo 6: Upload de sticker (Node.js)**
870
+
871
+ ```typescript
872
+ import fs from 'fs';
873
+
874
+ const stickerBuffer = fs.readFileSync('./sticker.webp');
875
+ const uploadResult = await sdk.whatsapp.uploadMedia({
876
+ token: 'sk_live_...',
877
+ file: stickerBuffer,
878
+ filename: 'sticker.webp'
879
+ }, accessToken);
880
+
881
+ // Use o mediaId para enviar o sticker
882
+ await sdk.whatsapp.sendSticker({
883
+ token: 'sk_live_...',
884
+ sender: '5511999999999',
885
+ mediaId: uploadResult.data.handle
886
+ }, accessToken);
887
+ ```
888
+
889
+ **Exemplo 7: Upload em ambiente Browser (Frontend)**
890
+
891
+ ```typescript
892
+ // Em ambiente Browser
893
+ const fileInput = document.querySelector('input[type="file"]');
894
+ const file = fileInput.files[0];
895
+
773
896
  const uploadResult = await sdk.whatsapp.uploadMedia({
774
897
  token: 'sk_live_...',
775
898
  file: file,
776
- filename: 'image.jpg'
899
+ filename: file.name // Opcional
900
+ }, accessToken);
901
+
902
+ const mediaId = uploadResult.data.handle;
903
+ ```
904
+
905
+ **Exemplo 8: Upload usando Blob (Browser)**
906
+
907
+ ```typescript
908
+ // Criar um Blob a partir de dados
909
+ const blob = new Blob(['conteúdo do arquivo'], { type: 'text/plain' });
910
+
911
+ const uploadResult = await sdk.whatsapp.uploadMedia({
912
+ token: 'sk_live_...',
913
+ file: blob,
914
+ filename: 'arquivo.txt'
915
+ }, accessToken);
916
+
917
+ const mediaId = uploadResult.data.handle;
918
+ ```
919
+
920
+ **Exemplo 9: Upload para usar em template**
921
+
922
+ ```typescript
923
+ import fs from 'fs';
924
+
925
+ // Upload da imagem para usar no header do template
926
+ const imageBuffer = fs.readFileSync('./logo.jpg');
927
+ const uploadResult = await sdk.whatsapp.uploadMedia({
928
+ token: 'sk_live_...',
929
+ file: imageBuffer
930
+ // filename não é necessário para templates
931
+ }, accessToken);
932
+
933
+ // Use o handle no template
934
+ await sdk.whatsapp.createTemplate({
935
+ token: 'sk_live_...',
936
+ name: 'product_launch',
937
+ category: 'MARKETING',
938
+ language: 'pt_BR',
939
+ components: [
940
+ {
941
+ type: 'HEADER',
942
+ format: 'IMAGE',
943
+ example: {
944
+ header_handle: [uploadResult.data.handle] // Use o handle aqui
945
+ }
946
+ },
947
+ {
948
+ type: 'BODY',
949
+ text: 'Confira nosso novo produto!'
950
+ }
951
+ ]
952
+ }, accessToken);
953
+ ```
954
+
955
+ **Notas importantes:**
956
+ - O parâmetro `filename` é **opcional**. Se não fornecido, não será enviado ao servidor (a API da OficialAPI rejeita campos vazios).
957
+ - O `mediaId` retornado está no formato `"4::aW1hZ2UtMTIzNDU2Nzg5MGCE..."` e deve ser usado diretamente nos métodos `sendAudio`, `sendVideo`, `sendDocument` ou `sendSticker`.
958
+ - Para templates, use o `handle` retornado no campo `header_handle` ou `example.header_handle`.
959
+ - Formatos suportados:
960
+ - **Imagens**: JPG, PNG, GIF, WEBP
961
+ - **Vídeos**: MP4, 3GP
962
+ - **Áudios**: OGG (codec OPUS para voz), MP3, M4A
963
+ - **Documentos**: PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX
964
+ - **Stickers**: WEBP (até 500KB para animado, 100KB para estático)
965
+ ```
966
+
967
+ **Mais exemplos de templates:**
968
+
969
+ ```typescript
970
+ // Template de atualização de envio (UTILITY)
971
+ await sdk.whatsapp.createTemplate({
972
+ token: 'sk_live_01JABCDEFGHIJKLMNOPQRSTUVWXYZ',
973
+ name: 'shipping_update',
974
+ category: 'UTILITY',
975
+ language: 'pt_BR',
976
+ components: [
977
+ {
978
+ type: 'BODY',
979
+ text: 'Ótima notícia! Seu pedido com código #{{1}} já está a caminho. Use o código de rastreio {{2}} para acompanhar.',
980
+ example: {
981
+ body_text: [
982
+ ['ORD12345', 'BR123456789']
983
+ ]
984
+ }
985
+ },
986
+ {
987
+ type: 'BUTTONS',
988
+ buttons: [
989
+ {
990
+ type: 'URL',
991
+ text: 'Rastrear',
992
+ url: 'https://rastreio.com/track/{{1}}',
993
+ example: ['ORD12345']
994
+ },
995
+ {
996
+ type: 'QUICK_REPLY',
997
+ text: 'Entendido'
998
+ }
999
+ ]
1000
+ }
1001
+ ],
1002
+ allow_category_change: false
1003
+ }, accessToken);
1004
+
1005
+ // Template de promoção sazonal (MARKETING)
1006
+ await sdk.whatsapp.createTemplate({
1007
+ token: 'sk_live_01JABCDEFGHIJKLMNOPQRSTUVWXYZ',
1008
+ name: 'seasonal_promotion',
1009
+ category: 'MARKETING',
1010
+ language: 'en_US',
1011
+ components: [
1012
+ {
1013
+ type: 'HEADER',
1014
+ format: 'TEXT',
1015
+ text: 'Our {{1}} is on!',
1016
+ example: {
1017
+ header_text: ['Summer Sale']
1018
+ }
1019
+ },
1020
+ {
1021
+ type: 'BODY',
1022
+ text: 'Shop now through {{1}} and use code {{2}} to get {{3}} off all merchandise.',
1023
+ example: {
1024
+ body_text: [
1025
+ ['the end of August', '25OFF', '25%']
1026
+ ]
1027
+ }
1028
+ },
1029
+ {
1030
+ type: 'FOOTER',
1031
+ text: 'Use the buttons below to manage your marketing subscriptions'
1032
+ },
1033
+ {
1034
+ type: 'BUTTONS',
1035
+ buttons: [
1036
+ {
1037
+ type: 'QUICK_REPLY',
1038
+ text: 'Unsubscribe from Promos'
1039
+ },
1040
+ {
1041
+ type: 'QUICK_REPLY',
1042
+ text: 'Unsubscribe from All'
1043
+ }
1044
+ ]
1045
+ }
1046
+ ],
1047
+ allow_category_change: true
777
1048
  }, accessToken);
778
1049
 
779
- // Use o mediaId retornado em sendAudio, sendVideo, sendDocument ou sendSticker
780
- const mediaId = uploadResult.data.handle; // Formato: "4::aW1hZ2UtMTIzNDU2Nzg5MGCE..."
1050
+ // Template com documento PDF (UTILITY)
1051
+ await sdk.whatsapp.createTemplate({
1052
+ token: 'sk_live_01JABCDEFGHIJKLMNOPQRSTUVWXYZ',
1053
+ name: 'order_confirmation_pdf',
1054
+ category: 'UTILITY',
1055
+ language: 'en_US',
1056
+ components: [
1057
+ {
1058
+ type: 'HEADER',
1059
+ format: 'DOCUMENT',
1060
+ example: {
1061
+ header_handle: ['4::aW1hZ2UtMTIzNDU2Nzg5MGCE...'],
1062
+ header_text: ['order_receipt.pdf']
1063
+ }
1064
+ },
1065
+ {
1066
+ type: 'BODY',
1067
+ text: 'Thank you for your order, {{1}}! Your order number is {{2}}. Tap the PDF linked above to view your receipt.',
1068
+ example: {
1069
+ body_text: [
1070
+ ['Pablo', '860198-230332']
1071
+ ]
1072
+ }
1073
+ },
1074
+ {
1075
+ type: 'BUTTONS',
1076
+ buttons: [
1077
+ {
1078
+ type: 'PHONE_NUMBER',
1079
+ text: 'Call Support',
1080
+ phone_number: '15550051310'
1081
+ },
1082
+ {
1083
+ type: 'URL',
1084
+ text: 'Contact Support',
1085
+ url: 'https://www.luckyshrub.com/support'
1086
+ }
1087
+ ]
1088
+ }
1089
+ ],
1090
+ allow_category_change: false
1091
+ }, accessToken);
1092
+
1093
+ // Template de lançamento de produto com imagem (MARKETING)
1094
+ await sdk.whatsapp.createTemplate({
1095
+ token: 'sk_live_01JABCDEFGHIJKLMNOPQRSTUVWXYZ',
1096
+ name: 'product_launch',
1097
+ category: 'MARKETING',
1098
+ language: 'pt_BR',
1099
+ components: [
1100
+ {
1101
+ type: 'HEADER',
1102
+ format: 'IMAGE',
1103
+ example: {
1104
+ header_handle: ['4::aW1hZ2UtMTIzNDU2Nzg5MGCE...']
1105
+ }
1106
+ },
1107
+ {
1108
+ type: 'BODY',
1109
+ text: 'Olá {{1}}! Nossa nova coleção {{2}} já está disponível!',
1110
+ example: {
1111
+ body_text: [
1112
+ ['Maria', 'Verão 2025']
1113
+ ]
1114
+ }
1115
+ },
1116
+ {
1117
+ type: 'BUTTONS',
1118
+ buttons: [
1119
+ {
1120
+ type: 'URL',
1121
+ text: 'Ver coleção',
1122
+ url: 'https://loja.com/colecao'
1123
+ },
1124
+ {
1125
+ type: 'QUICK_REPLY',
1126
+ text: 'Compartilhar'
1127
+ }
1128
+ ]
1129
+ }
1130
+ ],
1131
+ allow_category_change: true
1132
+ }, accessToken);
1133
+
1134
+ // Template de cupom promocional (MARKETING)
1135
+ await sdk.whatsapp.createTemplate({
1136
+ token: 'sk_live_01JABCDEFGHIJKLMNOPQRSTUVWXYZ',
1137
+ name: 'coupon_promo',
1138
+ category: 'MARKETING',
1139
+ language: 'pt_BR',
1140
+ components: [
1141
+ {
1142
+ type: 'HEADER',
1143
+ format: 'TEXT',
1144
+ text: '🎉 Oferta Especial!'
1145
+ },
1146
+ {
1147
+ type: 'BODY',
1148
+ text: 'Olá {{1}}! Use o código abaixo para get {{2}} de desconto em toda a loja.',
1149
+ example: {
1150
+ body_text: [
1151
+ ['Maria', '25%']
1152
+ ]
1153
+ }
1154
+ },
1155
+ {
1156
+ type: 'BUTTONS',
1157
+ buttons: [
1158
+ {
1159
+ type: 'COPY_CODE',
1160
+ text: 'Copiar código',
1161
+ example: 'SUMMER25'
1162
+ },
1163
+ {
1164
+ type: 'URL',
1165
+ text: 'Ver loja',
1166
+ url: 'https://loja.com'
1167
+ }
1168
+ ]
1169
+ }
1170
+ ],
1171
+ allow_category_change: true
1172
+ }, accessToken);
1173
+
1174
+ // Template com parâmetros nomeados (UTILITY)
1175
+ await sdk.whatsapp.createTemplate({
1176
+ token: 'sk_live_01JABCDEFGHIJKLMNOPQRSTUVWXYZ',
1177
+ name: 'order_confirmation',
1178
+ category: 'UTILITY',
1179
+ language: 'en_US',
1180
+ components: [
1181
+ {
1182
+ type: 'BODY',
1183
+ text: 'Thank you, {{first_name}}! Your order number is {{order_number}}.',
1184
+ example: {
1185
+ body_text_named_params: [
1186
+ {
1187
+ param_name: 'first_name',
1188
+ example: 'Pablo'
1189
+ },
1190
+ {
1191
+ param_name: 'order_number',
1192
+ example: '860198-230332'
1193
+ }
1194
+ ]
1195
+ }
1196
+ }
1197
+ ],
1198
+ allow_category_change: false
1199
+ }, accessToken);
1200
+
1201
+ // Template de atualização de entrega com localização (UTILITY)
1202
+ await sdk.whatsapp.createTemplate({
1203
+ token: 'sk_live_01JABCDEFGHIJKLMNOPQRSTUVWXYZ',
1204
+ name: 'order_delivery_update',
1205
+ category: 'UTILITY',
1206
+ language: 'en_US',
1207
+ components: [
1208
+ {
1209
+ type: 'HEADER',
1210
+ format: 'LOCATION'
1211
+ },
1212
+ {
1213
+ type: 'BODY',
1214
+ text: 'Good news {{1}}! Your order #{{2}} is on its way to the location above.',
1215
+ example: {
1216
+ body_text: [
1217
+ ['Mark', '566701']
1218
+ ]
1219
+ }
1220
+ },
1221
+ {
1222
+ type: 'FOOTER',
1223
+ text: 'To stop receiving delivery updates, tap the button below.'
1224
+ },
1225
+ {
1226
+ type: 'BUTTONS',
1227
+ buttons: [
1228
+ {
1229
+ type: 'QUICK_REPLY',
1230
+ text: 'Stop Delivery Updates'
1231
+ }
1232
+ ]
1233
+ }
1234
+ ],
1235
+ allow_category_change: false
1236
+ }, accessToken);
1237
+
1238
+ // Template de mensagem de boas-vindas simples (MARKETING)
1239
+ await sdk.whatsapp.createTemplate({
1240
+ token: 'sk_live_01JABCDEFGHIJKLMNOPQRSTUVWXYZ',
1241
+ name: 'welcome_message',
1242
+ category: 'MARKETING',
1243
+ language: 'pt_BR',
1244
+ components: [
1245
+ {
1246
+ type: 'BODY',
1247
+ text: 'Bem-vindo à nossa loja! Estamos felizes em ter você conosco.'
1248
+ },
1249
+ {
1250
+ type: 'FOOTER',
1251
+ text: 'Equipe da Loja'
1252
+ },
1253
+ {
1254
+ type: 'BUTTONS',
1255
+ buttons: [
1256
+ {
1257
+ type: 'QUICK_REPLY',
1258
+ text: 'Ver ofertas'
1259
+ },
1260
+ {
1261
+ type: 'QUICK_REPLY',
1262
+ text: 'Falar no chat'
1263
+ }
1264
+ ]
1265
+ }
1266
+ ],
1267
+ allow_category_change: true
1268
+ }, accessToken);
781
1269
  ```
782
1270
 
783
1271
  ### Telegram
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,...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;
6
+ var f="https://api.oficialapi.com.br",d=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 y=new Blob([t]);r.append(i,y);}else r.append(i,t);s&&Object.entries(s).forEach(([y,a])=>{a!=null&&r.append(y,typeof a=="string"?a:JSON.stringify(a));});let P={headers:{"Content-Type":"multipart/form-data"},accessToken:n};return (await this.axiosInstance.post(e,r,P)).data}};var l=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 p=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 h=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,...e.filename&&{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 g=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 u=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/webchat/send-text",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/webchat/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendCarousel(e,t){return this.httpClient.post("/api/v1/webchat/send-carousel",{token:e.token,sender:e.sender,cards:e.cards},t)}async sendForm(e,t){return this.httpClient.post("/api/v1/webchat/send-form",{token:e.token,sender:e.sender,title:e.title,fields:e.fields,submitButtonText:e.submitButtonText},t)}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/webchat/send-quick-replies",{token:e.token,sender:e.sender,messageText:e.messageText,quickReplies:e.quickReplies},t)}async sendCard(e,t){return this.httpClient.post("/api/v1/webchat/send-card",{token:e.token,sender:e.sender,title:e.title,description:e.description,imageUrl:e.imageUrl,buttons:e.buttons},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/webchat/send-buttons",{token:e.token,sender:e.sender,messageText:e.messageText,buttons:e.buttons},t)}};var m=class{constructor(e){this.httpClient=e;}async listPosts(e,t){return this.httpClient.post("/api/v1/facebook/list-posts",{token:e.token,pageId:e.pageId,limit:e.limit},t)}async listComments(e,t){return this.httpClient.post("/api/v1/facebook/list-comments",{token:e.token,postId:e.postId,limit:e.limit},t)}async createPost(e,t){return this.httpClient.post("/api/v1/facebook/create-post",{token:e.token,pageId:e.pageId,message:e.message,link:e.link},t)}async replyComment(e,t){return this.httpClient.post("/api/v1/facebook/reply-comment",{token:e.token,commentId:e.commentId,message:e.message},t)}async deleteComment(e,t){return this.httpClient.post("/api/v1/facebook/delete-comment",{token:e.token,commentId:e.commentId},t)}async sendText(e,t){return this.httpClient.post("/api/v1/facebook/send-text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/facebook/send-media",{token:e.token,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/facebook/send-buttons",{token:e.token,recipientId:e.recipientId,message:e.message,buttons:e.buttons},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/facebook/send-sticker",{token:e.token,recipientId:e.recipientId,stickerId:e.stickerId},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/facebook/reply-message",{token:e.token,messageId:e.messageId,message:e.message},t)}async replyMedia(e,t){return this.httpClient.post("/api/v1/facebook/reply-media",{token:e.token,messageId:e.messageId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sharePost(e,t){return this.httpClient.post("/api/v1/facebook/share-post",{token:e.token,mediaId:e.mediaId,recipientId:e.recipientId},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/facebook/user-profile",{token:e.token,userId:e.userId},t)}async getPageProfile(e,t){return this.httpClient.post("/api/v1/facebook/page-profile",{token:e.token,pageId:e.pageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/facebook/download-media",{token:e.token,url:e.url},t)}};var k=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 d(e),this.auth=new l(this.httpClient),this.channels=new c(this.httpClient),this.integrations=new p(this.httpClient),this.whatsapp=new h(this.httpClient),this.telegram=new g(this.httpClient),this.webchat=new u(this.httpClient),this.facebook=new m(this.httpClient),this.instagram=new k(this.httpClient);}},j=C;
7
7
  exports.OficialAPISDK=C;exports.default=j;//# sourceMappingURL=index.js.map
8
8
  //# sourceMappingURL=index.js.map