@oficialapi/sdk 2.0.0 → 3.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 +540 -2
- package/dist/index.d.mts +56 -7
- package/dist/index.d.ts +56 -7
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -237,6 +237,95 @@ await sdk.whatsapp.sendOrderDetails({
|
|
|
237
237
|
}, accessToken);
|
|
238
238
|
```
|
|
239
239
|
|
|
240
|
+
#### Atualizar Status do Pedido
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
await sdk.whatsapp.sendOrderStatus({
|
|
244
|
+
token: 'sk_live_...',
|
|
245
|
+
sender: '5511999999999',
|
|
246
|
+
orderId: 'ORDER123',
|
|
247
|
+
status: 'SHIPPED',
|
|
248
|
+
messageText: 'Seu pedido foi enviado!'
|
|
249
|
+
}, accessToken);
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### Enviar Sticker
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
await sdk.whatsapp.sendSticker({
|
|
256
|
+
token: 'sk_live_...',
|
|
257
|
+
sender: '5511999999999',
|
|
258
|
+
stickerUrl: 'https://example.com/sticker.webp'
|
|
259
|
+
}, accessToken);
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
#### Solicitar Localização
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
await sdk.whatsapp.sendLocationRequest({
|
|
266
|
+
token: 'sk_live_...',
|
|
267
|
+
sender: '5511999999999',
|
|
268
|
+
messageText: 'Por favor, compartilhe sua localização'
|
|
269
|
+
}, accessToken);
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### Enviar Mensagem com Botão CTA URL
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
await sdk.whatsapp.sendCtaUrl({
|
|
276
|
+
token: 'sk_live_...',
|
|
277
|
+
sender: '5511999999999',
|
|
278
|
+
messageText: 'Confira nosso site!',
|
|
279
|
+
buttonText: 'Acessar',
|
|
280
|
+
url: 'https://example.com'
|
|
281
|
+
}, accessToken);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### Enviar Carrossel de Mídia
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
await sdk.whatsapp.sendMediaCarousel({
|
|
288
|
+
token: 'sk_live_...',
|
|
289
|
+
sender: '5511999999999',
|
|
290
|
+
cards: [
|
|
291
|
+
{
|
|
292
|
+
card_index: 0,
|
|
293
|
+
media: { link: 'https://example.com/image1.jpg' },
|
|
294
|
+
title: 'Produto 1',
|
|
295
|
+
description: 'Descrição do produto 1',
|
|
296
|
+
actions: [{ type: 'link', value: 'https://example.com/product1' }]
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
card_index: 1,
|
|
300
|
+
media: { link: 'https://example.com/image2.jpg' },
|
|
301
|
+
title: 'Produto 2',
|
|
302
|
+
description: 'Descrição do produto 2',
|
|
303
|
+
actions: [{ type: 'link', value: 'https://example.com/product2' }]
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
}, accessToken);
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
#### Responder Mensagem
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
await sdk.whatsapp.replyMessage({
|
|
313
|
+
token: 'sk_live_...',
|
|
314
|
+
messageId: 'wamid.xxx',
|
|
315
|
+
messageText: 'Esta é uma resposta!'
|
|
316
|
+
}, accessToken);
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### Reagir a Mensagem
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
await sdk.whatsapp.reactMessage({
|
|
323
|
+
token: 'sk_live_...',
|
|
324
|
+
messageId: 'wamid.xxx',
|
|
325
|
+
emoji: '👍'
|
|
326
|
+
}, accessToken);
|
|
327
|
+
```
|
|
328
|
+
|
|
240
329
|
#### Gerenciar Templates
|
|
241
330
|
|
|
242
331
|
```typescript
|
|
@@ -341,7 +430,117 @@ await sdk.telegram.sendPoll({
|
|
|
341
430
|
chatId: '123456789',
|
|
342
431
|
question: 'Qual sua cor favorita?',
|
|
343
432
|
options: ['Vermelho', 'Azul', 'Verde'],
|
|
344
|
-
isAnonymous: false
|
|
433
|
+
isAnonymous: false,
|
|
434
|
+
type: 'quiz',
|
|
435
|
+
correctOptionId: 1
|
|
436
|
+
}, accessToken);
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
#### Enviar Venue (Local)
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
await sdk.telegram.sendVenue({
|
|
443
|
+
token: 'sk_live_...',
|
|
444
|
+
chatId: '123456789',
|
|
445
|
+
latitude: -23.5505,
|
|
446
|
+
longitude: -46.6333,
|
|
447
|
+
title: 'Restaurante XYZ',
|
|
448
|
+
address: 'Rua ABC, 123, São Paulo'
|
|
449
|
+
}, accessToken);
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### Enviar Dado/Emoji Animado
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
await sdk.telegram.sendDice({
|
|
456
|
+
token: 'sk_live_...',
|
|
457
|
+
chatId: '123456789',
|
|
458
|
+
emoji: '🎲'
|
|
459
|
+
}, accessToken);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
#### Enviar Sticker
|
|
463
|
+
|
|
464
|
+
```typescript
|
|
465
|
+
await sdk.telegram.sendSticker({
|
|
466
|
+
token: 'sk_live_...',
|
|
467
|
+
chatId: '123456789',
|
|
468
|
+
stickerUrl: 'https://example.com/sticker.webp'
|
|
469
|
+
}, accessToken);
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
#### Enviar Voz
|
|
473
|
+
|
|
474
|
+
```typescript
|
|
475
|
+
await sdk.telegram.sendVoice({
|
|
476
|
+
token: 'sk_live_...',
|
|
477
|
+
chatId: '123456789',
|
|
478
|
+
voiceUrl: 'https://example.com/voice.ogg',
|
|
479
|
+
caption: 'Mensagem de voz',
|
|
480
|
+
duration: 30
|
|
481
|
+
}, accessToken);
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
#### Enviar Video Note
|
|
485
|
+
|
|
486
|
+
```typescript
|
|
487
|
+
await sdk.telegram.sendVideoNote({
|
|
488
|
+
token: 'sk_live_...',
|
|
489
|
+
chatId: '123456789',
|
|
490
|
+
videoNoteUrl: 'https://example.com/video_note.mp4',
|
|
491
|
+
duration: 10,
|
|
492
|
+
length: 360
|
|
493
|
+
}, accessToken);
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
#### Enviar Grupo de Mídia
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
await sdk.telegram.sendMediaGroup({
|
|
500
|
+
token: 'sk_live_...',
|
|
501
|
+
chatId: '123456789',
|
|
502
|
+
media: [
|
|
503
|
+
{ type: 'photo', media: 'https://example.com/image1.jpg', caption: 'Imagem 1' },
|
|
504
|
+
{ type: 'photo', media: 'https://example.com/image2.jpg', caption: 'Imagem 2' }
|
|
505
|
+
]
|
|
506
|
+
}, accessToken);
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
#### Enviar Teclado de Resposta
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
await sdk.telegram.sendReplyKeyboard({
|
|
513
|
+
token: 'sk_live_...',
|
|
514
|
+
chatId: '123456789',
|
|
515
|
+
text: 'Escolha uma opção:',
|
|
516
|
+
keyboard: [
|
|
517
|
+
[{ text: 'Opção 1' }, { text: 'Opção 2' }],
|
|
518
|
+
[{ text: 'Opção 3' }]
|
|
519
|
+
],
|
|
520
|
+
resizeKeyboard: true,
|
|
521
|
+
oneTimeKeyboard: true
|
|
522
|
+
}, accessToken);
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### Editar Mensagem
|
|
526
|
+
|
|
527
|
+
```typescript
|
|
528
|
+
await sdk.telegram.editMessage({
|
|
529
|
+
token: 'sk_live_...',
|
|
530
|
+
chatId: '123456789',
|
|
531
|
+
messageId: 123,
|
|
532
|
+
text: 'Mensagem editada!',
|
|
533
|
+
parseMode: 'HTML'
|
|
534
|
+
}, accessToken);
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
#### Deletar Mensagem
|
|
538
|
+
|
|
539
|
+
```typescript
|
|
540
|
+
await sdk.telegram.deleteMessage({
|
|
541
|
+
token: 'sk_live_...',
|
|
542
|
+
chatId: '123456789',
|
|
543
|
+
messageId: 123
|
|
345
544
|
}, accessToken);
|
|
346
545
|
```
|
|
347
546
|
|
|
@@ -376,6 +575,45 @@ await sdk.webchat.sendCard({
|
|
|
376
575
|
}, accessToken);
|
|
377
576
|
```
|
|
378
577
|
|
|
578
|
+
#### Enviar Mídia
|
|
579
|
+
|
|
580
|
+
```typescript
|
|
581
|
+
await sdk.webchat.sendMedia({
|
|
582
|
+
token: 'sk_live_...',
|
|
583
|
+
sender: 'user123',
|
|
584
|
+
fileUrl: 'https://example.com/image.jpg',
|
|
585
|
+
type: 'image',
|
|
586
|
+
caption: 'Veja esta imagem!'
|
|
587
|
+
}, accessToken);
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
#### Enviar Carousel
|
|
591
|
+
|
|
592
|
+
```typescript
|
|
593
|
+
await sdk.webchat.sendCarousel({
|
|
594
|
+
token: 'sk_live_...',
|
|
595
|
+
sender: 'user123',
|
|
596
|
+
cards: [
|
|
597
|
+
{
|
|
598
|
+
title: 'Produto 1',
|
|
599
|
+
description: 'Descrição do produto 1',
|
|
600
|
+
imageUrl: 'https://example.com/product1.jpg',
|
|
601
|
+
buttons: [
|
|
602
|
+
{ type: 'url', title: 'Ver Mais', value: 'https://example.com/product1' }
|
|
603
|
+
]
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
title: 'Produto 2',
|
|
607
|
+
description: 'Descrição do produto 2',
|
|
608
|
+
imageUrl: 'https://example.com/product2.jpg',
|
|
609
|
+
buttons: [
|
|
610
|
+
{ type: 'url', title: 'Ver Mais', value: 'https://example.com/product2' }
|
|
611
|
+
]
|
|
612
|
+
}
|
|
613
|
+
]
|
|
614
|
+
}, accessToken);
|
|
615
|
+
```
|
|
616
|
+
|
|
379
617
|
#### Enviar Formulário
|
|
380
618
|
|
|
381
619
|
```typescript
|
|
@@ -401,6 +639,35 @@ await sdk.webchat.sendForm({
|
|
|
401
639
|
}, accessToken);
|
|
402
640
|
```
|
|
403
641
|
|
|
642
|
+
#### Enviar Quick Replies
|
|
643
|
+
|
|
644
|
+
```typescript
|
|
645
|
+
await sdk.webchat.sendQuickReplies({
|
|
646
|
+
token: 'sk_live_...',
|
|
647
|
+
sender: 'user123',
|
|
648
|
+
messageText: 'Como podemos ajudar?',
|
|
649
|
+
quickReplies: [
|
|
650
|
+
{ type: 'text', title: 'Suporte', payload: 'SUPPORT' },
|
|
651
|
+
{ type: 'text', title: 'Vendas', payload: 'SALES' },
|
|
652
|
+
{ type: 'location', title: 'Compartilhar Localização' }
|
|
653
|
+
]
|
|
654
|
+
}, accessToken);
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
#### Enviar Botões
|
|
658
|
+
|
|
659
|
+
```typescript
|
|
660
|
+
await sdk.webchat.sendButtons({
|
|
661
|
+
token: 'sk_live_...',
|
|
662
|
+
sender: 'user123',
|
|
663
|
+
messageText: 'Escolha uma opção:',
|
|
664
|
+
buttons: [
|
|
665
|
+
{ type: 'url', title: 'Visitar Site', value: 'https://example.com' },
|
|
666
|
+
{ type: 'postback', title: 'Falar com Atendente', value: 'HUMAN_AGENT' }
|
|
667
|
+
]
|
|
668
|
+
}, accessToken);
|
|
669
|
+
```
|
|
670
|
+
|
|
404
671
|
### Facebook
|
|
405
672
|
|
|
406
673
|
#### Listar Posts
|
|
@@ -424,7 +691,36 @@ await sdk.facebook.createPost({
|
|
|
424
691
|
}, accessToken);
|
|
425
692
|
```
|
|
426
693
|
|
|
427
|
-
####
|
|
694
|
+
#### Listar Comentários
|
|
695
|
+
|
|
696
|
+
```typescript
|
|
697
|
+
const comments = await sdk.facebook.listComments({
|
|
698
|
+
token: 'sk_live_...',
|
|
699
|
+
postId: 'post_id',
|
|
700
|
+
limit: 20
|
|
701
|
+
}, accessToken);
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
#### Responder Comentário
|
|
705
|
+
|
|
706
|
+
```typescript
|
|
707
|
+
await sdk.facebook.replyComment({
|
|
708
|
+
token: 'sk_live_...',
|
|
709
|
+
commentId: 'comment_id',
|
|
710
|
+
message: 'Obrigado pelo comentário!'
|
|
711
|
+
}, accessToken);
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
#### Deletar Comentário
|
|
715
|
+
|
|
716
|
+
```typescript
|
|
717
|
+
await sdk.facebook.deleteComment({
|
|
718
|
+
token: 'sk_live_...',
|
|
719
|
+
commentId: 'comment_id'
|
|
720
|
+
}, accessToken);
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
#### Enviar Mensagem de Texto
|
|
428
724
|
|
|
429
725
|
```typescript
|
|
430
726
|
await sdk.facebook.sendText({
|
|
@@ -434,6 +730,92 @@ await sdk.facebook.sendText({
|
|
|
434
730
|
}, accessToken);
|
|
435
731
|
```
|
|
436
732
|
|
|
733
|
+
#### Enviar Mídia
|
|
734
|
+
|
|
735
|
+
```typescript
|
|
736
|
+
await sdk.facebook.sendMedia({
|
|
737
|
+
token: 'sk_live_...',
|
|
738
|
+
recipientId: 'user_id',
|
|
739
|
+
fileUrl: 'https://example.com/image.jpg',
|
|
740
|
+
type: 'image',
|
|
741
|
+
caption: 'Veja esta imagem!'
|
|
742
|
+
}, accessToken);
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
#### Enviar Botões
|
|
746
|
+
|
|
747
|
+
```typescript
|
|
748
|
+
await sdk.facebook.sendButtons({
|
|
749
|
+
token: 'sk_live_...',
|
|
750
|
+
recipientId: 'user_id',
|
|
751
|
+
message: 'Escolha uma opção:',
|
|
752
|
+
buttons: [
|
|
753
|
+
{ type: 'web_url', title: 'Visitar Site', url: 'https://example.com' },
|
|
754
|
+
{ type: 'postback', title: 'Opção', payload: 'OPTION_1' }
|
|
755
|
+
]
|
|
756
|
+
}, accessToken);
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
#### Enviar Sticker
|
|
760
|
+
|
|
761
|
+
```typescript
|
|
762
|
+
await sdk.facebook.sendSticker({
|
|
763
|
+
token: 'sk_live_...',
|
|
764
|
+
recipientId: 'user_id',
|
|
765
|
+
stickerId: 369239263222822
|
|
766
|
+
}, accessToken);
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
#### Responder Mensagem
|
|
770
|
+
|
|
771
|
+
```typescript
|
|
772
|
+
await sdk.facebook.replyMessage({
|
|
773
|
+
token: 'sk_live_...',
|
|
774
|
+
messageId: 'message_id',
|
|
775
|
+
message: 'Esta é uma resposta!'
|
|
776
|
+
}, accessToken);
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
#### Responder com Mídia
|
|
780
|
+
|
|
781
|
+
```typescript
|
|
782
|
+
await sdk.facebook.replyMedia({
|
|
783
|
+
token: 'sk_live_...',
|
|
784
|
+
messageId: 'message_id',
|
|
785
|
+
fileUrl: 'https://example.com/image.jpg',
|
|
786
|
+
type: 'image',
|
|
787
|
+
caption: 'Aqui está!'
|
|
788
|
+
}, accessToken);
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
#### Compartilhar Post do Instagram
|
|
792
|
+
|
|
793
|
+
```typescript
|
|
794
|
+
await sdk.facebook.sharePost({
|
|
795
|
+
token: 'sk_live_...',
|
|
796
|
+
mediaId: 'media_id',
|
|
797
|
+
recipientId: 'user_id'
|
|
798
|
+
}, accessToken);
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
#### Obter Perfil de Usuário
|
|
802
|
+
|
|
803
|
+
```typescript
|
|
804
|
+
const userProfile = await sdk.facebook.getUserProfile({
|
|
805
|
+
token: 'sk_live_...',
|
|
806
|
+
userId: 'user_id'
|
|
807
|
+
}, accessToken);
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
#### Obter Perfil de Página
|
|
811
|
+
|
|
812
|
+
```typescript
|
|
813
|
+
const pageProfile = await sdk.facebook.getPageProfile({
|
|
814
|
+
token: 'sk_live_...',
|
|
815
|
+
pageId: 'page_id'
|
|
816
|
+
}, accessToken);
|
|
817
|
+
```
|
|
818
|
+
|
|
437
819
|
### Instagram
|
|
438
820
|
|
|
439
821
|
#### Enviar Mensagem de Texto
|
|
@@ -468,6 +850,162 @@ await sdk.instagram.sendPrivateReply({
|
|
|
468
850
|
}, accessToken);
|
|
469
851
|
```
|
|
470
852
|
|
|
853
|
+
#### Enviar Múltiplas Imagens (Carrossel)
|
|
854
|
+
|
|
855
|
+
```typescript
|
|
856
|
+
await sdk.instagram.sendImages({
|
|
857
|
+
token: 'sk_live_...',
|
|
858
|
+
recipientId: 'user_id',
|
|
859
|
+
images: [
|
|
860
|
+
{ url: 'https://example.com/image1.jpg', caption: 'Imagem 1' },
|
|
861
|
+
{ url: 'https://example.com/image2.jpg', caption: 'Imagem 2' },
|
|
862
|
+
{ url: 'https://example.com/image3.jpg', caption: 'Imagem 3' }
|
|
863
|
+
]
|
|
864
|
+
}, accessToken);
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
#### Enviar Sticker (Like Heart)
|
|
868
|
+
|
|
869
|
+
```typescript
|
|
870
|
+
await sdk.instagram.sendSticker({
|
|
871
|
+
token: 'sk_live_...',
|
|
872
|
+
recipientId: 'user_id',
|
|
873
|
+
stickerType: 'heart'
|
|
874
|
+
}, accessToken);
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
#### Reagir a Mensagem
|
|
878
|
+
|
|
879
|
+
```typescript
|
|
880
|
+
await sdk.instagram.reactMessage({
|
|
881
|
+
token: 'sk_live_...',
|
|
882
|
+
messageId: 'message_id',
|
|
883
|
+
reactionType: 'love'
|
|
884
|
+
}, accessToken);
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
#### Remover Reação
|
|
888
|
+
|
|
889
|
+
```typescript
|
|
890
|
+
await sdk.instagram.removeReaction({
|
|
891
|
+
token: 'sk_live_...',
|
|
892
|
+
recipientId: 'user_id',
|
|
893
|
+
messageId: 'message_id'
|
|
894
|
+
}, accessToken);
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
#### Enviar Quick Replies
|
|
898
|
+
|
|
899
|
+
```typescript
|
|
900
|
+
await sdk.instagram.sendQuickReplies({
|
|
901
|
+
token: 'sk_live_...',
|
|
902
|
+
recipientId: 'user_id',
|
|
903
|
+
message: 'Como podemos ajudar?',
|
|
904
|
+
quickReplies: [
|
|
905
|
+
{ content_type: 'text', title: 'Suporte', payload: 'SUPPORT' },
|
|
906
|
+
{ content_type: 'text', title: 'Vendas', payload: 'SALES' }
|
|
907
|
+
]
|
|
908
|
+
}, accessToken);
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
#### Enviar Template Genérico (Carrossel)
|
|
912
|
+
|
|
913
|
+
```typescript
|
|
914
|
+
await sdk.instagram.sendGenericTemplate({
|
|
915
|
+
token: 'sk_live_...',
|
|
916
|
+
recipientId: 'user_id',
|
|
917
|
+
elements: [
|
|
918
|
+
{
|
|
919
|
+
title: 'Produto 1',
|
|
920
|
+
subtitle: 'R$ 99,90',
|
|
921
|
+
image_url: 'https://example.com/product1.jpg',
|
|
922
|
+
buttons: [
|
|
923
|
+
{ type: 'web_url', title: 'Ver Mais', url: 'https://example.com/product1' },
|
|
924
|
+
{ type: 'postback', title: 'Comprar', payload: 'BUY_1' }
|
|
925
|
+
]
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
title: 'Produto 2',
|
|
929
|
+
subtitle: 'R$ 149,90',
|
|
930
|
+
image_url: 'https://example.com/product2.jpg',
|
|
931
|
+
buttons: [
|
|
932
|
+
{ type: 'web_url', title: 'Ver Mais', url: 'https://example.com/product2' },
|
|
933
|
+
{ type: 'postback', title: 'Comprar', payload: 'BUY_2' }
|
|
934
|
+
]
|
|
935
|
+
}
|
|
936
|
+
]
|
|
937
|
+
}, accessToken);
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
#### Enviar Template de Botões
|
|
941
|
+
|
|
942
|
+
```typescript
|
|
943
|
+
await sdk.instagram.sendButtonTemplate({
|
|
944
|
+
token: 'sk_live_...',
|
|
945
|
+
recipientId: 'user_id',
|
|
946
|
+
text: 'O que você gostaria de fazer?',
|
|
947
|
+
buttons: [
|
|
948
|
+
{ type: 'web_url', title: 'Visitar Site', url: 'https://example.com' },
|
|
949
|
+
{ type: 'postback', title: 'Falar com Atendente', payload: 'HUMAN_AGENT' }
|
|
950
|
+
]
|
|
951
|
+
}, accessToken);
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
#### Enviar Ação do Remetente (Typing, Seen)
|
|
955
|
+
|
|
956
|
+
```typescript
|
|
957
|
+
// Mostrar "digitando..."
|
|
958
|
+
await sdk.instagram.sendSenderAction({
|
|
959
|
+
token: 'sk_live_...',
|
|
960
|
+
recipientId: 'user_id',
|
|
961
|
+
action: 'typing_on'
|
|
962
|
+
}, accessToken);
|
|
963
|
+
|
|
964
|
+
// Parar de mostrar "digitando..."
|
|
965
|
+
await sdk.instagram.sendSenderAction({
|
|
966
|
+
token: 'sk_live_...',
|
|
967
|
+
recipientId: 'user_id',
|
|
968
|
+
action: 'typing_off'
|
|
969
|
+
}, accessToken);
|
|
970
|
+
|
|
971
|
+
// Marcar como visualizado
|
|
972
|
+
await sdk.instagram.sendSenderAction({
|
|
973
|
+
token: 'sk_live_...',
|
|
974
|
+
recipientId: 'user_id',
|
|
975
|
+
action: 'mark_seen'
|
|
976
|
+
}, accessToken);
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
#### Obter Perfil de Usuário
|
|
980
|
+
|
|
981
|
+
```typescript
|
|
982
|
+
const userProfile = await sdk.instagram.getUserProfile({
|
|
983
|
+
token: 'sk_live_...',
|
|
984
|
+
userId: '17841465415913137'
|
|
985
|
+
}, accessToken);
|
|
986
|
+
|
|
987
|
+
console.log(userProfile.data.name);
|
|
988
|
+
console.log(userProfile.data.username);
|
|
989
|
+
console.log(userProfile.data.follower_count);
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
#### Listar Publicações
|
|
993
|
+
|
|
994
|
+
```typescript
|
|
995
|
+
const posts = await sdk.instagram.listPosts({
|
|
996
|
+
token: 'sk_live_...',
|
|
997
|
+
limit: 10
|
|
998
|
+
}, accessToken);
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
#### Obter Perfil da Conta Comercial
|
|
1002
|
+
|
|
1003
|
+
```typescript
|
|
1004
|
+
const businessProfile = await sdk.instagram.getBusinessProfile({
|
|
1005
|
+
token: 'sk_live_...'
|
|
1006
|
+
}, accessToken);
|
|
1007
|
+
```
|
|
1008
|
+
|
|
471
1009
|
### Canais
|
|
472
1010
|
|
|
473
1011
|
#### Listar Canais
|
package/dist/index.d.mts
CHANGED
|
@@ -532,6 +532,14 @@ interface SharePostParams {
|
|
|
532
532
|
mediaId: string;
|
|
533
533
|
recipientId: string;
|
|
534
534
|
}
|
|
535
|
+
interface GetFacebookUserProfileParams {
|
|
536
|
+
token: string;
|
|
537
|
+
userId: string;
|
|
538
|
+
}
|
|
539
|
+
interface GetFacebookPageProfileParams {
|
|
540
|
+
token: string;
|
|
541
|
+
pageId: string;
|
|
542
|
+
}
|
|
535
543
|
interface SendInstagramPrivateReplyParams {
|
|
536
544
|
token: string;
|
|
537
545
|
commentId: string;
|
|
@@ -567,6 +575,11 @@ interface ReactInstagramMessageParams {
|
|
|
567
575
|
messageId: string;
|
|
568
576
|
reactionType: 'like' | 'love' | 'wow' | 'haha' | 'sorry' | 'anger';
|
|
569
577
|
}
|
|
578
|
+
interface RemoveInstagramReactionParams {
|
|
579
|
+
token: string;
|
|
580
|
+
recipientId: string;
|
|
581
|
+
messageId: string;
|
|
582
|
+
}
|
|
570
583
|
interface SendInstagramQuickRepliesParams {
|
|
571
584
|
token: string;
|
|
572
585
|
recipientId: string;
|
|
@@ -614,9 +627,12 @@ interface GetInstagramUserProfileParams {
|
|
|
614
627
|
}
|
|
615
628
|
interface ListInstagramPostsParams {
|
|
616
629
|
token: string;
|
|
617
|
-
userId
|
|
630
|
+
userId?: string;
|
|
618
631
|
limit?: number;
|
|
619
632
|
}
|
|
633
|
+
interface GetInstagramBusinessProfileParams {
|
|
634
|
+
token: string;
|
|
635
|
+
}
|
|
620
636
|
interface CreateWebhookParams {
|
|
621
637
|
url: string;
|
|
622
638
|
expiresInDays?: number;
|
|
@@ -661,8 +677,9 @@ declare class HttpClient {
|
|
|
661
677
|
/**
|
|
662
678
|
* Faz uma requisição DELETE
|
|
663
679
|
* @param accessToken Token de acesso (obrigatório para endpoints autenticados)
|
|
680
|
+
* @param data Dados a serem enviados no body (opcional)
|
|
664
681
|
*/
|
|
665
|
-
delete<T = any>(url: string, accessToken?: string, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
|
|
682
|
+
delete<T = any>(url: string, accessToken?: string, data?: any, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
|
|
666
683
|
/**
|
|
667
684
|
* Faz upload de arquivo
|
|
668
685
|
* @param accessToken Token de acesso (obrigatório para endpoints autenticados)
|
|
@@ -1076,6 +1093,18 @@ declare class FacebookModule {
|
|
|
1076
1093
|
* @param accessToken Token de acesso do usuário
|
|
1077
1094
|
*/
|
|
1078
1095
|
sharePost(params: SharePostParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1096
|
+
/**
|
|
1097
|
+
* Obtém perfil de um usuário do Facebook
|
|
1098
|
+
* @param params Parâmetros do perfil
|
|
1099
|
+
* @param accessToken Token de acesso do usuário
|
|
1100
|
+
*/
|
|
1101
|
+
getUserProfile(params: GetFacebookUserProfileParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Obtém informações de uma página do Facebook
|
|
1104
|
+
* @param params Parâmetros da página
|
|
1105
|
+
* @param accessToken Token de acesso do usuário
|
|
1106
|
+
*/
|
|
1107
|
+
getPageProfile(params: GetFacebookPageProfileParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1079
1108
|
}
|
|
1080
1109
|
|
|
1081
1110
|
/**
|
|
@@ -1122,11 +1151,10 @@ declare class InstagramModule {
|
|
|
1122
1151
|
reactMessage(params: ReactInstagramMessageParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1123
1152
|
/**
|
|
1124
1153
|
* Remove reação de uma mensagem
|
|
1125
|
-
* @param
|
|
1126
|
-
* @param messageId ID da mensagem
|
|
1154
|
+
* @param params Parâmetros da remoção
|
|
1127
1155
|
* @param accessToken Token de acesso do usuário
|
|
1128
1156
|
*/
|
|
1129
|
-
removeReaction(
|
|
1157
|
+
removeReaction(params: RemoveInstagramReactionParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1130
1158
|
/**
|
|
1131
1159
|
* Envia quick replies
|
|
1132
1160
|
* @param params Parâmetros dos quick replies
|
|
@@ -1152,8 +1180,23 @@ declare class InstagramModule {
|
|
|
1152
1180
|
*/
|
|
1153
1181
|
sendSenderAction(params: SendInstagramSenderActionParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1154
1182
|
/**
|
|
1155
|
-
* Obtém perfil de um usuário
|
|
1183
|
+
* Obtém perfil de um usuário do Instagram
|
|
1184
|
+
*
|
|
1185
|
+
* Obtém informações de perfil de um usuário do Instagram.
|
|
1186
|
+
*
|
|
1187
|
+
* Campos retornados:
|
|
1188
|
+
* - name: Nome do usuário
|
|
1189
|
+
* - profile_pic: URL da foto de perfil
|
|
1190
|
+
* - username: Nome de usuário
|
|
1191
|
+
* - follower_count: Número de seguidores
|
|
1192
|
+
* - is_verified: Se está verificado
|
|
1193
|
+
*
|
|
1194
|
+
* ⚠️ O usuário deve ter enviado mensagem direta para sua conta.
|
|
1195
|
+
* Não é possível obter perfil de quem apenas comentou.
|
|
1196
|
+
*
|
|
1156
1197
|
* @param params Parâmetros do perfil
|
|
1198
|
+
* @param params.token Token do canal
|
|
1199
|
+
* @param params.userId ID do usuário (IGSID)
|
|
1157
1200
|
* @param accessToken Token de acesso do usuário
|
|
1158
1201
|
*/
|
|
1159
1202
|
getUserProfile(params: GetInstagramUserProfileParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
@@ -1163,6 +1206,12 @@ declare class InstagramModule {
|
|
|
1163
1206
|
* @param accessToken Token de acesso do usuário
|
|
1164
1207
|
*/
|
|
1165
1208
|
listPosts(params: ListInstagramPostsParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Obtém perfil da conta comercial do Instagram
|
|
1211
|
+
* @param params Parâmetros do perfil
|
|
1212
|
+
* @param accessToken Token de acesso do usuário
|
|
1213
|
+
*/
|
|
1214
|
+
getBusinessProfile(params: GetInstagramBusinessProfileParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1166
1215
|
}
|
|
1167
1216
|
|
|
1168
1217
|
/**
|
|
@@ -1198,4 +1247,4 @@ declare class OficialAPISDK {
|
|
|
1198
1247
|
constructor(config: SDKConfig);
|
|
1199
1248
|
}
|
|
1200
1249
|
|
|
1201
|
-
export { type ApiResponse, type Channel, type CreatePostParams, type CreateTemplateParams, type CreateWebhookParams, type DeleteCommentParams, type DeleteTelegramMessageParams, type EditTelegramMessageParams, type GetInstagramUserProfileParams, type ListCommentsParams, type ListInstagramPostsParams, type ListPostsParams, OficialAPISDK, type ReactInstagramMessageParams, type ReactWhatsAppParams, type ReplyCommentParams, type ReplyFacebookMediaParams, type ReplyFacebookMessageParams, type ReplyWhatsAppParams, type SDKConfig, type SendFacebookButtonsParams, type SendFacebookMediaParams, type SendFacebookStickerParams, type SendFacebookTextParams, type SendInstagramButtonTemplateParams, type SendInstagramGenericTemplateParams, type SendInstagramImagesParams, type SendInstagramMediaParams, type SendInstagramPrivateReplyParams, type SendInstagramQuickRepliesParams, type SendInstagramSenderActionParams, type SendInstagramStickerParams, type SendInstagramTextParams, type SendOrderDetailsParams, type SendOrderStatusParams, type SendTelegramButtonsParams, type SendTelegramContactParams, type SendTelegramDiceParams, type SendTelegramLocationParams, type SendTelegramMediaGroupParams, type SendTelegramMediaParams, type SendTelegramPollParams, type SendTelegramReplyKeyboardParams, type SendTelegramStickerParams, type SendTelegramTextParams, type SendTelegramVenueParams, type SendTelegramVideoNoteParams, type SendTelegramVoiceParams, type SendWebChatButtonsParams, type SendWebChatCardParams, type SendWebChatCarouselParams, type SendWebChatFormParams, type SendWebChatMediaParams, type SendWebChatQuickRepliesParams, type SendWebChatTextParams, type SendWhatsAppAudioParams, type SendWhatsAppButtonsParams, type SendWhatsAppContactParams, type SendWhatsAppCtaUrlParams, type SendWhatsAppDocumentParams, type SendWhatsAppListParams, type SendWhatsAppLocationParams, type SendWhatsAppLocationRequestParams, type SendWhatsAppMediaCarouselParams, type SendWhatsAppMediaParams, type SendWhatsAppStickerParams, type SendWhatsAppTemplateParams, type SendWhatsAppTextParams, type SendWhatsAppVideoParams, type SharePostParams, type TokenResponse, type UploadMediaParams, type Webhook, OficialAPISDK as default };
|
|
1250
|
+
export { type ApiResponse, type Channel, type CreatePostParams, type CreateTemplateParams, type CreateWebhookParams, type DeleteCommentParams, type DeleteTelegramMessageParams, type EditTelegramMessageParams, type GetFacebookPageProfileParams, type GetFacebookUserProfileParams, type GetInstagramBusinessProfileParams, type GetInstagramUserProfileParams, type ListCommentsParams, type ListInstagramPostsParams, type ListPostsParams, OficialAPISDK, type ReactInstagramMessageParams, type ReactWhatsAppParams, type RemoveInstagramReactionParams, type ReplyCommentParams, type ReplyFacebookMediaParams, type ReplyFacebookMessageParams, type ReplyWhatsAppParams, type SDKConfig, type SendFacebookButtonsParams, type SendFacebookMediaParams, type SendFacebookStickerParams, type SendFacebookTextParams, type SendInstagramButtonTemplateParams, type SendInstagramGenericTemplateParams, type SendInstagramImagesParams, type SendInstagramMediaParams, type SendInstagramPrivateReplyParams, type SendInstagramQuickRepliesParams, type SendInstagramSenderActionParams, type SendInstagramStickerParams, type SendInstagramTextParams, type SendOrderDetailsParams, type SendOrderStatusParams, type SendTelegramButtonsParams, type SendTelegramContactParams, type SendTelegramDiceParams, type SendTelegramLocationParams, type SendTelegramMediaGroupParams, type SendTelegramMediaParams, type SendTelegramPollParams, type SendTelegramReplyKeyboardParams, type SendTelegramStickerParams, type SendTelegramTextParams, type SendTelegramVenueParams, type SendTelegramVideoNoteParams, type SendTelegramVoiceParams, type SendWebChatButtonsParams, type SendWebChatCardParams, type SendWebChatCarouselParams, type SendWebChatFormParams, type SendWebChatMediaParams, type SendWebChatQuickRepliesParams, type SendWebChatTextParams, type SendWhatsAppAudioParams, type SendWhatsAppButtonsParams, type SendWhatsAppContactParams, type SendWhatsAppCtaUrlParams, type SendWhatsAppDocumentParams, type SendWhatsAppListParams, type SendWhatsAppLocationParams, type SendWhatsAppLocationRequestParams, type SendWhatsAppMediaCarouselParams, type SendWhatsAppMediaParams, type SendWhatsAppStickerParams, type SendWhatsAppTemplateParams, type SendWhatsAppTextParams, type SendWhatsAppVideoParams, type SharePostParams, type TokenResponse, type UploadMediaParams, type Webhook, OficialAPISDK as default };
|