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