@oficialapi/sdk 9.0.7 → 9.0.9

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
@@ -1668,7 +1668,7 @@ const instagramMedia = await sdk.facebook.listPosts({
1668
1668
  ```typescript
1669
1669
  await sdk.facebook.createPost({
1670
1670
  channelToken: 'sk_live_...',
1671
- pageId: 'page_id',
1671
+ channelType: 'facebook',
1672
1672
  message: 'Novo post!',
1673
1673
  link: 'https://example.com'
1674
1674
  }, accessToken);
@@ -1702,6 +1702,7 @@ const instagramComments = await sdk.facebook.listComments({
1702
1702
  ```typescript
1703
1703
  await sdk.facebook.replyComment({
1704
1704
  channelToken: 'sk_live_...',
1705
+ channelType: 'facebook', // ou 'instagram'
1705
1706
  commentId: 'comment_id',
1706
1707
  message: 'Obrigado pelo comentário!'
1707
1708
  }, accessToken);
@@ -1712,6 +1713,7 @@ await sdk.facebook.replyComment({
1712
1713
  ```typescript
1713
1714
  await sdk.facebook.deleteComment({
1714
1715
  channelToken: 'sk_live_...',
1716
+ channelType: 'facebook', // ou 'instagram'
1715
1717
  commentId: 'comment_id'
1716
1718
  }, accessToken);
1717
1719
  ```
@@ -1721,8 +1723,10 @@ await sdk.facebook.deleteComment({
1721
1723
  ```typescript
1722
1724
  await sdk.facebook.sendText({
1723
1725
  channelToken: 'sk_live_...',
1726
+ channelType: 'facebook', // ou 'instagram'
1724
1727
  recipientId: 'user_id',
1725
- message: 'Olá!'
1728
+ message: 'Olá!',
1729
+ tags: ['HUMAN_AGENT'] // opcional, apenas para Instagram
1726
1730
  }, accessToken);
1727
1731
  ```
1728
1732
 
@@ -1731,10 +1735,12 @@ await sdk.facebook.sendText({
1731
1735
  ```typescript
1732
1736
  await sdk.facebook.sendMedia({
1733
1737
  channelToken: 'sk_live_...',
1738
+ channelType: 'facebook', // ou 'instagram'
1734
1739
  recipientId: 'user_id',
1735
1740
  fileUrl: 'https://example.com/image.jpg',
1736
1741
  type: 'image',
1737
- caption: 'Veja esta imagem!'
1742
+ caption: 'Veja esta imagem!',
1743
+ tags: ['HUMAN_AGENT'] // opcional, apenas para Instagram
1738
1744
  }, accessToken);
1739
1745
  ```
1740
1746
 
@@ -1743,12 +1749,14 @@ await sdk.facebook.sendMedia({
1743
1749
  ```typescript
1744
1750
  await sdk.facebook.sendButtons({
1745
1751
  channelToken: 'sk_live_...',
1752
+ channelType: 'facebook', // ou 'instagram'
1746
1753
  recipientId: 'user_id',
1747
1754
  message: 'Escolha uma opção:',
1748
1755
  buttons: [
1749
1756
  { type: 'web_url', title: 'Visitar Site', url: 'https://example.com' },
1750
1757
  { type: 'postback', title: 'Opção', payload: 'OPTION_1' }
1751
- ]
1758
+ ],
1759
+ tags: ['HUMAN_AGENT'] // opcional, apenas para Instagram
1752
1760
  }, accessToken);
1753
1761
  ```
1754
1762
 
@@ -1767,8 +1775,11 @@ await sdk.facebook.sendSticker({
1767
1775
  ```typescript
1768
1776
  await sdk.facebook.replyMessage({
1769
1777
  channelToken: 'sk_live_...',
1778
+ channelType: 'facebook', // ou 'instagram'
1779
+ recipientId: 'user_id',
1770
1780
  messageId: 'message_id',
1771
- message: 'Esta é uma resposta!'
1781
+ message: 'Esta é uma resposta!',
1782
+ tags: ['HUMAN_AGENT'] // opcional, apenas para Instagram
1772
1783
  }, accessToken);
1773
1784
  ```
1774
1785
 
@@ -1777,10 +1788,13 @@ await sdk.facebook.replyMessage({
1777
1788
  ```typescript
1778
1789
  await sdk.facebook.replyMedia({
1779
1790
  channelToken: 'sk_live_...',
1791
+ channelType: 'facebook', // ou 'instagram'
1792
+ recipientId: 'user_id',
1780
1793
  messageId: 'message_id',
1781
1794
  fileUrl: 'https://example.com/image.jpg',
1782
1795
  type: 'image',
1783
- caption: 'Aqui está!'
1796
+ caption: 'Aqui está!',
1797
+ tags: ['HUMAN_AGENT'] // opcional, apenas para Instagram
1784
1798
  }, accessToken);
1785
1799
  ```
1786
1800
 
@@ -2044,7 +2058,7 @@ await sdk.instagram.sendSenderAction({
2044
2058
  ```typescript
2045
2059
  const userProfile = await sdk.instagram.getUserProfile({
2046
2060
  channelToken: 'sk_live_...',
2047
- userId: '17841465415913137'
2061
+ userId: '99999999999999999'
2048
2062
  }, accessToken);
2049
2063
 
2050
2064
  console.log(userProfile.data.name);
@@ -2169,7 +2183,7 @@ const carousel = await sdk.instagram.createMediaContainer({
2169
2183
  ```typescript
2170
2184
  const status = await sdk.instagram.getContainerStatus({
2171
2185
  channelToken: 'sk_live_...',
2172
- container_id: '17841465415913137'
2186
+ container_id: '99999999999999999'
2173
2187
  }, accessToken);
2174
2188
 
2175
2189
  // Status possíveis: EXPIRED, ERROR, FINISHED, IN_PROGRESS, PUBLISHED
@@ -2186,7 +2200,7 @@ if (status.data.data.status_code === 'FINISHED') {
2186
2200
  ```typescript
2187
2201
  const published = await sdk.instagram.publishMedia({
2188
2202
  channelToken: 'sk_live_...',
2189
- creation_id: '17841465415913137' // ID retornado ao criar o contêiner
2203
+ creation_id: '99999999999999999' // ID retornado ao criar o contêiner
2190
2204
  }, accessToken);
2191
2205
 
2192
2206
  console.log(published.data.data.id); // ID da publicação criada
package/dist/index.d.mts CHANGED
@@ -38,7 +38,7 @@ interface Channel {
38
38
  id: number;
39
39
  channelToken: string;
40
40
  nome: string;
41
- channel: 'whatsapp' | 'facebook' | 'instagram' | 'webchat' | 'email' | 'telegram';
41
+ channel: "whatsapp" | "facebook" | "instagram" | "webchat" | "email" | "telegram";
42
42
  status: boolean;
43
43
  numero?: string | null;
44
44
  instagram?: {
@@ -56,7 +56,7 @@ interface SendWhatsAppMediaParams {
56
56
  channelToken: string;
57
57
  sender: string;
58
58
  fileUrl: string;
59
- type: 'image' | 'video' | 'audio' | 'document';
59
+ type: "image" | "video" | "audio" | "document";
60
60
  caption?: string;
61
61
  fileName?: string;
62
62
  }
@@ -66,25 +66,25 @@ interface SendWhatsAppTemplateParams {
66
66
  templateName: string;
67
67
  languageCode: string;
68
68
  components?: Array<{
69
- type: 'HEADER' | 'BODY' | 'BUTTONS';
69
+ type: "HEADER" | "BODY" | "BUTTONS";
70
70
  parameters?: Array<{
71
- type: 'text';
71
+ type: "text";
72
72
  text: string;
73
73
  } | {
74
- type: 'image';
74
+ type: "image";
75
75
  image: {
76
76
  link?: string;
77
77
  id?: string;
78
78
  };
79
79
  } | {
80
- type: 'document';
80
+ type: "document";
81
81
  document: {
82
82
  link?: string;
83
83
  id?: string;
84
84
  filename?: string;
85
85
  };
86
86
  } | {
87
- type: 'video';
87
+ type: "video";
88
88
  video: {
89
89
  link?: string;
90
90
  id?: string;
@@ -138,17 +138,17 @@ interface CreateTemplateParams {
138
138
  channelToken: string;
139
139
  name: string;
140
140
  language: string;
141
- category: 'MARKETING' | 'UTILITY' | 'AUTHENTICATION';
141
+ category: "MARKETING" | "UTILITY" | "AUTHENTICATION";
142
142
  components: Array<{
143
- type: 'HEADER' | 'BODY' | 'FOOTER' | 'BUTTONS';
144
- format?: 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT';
143
+ type: "HEADER" | "BODY" | "FOOTER" | "BUTTONS";
144
+ format?: "TEXT" | "IMAGE" | "VIDEO" | "DOCUMENT";
145
145
  text?: string;
146
146
  example?: {
147
147
  header_text?: string[];
148
148
  body_text?: string[][];
149
149
  };
150
150
  buttons?: Array<{
151
- type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER';
151
+ type: "QUICK_REPLY" | "URL" | "PHONE_NUMBER";
152
152
  text?: string;
153
153
  url?: string;
154
154
  phone_number?: string;
@@ -158,7 +158,7 @@ interface CreateTemplateParams {
158
158
  interface UploadMediaParams {
159
159
  channelToken: string;
160
160
  file: File | Blob | Buffer;
161
- mediaType: 'image' | 'video' | 'document';
161
+ mediaType: "image" | "video" | "document";
162
162
  filename?: string;
163
163
  }
164
164
  interface SendOrderDetailsParams {
@@ -168,7 +168,7 @@ interface SendOrderDetailsParams {
168
168
  bodyText: string;
169
169
  footerText?: string;
170
170
  reference_id: string;
171
- type: 'digital-goods' | 'physical-goods';
171
+ type: "digital-goods" | "physical-goods";
172
172
  currency: string;
173
173
  total_amount: {
174
174
  value: number;
@@ -176,7 +176,7 @@ interface SendOrderDetailsParams {
176
176
  description?: string;
177
177
  };
178
178
  order: {
179
- status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
179
+ status: "pending" | "processing" | "partially-shipped" | "shipped" | "completed" | "canceled";
180
180
  catalog_id?: string;
181
181
  items: Array<{
182
182
  retailer_id: string;
@@ -220,12 +220,12 @@ interface SendOrderDetailsParams {
220
220
  };
221
221
  };
222
222
  payment_settings?: Array<{
223
- type: 'pix_dynamic_code' | 'payment_link' | 'boleto' | 'offsite_card_pay';
223
+ type: "pix_dynamic_code" | "payment_link" | "boleto" | "offsite_card_pay";
224
224
  pix_dynamic_code?: {
225
225
  code: string;
226
226
  merchant_name: string;
227
227
  key: string;
228
- key_type: 'CPF' | 'CNPJ' | 'EMAIL' | 'PHONE' | 'EVP';
228
+ key_type: "CPF" | "CNPJ" | "EMAIL" | "PHONE" | "EVP";
229
229
  };
230
230
  payment_link?: {
231
231
  uri: string;
@@ -245,9 +245,9 @@ interface SendOrderStatusParams {
245
245
  bodyText: string;
246
246
  footerText?: string;
247
247
  reference_id: string;
248
- order_status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
248
+ order_status: "pending" | "processing" | "partially-shipped" | "shipped" | "completed" | "canceled";
249
249
  status_description?: string;
250
- payment_status?: 'pending' | 'captured' | 'failed';
250
+ payment_status?: "pending" | "captured" | "failed";
251
251
  payment_timestamp?: number;
252
252
  }
253
253
  interface SendWhatsAppAudioParams {
@@ -338,7 +338,7 @@ interface SendWhatsAppCtaUrlParams {
338
338
  buttonText: string;
339
339
  url: string;
340
340
  header?: {
341
- type: 'text' | 'image' | 'video' | 'document';
341
+ type: "text" | "image" | "video" | "document";
342
342
  text?: string;
343
343
  link?: string;
344
344
  };
@@ -350,7 +350,7 @@ interface SendWhatsAppMediaCarouselParams {
350
350
  bodyText: string;
351
351
  cards: Array<{
352
352
  cardIndex: number;
353
- headerType: 'image' | 'video';
353
+ headerType: "image" | "video";
354
354
  headerLink: string;
355
355
  bodyText: string;
356
356
  buttonText: string;
@@ -365,7 +365,7 @@ interface SendTelegramTextParams {
365
365
  channelToken: string;
366
366
  chatId: string | number;
367
367
  text: string;
368
- parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
368
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
369
369
  replyToMessageId?: number;
370
370
  disableNotification?: boolean;
371
371
  }
@@ -373,9 +373,9 @@ interface SendTelegramMediaParams {
373
373
  channelToken: string;
374
374
  chatId: string | number;
375
375
  fileUrl: string;
376
- type: 'photo' | 'video' | 'audio' | 'document' | 'voice';
376
+ type: "photo" | "video" | "audio" | "document" | "voice";
377
377
  caption?: string;
378
- parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
378
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
379
379
  replyToMessageId?: number;
380
380
  }
381
381
  interface SendTelegramButtonsParams {
@@ -390,7 +390,7 @@ interface SendTelegramButtonsParams {
390
390
  url: string;
391
391
  };
392
392
  }>>;
393
- parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
393
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
394
394
  }
395
395
  interface SendTelegramLocationParams {
396
396
  channelToken: string;
@@ -413,7 +413,7 @@ interface SendTelegramPollParams {
413
413
  question: string;
414
414
  options: string[];
415
415
  isAnonymous?: boolean;
416
- type?: 'quiz' | 'regular';
416
+ type?: "quiz" | "regular";
417
417
  correctOptionId?: number;
418
418
  }
419
419
  interface SendTelegramVenueParams {
@@ -428,7 +428,7 @@ interface SendTelegramVenueParams {
428
428
  interface SendTelegramDiceParams {
429
429
  channelToken: string;
430
430
  chatId: string | number;
431
- emoji?: '🎲' | '🎯' | '🏀' | '' | '🎳' | '🎰';
431
+ emoji?: "🎲" | "🎯" | "🏀" | "" | "🎳" | "🎰";
432
432
  }
433
433
  interface SendTelegramStickerParams {
434
434
  channelToken: string;
@@ -453,7 +453,7 @@ interface SendTelegramMediaGroupParams {
453
453
  channelToken: string;
454
454
  chatId: string | number;
455
455
  media: Array<{
456
- type: 'photo' | 'video';
456
+ type: "photo" | "video";
457
457
  media: string;
458
458
  caption?: string;
459
459
  }>;
@@ -473,7 +473,7 @@ interface EditTelegramMessageParams {
473
473
  chatId: string | number;
474
474
  messageId: number;
475
475
  text: string;
476
- parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
476
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
477
477
  }
478
478
  interface DeleteTelegramMessageParams {
479
479
  channelToken: string;
@@ -495,7 +495,7 @@ interface SendWebChatMediaParams {
495
495
  channelToken: string;
496
496
  chatId: string;
497
497
  fileUrl: string;
498
- type: 'image' | 'video' | 'audio' | 'file';
498
+ type: "image" | "video" | "audio" | "file";
499
499
  caption?: string;
500
500
  typing?: boolean;
501
501
  typingTime?: number;
@@ -510,7 +510,7 @@ interface SendWebChatCarouselParams {
510
510
  buttons?: Array<{
511
511
  id?: string;
512
512
  text: string;
513
- type: 'text' | 'url' | 'phone' | 'postback';
513
+ type: "text" | "url" | "phone" | "postback";
514
514
  value?: string;
515
515
  url?: string;
516
516
  }>;
@@ -526,7 +526,7 @@ interface SendWebChatFormParams {
526
526
  fields: Array<{
527
527
  id?: string;
528
528
  name?: string;
529
- type: 'text' | 'email' | 'number' | 'tel' | 'date' | 'select';
529
+ type: "text" | "email" | "number" | "tel" | "date" | "select";
530
530
  label: string;
531
531
  placeholder?: string;
532
532
  required?: boolean;
@@ -560,7 +560,7 @@ interface SendWebChatCardParams {
560
560
  buttons?: Array<{
561
561
  id?: string;
562
562
  text: string;
563
- type: 'text' | 'url' | 'phone' | 'postback';
563
+ type: "text" | "url" | "phone" | "postback";
564
564
  value?: string;
565
565
  url?: string;
566
566
  }>;
@@ -574,7 +574,7 @@ interface SendWebChatButtonsParams {
574
574
  buttons: Array<{
575
575
  id?: string;
576
576
  text: string;
577
- type: 'text' | 'url' | 'phone' | 'postback';
577
+ type: "text" | "url" | "phone" | "postback";
578
578
  value?: string;
579
579
  url?: string;
580
580
  }>;
@@ -583,61 +583,70 @@ interface SendWebChatButtonsParams {
583
583
  }
584
584
  interface ListPostsParams {
585
585
  channelToken: string;
586
- channelType: 'facebook' | 'instagram';
586
+ channelType: "facebook" | "instagram";
587
587
  pageId?: string;
588
588
  limit?: number;
589
589
  after?: string;
590
- type?: 'feed' | 'photos' | 'videos' | 'events' | 'media';
590
+ type?: "feed" | "photos" | "videos" | "events" | "media";
591
591
  includeComments?: boolean;
592
592
  includeReactions?: boolean;
593
593
  }
594
594
  interface ListCommentsParams {
595
595
  channelToken: string;
596
- channelType: 'facebook' | 'instagram';
596
+ channelType: "facebook" | "instagram";
597
597
  postId: string;
598
598
  limit?: number;
599
599
  after?: string;
600
- order?: 'created_time' | 'like_count';
600
+ order?: "created_time" | "like_count";
601
601
  filterUnanswered?: boolean;
602
602
  includeReplies?: boolean;
603
603
  }
604
604
  interface CreatePostParams {
605
605
  channelToken: string;
606
- pageId: string;
607
606
  message: string;
607
+ channelType: "facebook" | "instagram";
608
608
  link?: string;
609
+ mediaType?: string;
609
610
  }
610
611
  interface ReplyCommentParams {
611
612
  channelToken: string;
613
+ channelType: "facebook" | "instagram";
612
614
  commentId: string;
613
615
  message: string;
614
616
  }
615
617
  interface DeleteCommentParams {
616
618
  channelToken: string;
619
+ channelType: "facebook" | "instagram";
617
620
  commentId: string;
618
621
  }
619
622
  interface SendFacebookTextParams {
620
623
  channelToken: string;
624
+ channelType: "facebook" | "instagram";
621
625
  recipientId: string;
622
626
  message: string;
627
+ tags?: string[];
623
628
  }
624
629
  interface SendFacebookMediaParams {
625
630
  channelToken: string;
631
+ channelType: "facebook" | "instagram";
626
632
  recipientId: string;
627
633
  fileUrl: string;
628
- type: 'image' | 'video' | 'audio' | 'file';
634
+ type: "image" | "video" | "audio" | "file";
629
635
  caption?: string;
636
+ tags?: string[];
630
637
  }
631
638
  interface SendFacebookButtonsParams {
632
639
  channelToken: string;
640
+ channelType: "facebook" | "instagram";
633
641
  recipientId: string;
634
642
  message: string;
635
643
  buttons: Array<{
636
- type: 'web_url' | 'postback';
644
+ type: "web_url" | "postback";
637
645
  title: string;
638
646
  url?: string;
639
647
  payload?: string;
640
648
  }>;
649
+ tags?: string[];
641
650
  }
642
651
  interface SendFacebookStickerParams {
643
652
  channelToken: string;
@@ -646,15 +655,21 @@ interface SendFacebookStickerParams {
646
655
  }
647
656
  interface ReplyFacebookMessageParams {
648
657
  channelToken: string;
658
+ channelType: "facebook" | "instagram";
659
+ recipientId: string;
649
660
  messageId: string;
650
661
  message: string;
662
+ tags?: string[];
651
663
  }
652
664
  interface ReplyFacebookMediaParams {
653
665
  channelToken: string;
666
+ channelType: "facebook" | "instagram";
667
+ recipientId: string;
654
668
  messageId: string;
655
669
  fileUrl: string;
656
- type: 'image' | 'video' | 'audio' | 'file';
670
+ type: "image" | "video" | "audio" | "file";
657
671
  caption?: string;
672
+ tags?: string[];
658
673
  }
659
674
  interface SharePostParams {
660
675
  channelToken: string;
@@ -688,7 +703,7 @@ interface SendInstagramMediaParams {
688
703
  channelToken: string;
689
704
  recipientId: string;
690
705
  attachment: {
691
- type: 'image' | 'video' | 'audio' | 'file';
706
+ type: "image" | "video" | "audio" | "file";
692
707
  url: string;
693
708
  };
694
709
  tags?: string[];
@@ -704,12 +719,12 @@ interface SendInstagramImagesParams {
704
719
  interface SendInstagramStickerParams {
705
720
  channelToken: string;
706
721
  recipientId: string;
707
- stickerType: 'like' | 'heart';
722
+ stickerType: "like" | "heart";
708
723
  }
709
724
  interface ReactInstagramMessageParams {
710
725
  channelToken: string;
711
726
  messageId: string;
712
- reactionType: 'like' | 'love' | 'wow' | 'haha' | 'sorry' | 'anger';
727
+ reactionType: "like" | "love" | "wow" | "haha" | "sorry" | "anger";
713
728
  }
714
729
  interface RemoveInstagramReactionParams {
715
730
  channelToken: string;
@@ -721,7 +736,7 @@ interface SendInstagramQuickRepliesParams {
721
736
  recipientId: string;
722
737
  message: string;
723
738
  quickReplies: Array<{
724
- content_type: 'text';
739
+ content_type: "text";
725
740
  title: string;
726
741
  payload: string;
727
742
  }>;
@@ -734,7 +749,7 @@ interface SendInstagramGenericTemplateParams {
734
749
  subtitle?: string;
735
750
  image_url?: string;
736
751
  buttons?: Array<{
737
- type: 'web_url' | 'postback';
752
+ type: "web_url" | "postback";
738
753
  title: string;
739
754
  url?: string;
740
755
  payload?: string;
@@ -746,7 +761,7 @@ interface SendInstagramButtonTemplateParams {
746
761
  recipientId: string;
747
762
  text: string;
748
763
  buttons: Array<{
749
- type: 'web_url' | 'postback';
764
+ type: "web_url" | "postback";
750
765
  title: string;
751
766
  url?: string;
752
767
  payload?: string;
@@ -755,7 +770,7 @@ interface SendInstagramButtonTemplateParams {
755
770
  interface SendInstagramSenderActionParams {
756
771
  channelToken: string;
757
772
  recipientId: string;
758
- action: 'typing_on' | 'typing_off' | 'mark_seen';
773
+ action: "typing_on" | "typing_off" | "mark_seen";
759
774
  }
760
775
  interface GetInstagramUserProfileParams {
761
776
  channelToken: string;
@@ -773,8 +788,8 @@ interface DownloadInstagramMediaParams {
773
788
  channelToken: string;
774
789
  url: string;
775
790
  }
776
- type InstagramPublishMediaType = 'IMAGE' | 'VIDEO' | 'REELS' | 'STORIES' | 'CAROUSEL';
777
- type GraduationStrategy = 'MANUAL' | 'SS_PERFORMANCE';
791
+ type InstagramPublishMediaType = "IMAGE" | "VIDEO" | "REELS" | "STORIES" | "CAROUSEL";
792
+ type GraduationStrategy = "MANUAL" | "SS_PERFORMANCE";
778
793
  interface CreateInstagramMediaContainerParams {
779
794
  channelToken: string;
780
795
  image_url?: string;