@oficialapi/sdk 9.0.6 → 9.0.8
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 +30 -3
- package/dist/index.d.mts +58 -47
- package/dist/index.d.ts +58 -47
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +61 -61
package/README.md
CHANGED
|
@@ -1642,10 +1642,24 @@ await sdk.webchat.sendButtons({
|
|
|
1642
1642
|
#### Listar Posts
|
|
1643
1643
|
|
|
1644
1644
|
```typescript
|
|
1645
|
+
// Listar posts do Facebook
|
|
1645
1646
|
const posts = await sdk.facebook.listPosts({
|
|
1646
1647
|
channelToken: 'sk_live_...',
|
|
1647
|
-
|
|
1648
|
-
limit: 10
|
|
1648
|
+
channelType: 'facebook',
|
|
1649
|
+
limit: 10,
|
|
1650
|
+
type: 'feed', // 'feed' | 'photos' | 'videos' | 'events'
|
|
1651
|
+
includeComments: false,
|
|
1652
|
+
includeReactions: false
|
|
1653
|
+
}, accessToken);
|
|
1654
|
+
|
|
1655
|
+
// Listar mídias do Instagram
|
|
1656
|
+
const instagramMedia = await sdk.facebook.listPosts({
|
|
1657
|
+
channelToken: 'sk_live_...',
|
|
1658
|
+
channelType: 'instagram',
|
|
1659
|
+
limit: 10,
|
|
1660
|
+
type: 'media',
|
|
1661
|
+
includeComments: false,
|
|
1662
|
+
includeReactions: false
|
|
1649
1663
|
}, accessToken);
|
|
1650
1664
|
```
|
|
1651
1665
|
|
|
@@ -1654,7 +1668,7 @@ const posts = await sdk.facebook.listPosts({
|
|
|
1654
1668
|
```typescript
|
|
1655
1669
|
await sdk.facebook.createPost({
|
|
1656
1670
|
channelToken: 'sk_live_...',
|
|
1657
|
-
|
|
1671
|
+
channelType: 'facebook',
|
|
1658
1672
|
message: 'Novo post!',
|
|
1659
1673
|
link: 'https://example.com'
|
|
1660
1674
|
}, accessToken);
|
|
@@ -1663,9 +1677,22 @@ await sdk.facebook.createPost({
|
|
|
1663
1677
|
#### Listar Comentários
|
|
1664
1678
|
|
|
1665
1679
|
```typescript
|
|
1680
|
+
// Listar comentários do Facebook
|
|
1666
1681
|
const comments = await sdk.facebook.listComments({
|
|
1667
1682
|
channelToken: 'sk_live_...',
|
|
1683
|
+
channelType: 'facebook',
|
|
1668
1684
|
postId: 'post_id',
|
|
1685
|
+
limit: 20,
|
|
1686
|
+
order: 'created_time', // 'created_time' | 'like_count'
|
|
1687
|
+
filterUnanswered: false,
|
|
1688
|
+
includeReplies: false
|
|
1689
|
+
}, accessToken);
|
|
1690
|
+
|
|
1691
|
+
// Listar comentários do Instagram
|
|
1692
|
+
const instagramComments = await sdk.facebook.listComments({
|
|
1693
|
+
channelToken: 'sk_live_...',
|
|
1694
|
+
channelType: 'instagram',
|
|
1695
|
+
postId: 'media_id',
|
|
1669
1696
|
limit: 20
|
|
1670
1697
|
}, accessToken);
|
|
1671
1698
|
```
|
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:
|
|
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:
|
|
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:
|
|
69
|
+
type: "HEADER" | "BODY" | "BUTTONS";
|
|
70
70
|
parameters?: Array<{
|
|
71
|
-
type:
|
|
71
|
+
type: "text";
|
|
72
72
|
text: string;
|
|
73
73
|
} | {
|
|
74
|
-
type:
|
|
74
|
+
type: "image";
|
|
75
75
|
image: {
|
|
76
76
|
link?: string;
|
|
77
77
|
id?: string;
|
|
78
78
|
};
|
|
79
79
|
} | {
|
|
80
|
-
type:
|
|
80
|
+
type: "document";
|
|
81
81
|
document: {
|
|
82
82
|
link?: string;
|
|
83
83
|
id?: string;
|
|
84
84
|
filename?: string;
|
|
85
85
|
};
|
|
86
86
|
} | {
|
|
87
|
-
type:
|
|
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:
|
|
141
|
+
category: "MARKETING" | "UTILITY" | "AUTHENTICATION";
|
|
142
142
|
components: Array<{
|
|
143
|
-
type:
|
|
144
|
-
format?:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
248
|
+
order_status: "pending" | "processing" | "partially-shipped" | "shipped" | "completed" | "canceled";
|
|
249
249
|
status_description?: string;
|
|
250
|
-
payment_status?:
|
|
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:
|
|
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:
|
|
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?:
|
|
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:
|
|
376
|
+
type: "photo" | "video" | "audio" | "document" | "voice";
|
|
377
377
|
caption?: string;
|
|
378
|
-
parseMode?:
|
|
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?:
|
|
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?:
|
|
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:
|
|
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?:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
577
|
+
type: "text" | "url" | "phone" | "postback";
|
|
578
578
|
value?: string;
|
|
579
579
|
url?: string;
|
|
580
580
|
}>;
|
|
@@ -583,19 +583,30 @@ interface SendWebChatButtonsParams {
|
|
|
583
583
|
}
|
|
584
584
|
interface ListPostsParams {
|
|
585
585
|
channelToken: string;
|
|
586
|
-
|
|
586
|
+
channelType: "facebook" | "instagram";
|
|
587
|
+
pageId?: string;
|
|
587
588
|
limit?: number;
|
|
589
|
+
after?: string;
|
|
590
|
+
type?: "feed" | "photos" | "videos" | "events" | "media";
|
|
591
|
+
includeComments?: boolean;
|
|
592
|
+
includeReactions?: boolean;
|
|
588
593
|
}
|
|
589
594
|
interface ListCommentsParams {
|
|
590
595
|
channelToken: string;
|
|
596
|
+
channelType: "facebook" | "instagram";
|
|
591
597
|
postId: string;
|
|
592
598
|
limit?: number;
|
|
599
|
+
after?: string;
|
|
600
|
+
order?: "created_time" | "like_count";
|
|
601
|
+
filterUnanswered?: boolean;
|
|
602
|
+
includeReplies?: boolean;
|
|
593
603
|
}
|
|
594
604
|
interface CreatePostParams {
|
|
595
605
|
channelToken: string;
|
|
596
|
-
pageId: string;
|
|
597
606
|
message: string;
|
|
607
|
+
channelType: "facebook" | "instagram";
|
|
598
608
|
link?: string;
|
|
609
|
+
mediaType?: string;
|
|
599
610
|
}
|
|
600
611
|
interface ReplyCommentParams {
|
|
601
612
|
channelToken: string;
|
|
@@ -615,7 +626,7 @@ interface SendFacebookMediaParams {
|
|
|
615
626
|
channelToken: string;
|
|
616
627
|
recipientId: string;
|
|
617
628
|
fileUrl: string;
|
|
618
|
-
type:
|
|
629
|
+
type: "image" | "video" | "audio" | "file";
|
|
619
630
|
caption?: string;
|
|
620
631
|
}
|
|
621
632
|
interface SendFacebookButtonsParams {
|
|
@@ -623,7 +634,7 @@ interface SendFacebookButtonsParams {
|
|
|
623
634
|
recipientId: string;
|
|
624
635
|
message: string;
|
|
625
636
|
buttons: Array<{
|
|
626
|
-
type:
|
|
637
|
+
type: "web_url" | "postback";
|
|
627
638
|
title: string;
|
|
628
639
|
url?: string;
|
|
629
640
|
payload?: string;
|
|
@@ -643,7 +654,7 @@ interface ReplyFacebookMediaParams {
|
|
|
643
654
|
channelToken: string;
|
|
644
655
|
messageId: string;
|
|
645
656
|
fileUrl: string;
|
|
646
|
-
type:
|
|
657
|
+
type: "image" | "video" | "audio" | "file";
|
|
647
658
|
caption?: string;
|
|
648
659
|
}
|
|
649
660
|
interface SharePostParams {
|
|
@@ -678,7 +689,7 @@ interface SendInstagramMediaParams {
|
|
|
678
689
|
channelToken: string;
|
|
679
690
|
recipientId: string;
|
|
680
691
|
attachment: {
|
|
681
|
-
type:
|
|
692
|
+
type: "image" | "video" | "audio" | "file";
|
|
682
693
|
url: string;
|
|
683
694
|
};
|
|
684
695
|
tags?: string[];
|
|
@@ -694,12 +705,12 @@ interface SendInstagramImagesParams {
|
|
|
694
705
|
interface SendInstagramStickerParams {
|
|
695
706
|
channelToken: string;
|
|
696
707
|
recipientId: string;
|
|
697
|
-
stickerType:
|
|
708
|
+
stickerType: "like" | "heart";
|
|
698
709
|
}
|
|
699
710
|
interface ReactInstagramMessageParams {
|
|
700
711
|
channelToken: string;
|
|
701
712
|
messageId: string;
|
|
702
|
-
reactionType:
|
|
713
|
+
reactionType: "like" | "love" | "wow" | "haha" | "sorry" | "anger";
|
|
703
714
|
}
|
|
704
715
|
interface RemoveInstagramReactionParams {
|
|
705
716
|
channelToken: string;
|
|
@@ -711,7 +722,7 @@ interface SendInstagramQuickRepliesParams {
|
|
|
711
722
|
recipientId: string;
|
|
712
723
|
message: string;
|
|
713
724
|
quickReplies: Array<{
|
|
714
|
-
content_type:
|
|
725
|
+
content_type: "text";
|
|
715
726
|
title: string;
|
|
716
727
|
payload: string;
|
|
717
728
|
}>;
|
|
@@ -724,7 +735,7 @@ interface SendInstagramGenericTemplateParams {
|
|
|
724
735
|
subtitle?: string;
|
|
725
736
|
image_url?: string;
|
|
726
737
|
buttons?: Array<{
|
|
727
|
-
type:
|
|
738
|
+
type: "web_url" | "postback";
|
|
728
739
|
title: string;
|
|
729
740
|
url?: string;
|
|
730
741
|
payload?: string;
|
|
@@ -736,7 +747,7 @@ interface SendInstagramButtonTemplateParams {
|
|
|
736
747
|
recipientId: string;
|
|
737
748
|
text: string;
|
|
738
749
|
buttons: Array<{
|
|
739
|
-
type:
|
|
750
|
+
type: "web_url" | "postback";
|
|
740
751
|
title: string;
|
|
741
752
|
url?: string;
|
|
742
753
|
payload?: string;
|
|
@@ -745,7 +756,7 @@ interface SendInstagramButtonTemplateParams {
|
|
|
745
756
|
interface SendInstagramSenderActionParams {
|
|
746
757
|
channelToken: string;
|
|
747
758
|
recipientId: string;
|
|
748
|
-
action:
|
|
759
|
+
action: "typing_on" | "typing_off" | "mark_seen";
|
|
749
760
|
}
|
|
750
761
|
interface GetInstagramUserProfileParams {
|
|
751
762
|
channelToken: string;
|
|
@@ -763,8 +774,8 @@ interface DownloadInstagramMediaParams {
|
|
|
763
774
|
channelToken: string;
|
|
764
775
|
url: string;
|
|
765
776
|
}
|
|
766
|
-
type InstagramPublishMediaType =
|
|
767
|
-
type GraduationStrategy =
|
|
777
|
+
type InstagramPublishMediaType = "IMAGE" | "VIDEO" | "REELS" | "STORIES" | "CAROUSEL";
|
|
778
|
+
type GraduationStrategy = "MANUAL" | "SS_PERFORMANCE";
|
|
768
779
|
interface CreateInstagramMediaContainerParams {
|
|
769
780
|
channelToken: string;
|
|
770
781
|
image_url?: string;
|