@blckrose/baileys 1.0.5 → 1.1.5
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 +1099 -0
- package/lib/Defaults/index.js +4 -2
- package/lib/Signal/libsignal.js +42 -7
- package/lib/Socket/chats.js +102 -6
- package/lib/Socket/groups.js +138 -6
- package/lib/Socket/messages-recv.js +197 -3
- package/lib/Socket/messages-send.js +524 -20
- package/lib/Socket/newsletter.js +40 -1
- package/lib/Socket/socket.js +3 -1
- package/lib/Types/Newsletter.js +2 -0
- package/lib/Utils/messages-media.js +235 -134
- package/lib/Utils/messages.js +371 -65
- package/lib/index.js +18 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -100,16 +100,45 @@ import makeWASocket from '@blckrose/baileys'
|
|
|
100
100
|
- [Mention User](#mention-user-works-with-most-types)
|
|
101
101
|
- [Forward Messages](#forward-messages)
|
|
102
102
|
- [Location Message](#location-message)
|
|
103
|
+
- [Live Location Message](#live-location-message)
|
|
103
104
|
- [Contact Message](#contact-message)
|
|
104
105
|
- [Reaction Message](#reaction-message)
|
|
105
106
|
- [Pin Message](#pin-message)
|
|
107
|
+
- [Keep Message](#keep-message)
|
|
106
108
|
- [Poll Message](#poll-message)
|
|
109
|
+
- [Poll Result Message](#poll-result-message)
|
|
110
|
+
- [Call Message](#call-message)
|
|
111
|
+
- [Event Message](#event-message)
|
|
112
|
+
- [Order Message](#order-message)
|
|
113
|
+
- [Product Message](#product-message)
|
|
114
|
+
- [Payment Message](#payment-message)
|
|
115
|
+
- [Payment Invite Message](#payment-invite-message)
|
|
116
|
+
- [Admin Invite Message](#admin-invite-message)
|
|
117
|
+
- [Group Invite Message](#group-invite-message)
|
|
118
|
+
- [Sticker Pack Message](#sticker-pack-message)
|
|
119
|
+
- [Share Phone Number Message](#share-phone-number-message)
|
|
120
|
+
- [Request Phone Number Message](#request-phone-number-message)
|
|
121
|
+
- [Buttons Reply Message](#buttons-reply-message)
|
|
122
|
+
- [Buttons Message](#buttons-message)
|
|
123
|
+
- [Buttons List Message](#buttons-list-message)
|
|
124
|
+
- [Buttons Product List Message](#buttons-product-list-message)
|
|
125
|
+
- [Buttons Cards Message](#buttons-cards-message)
|
|
126
|
+
- [Buttons Template Message](#buttons-template-message)
|
|
127
|
+
- [Buttons Interactive Message](#buttons-interactive-message)
|
|
128
|
+
- [Buttons Interactive Message PIX](#buttons-interactive-message-pix)
|
|
129
|
+
- [Buttons Interactive Message PAY](#buttons-interactive-message-pay)
|
|
130
|
+
- [Status Mentions Message](#status-mentions-message)
|
|
131
|
+
- [Shop Message](#shop-message)
|
|
132
|
+
- [Collection Message](#collection-message)
|
|
133
|
+
- [AI Icon Feature](#ai-icon-feature)
|
|
107
134
|
- [Sending with Link Preview](#sending-messages-with-link-previews)
|
|
108
135
|
- [Media Messages](#media-messages)
|
|
109
136
|
- [Gif Message](#gif-message)
|
|
110
137
|
- [Video Message](#video-message)
|
|
111
138
|
- [Audio Message](#audio-message)
|
|
112
139
|
- [Image Message](#image-message)
|
|
140
|
+
- [Album Message](#album-message)
|
|
141
|
+
- [Ptv Video Message](#ptv-video-message)
|
|
113
142
|
- [ViewOnce Message](#view-once-message)
|
|
114
143
|
- [Modify Messages](#modify-messages)
|
|
115
144
|
- [Delete Messages (for everyone)](#deleting-messages-for-everyone)
|
|
@@ -130,6 +159,7 @@ import makeWASocket from '@blckrose/baileys'
|
|
|
130
159
|
- [Delete a Chat](#delete-a-chat)
|
|
131
160
|
- [Star/Unstar a Message](#starunstar-a-message)
|
|
132
161
|
- [Disappearing Messages](#disappearing-messages)
|
|
162
|
+
- [Clear Messages](#clear-messages)
|
|
133
163
|
- [User Querys](#user-querys)
|
|
134
164
|
- [Check If ID Exists in Whatsapp](#check-if-id-exists-in-whatsapp)
|
|
135
165
|
- [Query Chat History (groups too)](#query-chat-history-groups-too)
|
|
@@ -370,6 +400,46 @@ async function connectToWhatsApp () {
|
|
|
370
400
|
connectToWhatsApp()
|
|
371
401
|
```
|
|
372
402
|
|
|
403
|
+
### For example if you use useSingleFileAuthState and useMongoFileAuthState
|
|
404
|
+
```ts
|
|
405
|
+
import makeWASocket, { useSingleFileAuthState, useMongoFileAuthState } from '@blckrose/baileys'
|
|
406
|
+
|
|
407
|
+
// Single Auth
|
|
408
|
+
const { state, saveState } = await useSingleFileAuthState('./auth_info_baileys.json')
|
|
409
|
+
const sock = makeWASocket({
|
|
410
|
+
auth: state,
|
|
411
|
+
printQRInTerminal: true
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
sock.ev.on('creds.update', saveState)
|
|
415
|
+
|
|
416
|
+
// Mongo Auth
|
|
417
|
+
import { MongoClient } from "mongodb"
|
|
418
|
+
|
|
419
|
+
const connectAuth = async() => {
|
|
420
|
+
global.client = new MongoClient('mongoURL')
|
|
421
|
+
global.client.connect(err => {
|
|
422
|
+
if (err) {
|
|
423
|
+
console.warn("Warning: MongoDB link is invalid or cannot be connected.")
|
|
424
|
+
} else {
|
|
425
|
+
console.log('Successfully Connected To MongoDB Server')
|
|
426
|
+
}
|
|
427
|
+
})
|
|
428
|
+
await client.connect()
|
|
429
|
+
const collection = client.db("@blckrose").collection("sessions")
|
|
430
|
+
return collection
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const Authentication = await connectAuth()
|
|
434
|
+
const { state, saveCreds } = await useMongoFileAuthState(Authentication)
|
|
435
|
+
const sock = makeWASocket({
|
|
436
|
+
auth: state,
|
|
437
|
+
printQRInTerminal: true
|
|
438
|
+
})
|
|
439
|
+
|
|
440
|
+
sock.ev.on('creds.update', saveCreds)
|
|
441
|
+
```
|
|
442
|
+
|
|
373
443
|
> [!IMPORTANT]
|
|
374
444
|
> In `messages.upsert` it's recommended to use a loop like `for (const message of event.messages)` to handle all messages in array
|
|
375
445
|
|
|
@@ -454,6 +524,15 @@ The store also provides some simple functions such as `loadMessages` that utiliz
|
|
|
454
524
|
|
|
455
525
|
## Utility Functions
|
|
456
526
|
|
|
527
|
+
### Resize Image
|
|
528
|
+
```ts
|
|
529
|
+
// Resize an image (Buffer, URL, or stream) to given dimensions
|
|
530
|
+
const resized = await sock.resize('https://example.com/image.jpg', 320, 320)
|
|
531
|
+
// or
|
|
532
|
+
const resized = await sock.resize(buffer, 320, 320)
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
|
|
457
536
|
- `getContentType`, returns the content type for any message
|
|
458
537
|
- `getDevice`, returns the device from message
|
|
459
538
|
- `makeCacheableSignalKeyStore`, make auth store more fast
|
|
@@ -516,6 +595,19 @@ await sock.sendMessage(
|
|
|
516
595
|
}
|
|
517
596
|
)
|
|
518
597
|
```
|
|
598
|
+
#### Live Location Message
|
|
599
|
+
```ts
|
|
600
|
+
await sock.sendMessage(
|
|
601
|
+
jid,
|
|
602
|
+
{
|
|
603
|
+
location: {
|
|
604
|
+
degreesLatitude: 24.121231,
|
|
605
|
+
degreesLongitude: 55.1121221
|
|
606
|
+
},
|
|
607
|
+
live: true
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
```
|
|
519
611
|
#### Contact Message
|
|
520
612
|
```ts
|
|
521
613
|
const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
|
|
@@ -574,6 +666,19 @@ await sock.sendMessage(
|
|
|
574
666
|
)
|
|
575
667
|
```
|
|
576
668
|
|
|
669
|
+
### Keep Message
|
|
670
|
+
```ts
|
|
671
|
+
await sock.sendMessage(
|
|
672
|
+
jid,
|
|
673
|
+
{
|
|
674
|
+
keep: {
|
|
675
|
+
key: Key,
|
|
676
|
+
type: 1 // or 2
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
)
|
|
680
|
+
```
|
|
681
|
+
|
|
577
682
|
#### Poll Message
|
|
578
683
|
```ts
|
|
579
684
|
await sock.sendMessage(
|
|
@@ -589,6 +694,956 @@ await sock.sendMessage(
|
|
|
589
694
|
)
|
|
590
695
|
```
|
|
591
696
|
|
|
697
|
+
#### Poll Result Message
|
|
698
|
+
```ts
|
|
699
|
+
await sock.sendMessage(
|
|
700
|
+
jid,
|
|
701
|
+
{
|
|
702
|
+
pollResult: {
|
|
703
|
+
name: 'Hi',
|
|
704
|
+
values: [
|
|
705
|
+
[
|
|
706
|
+
'Option 1',
|
|
707
|
+
1000
|
|
708
|
+
],
|
|
709
|
+
[
|
|
710
|
+
'Option 2',
|
|
711
|
+
2000
|
|
712
|
+
]
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
)
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
### Call Message
|
|
720
|
+
```ts
|
|
721
|
+
await sock.sendMessage(
|
|
722
|
+
jid,
|
|
723
|
+
{
|
|
724
|
+
call: {
|
|
725
|
+
name: 'Hay',
|
|
726
|
+
type: 1 // 2 for video
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
)
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
### Event Message
|
|
733
|
+
```ts
|
|
734
|
+
await sock.sendMessage(
|
|
735
|
+
jid,
|
|
736
|
+
{
|
|
737
|
+
event: {
|
|
738
|
+
isCanceled: false, // or true
|
|
739
|
+
name: 'holiday together!',
|
|
740
|
+
description: 'who wants to come along?',
|
|
741
|
+
location: {
|
|
742
|
+
degreesLatitude: 24.121231,
|
|
743
|
+
degreesLongitude: 55.1121221,
|
|
744
|
+
name: 'name'
|
|
745
|
+
},
|
|
746
|
+
call: 'audio', // or 'video'
|
|
747
|
+
startTime: number,
|
|
748
|
+
endTime: number,
|
|
749
|
+
extraGuestsAllowed: true // or false
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
### Order Message
|
|
756
|
+
```ts
|
|
757
|
+
await sock.sendMessage(
|
|
758
|
+
jid,
|
|
759
|
+
{
|
|
760
|
+
order: {
|
|
761
|
+
orderId: '574xxx',
|
|
762
|
+
thumbnail: 'your_thumbnail',
|
|
763
|
+
itemCount: 'your_count',
|
|
764
|
+
status: 'your_status', // INQUIRY || ACCEPTED || DECLINED
|
|
765
|
+
surface: 'CATALOG',
|
|
766
|
+
message: 'your_caption',
|
|
767
|
+
orderTitle: "your_title",
|
|
768
|
+
sellerJid: 'your_jid',
|
|
769
|
+
token: 'your_token',
|
|
770
|
+
totalAmount1000: 'your_amount',
|
|
771
|
+
totalCurrencyCode: 'IDR'
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
)
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
### Product Message
|
|
778
|
+
```ts
|
|
779
|
+
await sock.sendMessage(
|
|
780
|
+
jid,
|
|
781
|
+
{
|
|
782
|
+
product: {
|
|
783
|
+
productImage: { // for using buffer >> productImage: your_buffer
|
|
784
|
+
url: your_url
|
|
785
|
+
},
|
|
786
|
+
productId: 'your_id',
|
|
787
|
+
title: 'your_title',
|
|
788
|
+
description: 'your_description',
|
|
789
|
+
currencyCode: 'IDR',
|
|
790
|
+
priceAmount1000: 'your_amount',
|
|
791
|
+
retailerId: 'your_reid', // optional use if needed
|
|
792
|
+
url: 'your_url', // optional use if needed
|
|
793
|
+
productImageCount: 'your_imageCount',
|
|
794
|
+
firstImageId: 'your_image', // optional use if needed
|
|
795
|
+
salePriceAmount1000: 'your_priceSale',
|
|
796
|
+
signedUrl: 'your_url' // optional use if needed
|
|
797
|
+
},
|
|
798
|
+
businessOwnerJid: 'your_jid'
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
### Payment Message
|
|
804
|
+
```ts
|
|
805
|
+
await sock.sendMessage(
|
|
806
|
+
jid,
|
|
807
|
+
{
|
|
808
|
+
payment: {
|
|
809
|
+
note: 'Hi!',
|
|
810
|
+
currency: 'IDR', // optional
|
|
811
|
+
offset: 0, // optional
|
|
812
|
+
amount: '10000', // optional
|
|
813
|
+
expiry: 0, // optional
|
|
814
|
+
from: '628xxxx@s.whatsapp.net', // optional
|
|
815
|
+
image: { // optional
|
|
816
|
+
placeholderArgb: "your_background", // optional
|
|
817
|
+
textArgb: "your_text", // optional
|
|
818
|
+
subtextArgb: "your_subtext" // optional
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
#### Payment Invite Message
|
|
826
|
+
```ts
|
|
827
|
+
await sock.sendMessage(
|
|
828
|
+
id,
|
|
829
|
+
{
|
|
830
|
+
paymentInvite: {
|
|
831
|
+
type: number, // 1 || 2 || 3
|
|
832
|
+
expiry: 0
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
)
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
### Admin Invite Message
|
|
839
|
+
```ts
|
|
840
|
+
await sock.sendMessage(
|
|
841
|
+
jid,
|
|
842
|
+
{
|
|
843
|
+
adminInvite: {
|
|
844
|
+
jid: '123xxx@newsletter',
|
|
845
|
+
name: 'newsletter_name',
|
|
846
|
+
caption: 'Please be my channel admin',
|
|
847
|
+
expiration: 86400,
|
|
848
|
+
jpegThumbnail: Buffer // optional
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
)
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
### Group Invite Message
|
|
855
|
+
```ts
|
|
856
|
+
await sock.sendMessage(
|
|
857
|
+
jid,
|
|
858
|
+
{
|
|
859
|
+
groupInvite: {
|
|
860
|
+
jid: '123xxx@g.us',
|
|
861
|
+
name: 'group_name',
|
|
862
|
+
caption: 'Please Join My Whatsapp Group',
|
|
863
|
+
code: 'code_invite',
|
|
864
|
+
expiration: 86400,
|
|
865
|
+
jpegThumbnail: Buffer, // optional
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
)
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
### Sticker Pack Message
|
|
872
|
+
```ts
|
|
873
|
+
// I don't know why the sticker doesn't appear
|
|
874
|
+
await sock.sendMessage(
|
|
875
|
+
jid,
|
|
876
|
+
{
|
|
877
|
+
stickerPack: {
|
|
878
|
+
name: 'Hiii',
|
|
879
|
+
publisher: 'By blckrose',
|
|
880
|
+
description: 'Hello',
|
|
881
|
+
cover: Buffer, // Image buffer
|
|
882
|
+
stickers: [{
|
|
883
|
+
sticker: { url: 'https://example.com/1234kjd.webp' },
|
|
884
|
+
emojis: ['❤'], // optional
|
|
885
|
+
accessibilityLabel: '', // optional
|
|
886
|
+
isLottie: Boolean, // optional
|
|
887
|
+
isAnimated: Boolean // optional
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
sticker: Buffer,
|
|
891
|
+
emojis: ['❤'], // optional
|
|
892
|
+
accessibilityLabel: '', // optional
|
|
893
|
+
isLottie: Boolean, // optional
|
|
894
|
+
isAnimated: Boolean // optional
|
|
895
|
+
}]
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
)
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
### Share Phone Number Message
|
|
902
|
+
```ts
|
|
903
|
+
await sock.sendMessage(
|
|
904
|
+
jid,
|
|
905
|
+
{
|
|
906
|
+
sharePhoneNumber: {
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
### Request Phone Number Message
|
|
913
|
+
```ts
|
|
914
|
+
await sock.sendMessage(
|
|
915
|
+
jid,
|
|
916
|
+
{
|
|
917
|
+
requestPhoneNumber: {
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
)
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
### Buttons Reply Message
|
|
924
|
+
```ts
|
|
925
|
+
// List
|
|
926
|
+
await sock.sendMessage(
|
|
927
|
+
jid,
|
|
928
|
+
{
|
|
929
|
+
buttonReply: {
|
|
930
|
+
name: 'Hii',
|
|
931
|
+
description: 'description',
|
|
932
|
+
rowId: 'ID'
|
|
933
|
+
},
|
|
934
|
+
type: 'list'
|
|
935
|
+
}
|
|
936
|
+
)
|
|
937
|
+
// Plain
|
|
938
|
+
await sock.sendMessage(
|
|
939
|
+
jid,
|
|
940
|
+
{
|
|
941
|
+
buttonReply: {
|
|
942
|
+
displayText: 'Hii',
|
|
943
|
+
id: 'ID'
|
|
944
|
+
},
|
|
945
|
+
type: 'plain'
|
|
946
|
+
}
|
|
947
|
+
)
|
|
948
|
+
|
|
949
|
+
// Template
|
|
950
|
+
await sock.sendMessage(
|
|
951
|
+
jid,
|
|
952
|
+
{
|
|
953
|
+
buttonReply: {
|
|
954
|
+
displayText: 'Hii',
|
|
955
|
+
id: 'ID',
|
|
956
|
+
index: 'number'
|
|
957
|
+
},
|
|
958
|
+
type: 'template'
|
|
959
|
+
}
|
|
960
|
+
)
|
|
961
|
+
|
|
962
|
+
// Interactive
|
|
963
|
+
await sock.sendMessage(
|
|
964
|
+
jid,
|
|
965
|
+
{
|
|
966
|
+
buttonReply: {
|
|
967
|
+
body: 'Hii',
|
|
968
|
+
nativeFlows: {
|
|
969
|
+
name: 'menu_options',
|
|
970
|
+
paramsJson: JSON.stringify({ id: 'ID', description: 'description' })
|
|
971
|
+
version: 1 // 2 | 3
|
|
972
|
+
}
|
|
973
|
+
},
|
|
974
|
+
type: 'interactive'
|
|
975
|
+
}
|
|
976
|
+
)
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
### Buttons Message
|
|
980
|
+
```ts
|
|
981
|
+
await sock.sendMessage(
|
|
982
|
+
jid,
|
|
983
|
+
{
|
|
984
|
+
text: 'This is a button message!', // image: buffer or // image: { url: url } If you want to use images
|
|
985
|
+
caption: 'caption', // Use this if you are using an image or video
|
|
986
|
+
footer: 'Hello World!',
|
|
987
|
+
buttons: [{
|
|
988
|
+
buttonId: 'Id1',
|
|
989
|
+
buttonText: {
|
|
990
|
+
displayText: 'Button 1'
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
buttonId: 'Id2',
|
|
995
|
+
buttonText: {
|
|
996
|
+
displayText: 'Button 2'
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
buttonId: 'Id3',
|
|
1001
|
+
buttonText: {
|
|
1002
|
+
displayText: 'Button 3'
|
|
1003
|
+
}
|
|
1004
|
+
}]
|
|
1005
|
+
}
|
|
1006
|
+
)
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
### Buttons List Message
|
|
1010
|
+
```ts
|
|
1011
|
+
// Just working in a private chat
|
|
1012
|
+
await sock.sendMessage(
|
|
1013
|
+
jid,
|
|
1014
|
+
{
|
|
1015
|
+
text: 'This is a list!',
|
|
1016
|
+
footer: 'Hello World!',
|
|
1017
|
+
title: 'Amazing boldfaced list title',
|
|
1018
|
+
buttonText: 'Required, text on the button to view the list',
|
|
1019
|
+
sections: [
|
|
1020
|
+
{
|
|
1021
|
+
title: 'Section 1',
|
|
1022
|
+
rows: [{
|
|
1023
|
+
title: 'Option 1',
|
|
1024
|
+
rowId: 'option1'
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
title: 'Option 2',
|
|
1028
|
+
rowId: 'option2',
|
|
1029
|
+
description: 'This is a description'
|
|
1030
|
+
}]
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
title: 'Section 2',
|
|
1034
|
+
rows: [{
|
|
1035
|
+
title: 'Option 3',
|
|
1036
|
+
rowId: 'option3'
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
title: 'Option 4',
|
|
1040
|
+
rowId: 'option4',
|
|
1041
|
+
description: 'This is a description V2'
|
|
1042
|
+
}]
|
|
1043
|
+
}]
|
|
1044
|
+
}
|
|
1045
|
+
)
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
### Buttons Product List Message
|
|
1049
|
+
```ts
|
|
1050
|
+
// Just working in a private chat
|
|
1051
|
+
await sock.sendMessage(
|
|
1052
|
+
jid,
|
|
1053
|
+
{
|
|
1054
|
+
text: 'This is a list!',
|
|
1055
|
+
footer: 'Hello World!',
|
|
1056
|
+
title: 'Amazing boldfaced list title',
|
|
1057
|
+
buttonText: 'Required, text on the button to view the list',
|
|
1058
|
+
productList: [{
|
|
1059
|
+
title: 'This is a title',
|
|
1060
|
+
products: [
|
|
1061
|
+
{
|
|
1062
|
+
productId: '1234'
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
productId: '5678'
|
|
1066
|
+
}
|
|
1067
|
+
]
|
|
1068
|
+
}],
|
|
1069
|
+
businessOwnerJid: '628xxx@s.whatsapp.net',
|
|
1070
|
+
thumbnail: 'https://example.com/jdbenkksjs.jpg' // or buffer
|
|
1071
|
+
}
|
|
1072
|
+
)
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
### Buttons Cards Message
|
|
1076
|
+
```ts
|
|
1077
|
+
await sock.sendMessage(
|
|
1078
|
+
jid,
|
|
1079
|
+
{
|
|
1080
|
+
text: 'Body Message',
|
|
1081
|
+
title: 'Title Message',
|
|
1082
|
+
subtile: 'Subtitle Message',
|
|
1083
|
+
footer: 'Footer Message',
|
|
1084
|
+
cards: [
|
|
1085
|
+
{
|
|
1086
|
+
image: { url: 'https://example.com/jdbenkksjs.jpg' }, // or buffer
|
|
1087
|
+
title: 'Title Cards',
|
|
1088
|
+
body: 'Body Cards',
|
|
1089
|
+
footer: 'Footer Cards',
|
|
1090
|
+
buttons: [
|
|
1091
|
+
{
|
|
1092
|
+
name: 'quick_reply',
|
|
1093
|
+
buttonParamsJson: JSON.stringify({
|
|
1094
|
+
display_text: 'Display Button',
|
|
1095
|
+
id: 'ID'
|
|
1096
|
+
})
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
name: 'cta_url',
|
|
1100
|
+
buttonParamsJson: JSON.stringify({
|
|
1101
|
+
display_text: 'Display Button',
|
|
1102
|
+
url: 'https://www.example.com'
|
|
1103
|
+
})
|
|
1104
|
+
}
|
|
1105
|
+
]
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
video: { url: 'https://example.com/jdbenkksjs.mp4' }, // or buffer
|
|
1109
|
+
title: 'Title Cards',
|
|
1110
|
+
body: 'Body Cards',
|
|
1111
|
+
footer: 'Footer Cards',
|
|
1112
|
+
buttons: [
|
|
1113
|
+
{
|
|
1114
|
+
name: 'quick_reply',
|
|
1115
|
+
buttonParamsJson: JSON.stringify({
|
|
1116
|
+
display_text: 'Display Button',
|
|
1117
|
+
id: 'ID'
|
|
1118
|
+
})
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
name: 'cta_url',
|
|
1122
|
+
buttonParamsJson: JSON.stringify({
|
|
1123
|
+
display_text: 'Display Button',
|
|
1124
|
+
url: 'https://www.example.com'
|
|
1125
|
+
})
|
|
1126
|
+
}
|
|
1127
|
+
]
|
|
1128
|
+
}
|
|
1129
|
+
]
|
|
1130
|
+
}
|
|
1131
|
+
)
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
### Buttons Template Message
|
|
1135
|
+
```ts
|
|
1136
|
+
// This no longer works
|
|
1137
|
+
await sock.sendMessage(
|
|
1138
|
+
jid,
|
|
1139
|
+
{
|
|
1140
|
+
text: 'This is a template message!',
|
|
1141
|
+
footer: 'Hello World!',
|
|
1142
|
+
templateButtons: [{
|
|
1143
|
+
index: 1,
|
|
1144
|
+
urlButton: {
|
|
1145
|
+
displayText: 'Follow Me',
|
|
1146
|
+
url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
|
|
1147
|
+
},
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
index: 2,
|
|
1151
|
+
callButton: {
|
|
1152
|
+
displayText: 'Call Me!',
|
|
1153
|
+
phoneNumber: '628xxx'
|
|
1154
|
+
},
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
index: 3,
|
|
1158
|
+
quickReplyButton: {
|
|
1159
|
+
displayText: 'This is a reply, just like normal buttons!',
|
|
1160
|
+
id: 'id-like-buttons-message'
|
|
1161
|
+
},
|
|
1162
|
+
}]
|
|
1163
|
+
}
|
|
1164
|
+
)
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
### Buttons Interactive Message
|
|
1168
|
+
```ts
|
|
1169
|
+
await sock.sendMessage(
|
|
1170
|
+
jid,
|
|
1171
|
+
{
|
|
1172
|
+
text: 'This is an Interactive message!',
|
|
1173
|
+
title: 'Hiii',
|
|
1174
|
+
subtitle: 'There is a subtitle',
|
|
1175
|
+
footer: 'Hello World!',
|
|
1176
|
+
interactiveButtons: [
|
|
1177
|
+
{
|
|
1178
|
+
name: 'quick_reply',
|
|
1179
|
+
buttonParamsJson: JSON.stringify({
|
|
1180
|
+
display_text: 'Click Me!',
|
|
1181
|
+
id: 'your_id'
|
|
1182
|
+
})
|
|
1183
|
+
},
|
|
1184
|
+
{
|
|
1185
|
+
name: 'cta_url',
|
|
1186
|
+
buttonParamsJson: JSON.stringify({
|
|
1187
|
+
display_text: 'Follow Me',
|
|
1188
|
+
url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y',
|
|
1189
|
+
merchant_url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
|
|
1190
|
+
})
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
name: 'cta_copy',
|
|
1194
|
+
buttonParamsJson: JSON.stringify({
|
|
1195
|
+
display_text: 'Click Me!',
|
|
1196
|
+
copy_code: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
|
|
1197
|
+
})
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
name: 'cta_call',
|
|
1201
|
+
buttonParamsJson: JSON.stringify({
|
|
1202
|
+
display_text: 'Call Me!',
|
|
1203
|
+
phone_number: '628xxx'
|
|
1204
|
+
})
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
name: 'cta_catalog',
|
|
1208
|
+
buttonParamsJson: JSON.stringify({
|
|
1209
|
+
business_phone_number: '628xxx'
|
|
1210
|
+
})
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
name: 'cta_reminder',
|
|
1214
|
+
buttonParamsJson: JSON.stringify({
|
|
1215
|
+
display_text: '...'
|
|
1216
|
+
})
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
name: 'cta_cancel_reminder',
|
|
1220
|
+
buttonParamsJson: JSON.stringify({
|
|
1221
|
+
display_text: '...'
|
|
1222
|
+
})
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
name: 'address_message',
|
|
1226
|
+
buttonParamsJson: JSON.stringify({
|
|
1227
|
+
display_text: '...'
|
|
1228
|
+
})
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
name: 'send_location',
|
|
1232
|
+
buttonParamsJson: JSON.stringify({
|
|
1233
|
+
display_text: '...'
|
|
1234
|
+
})
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
name: 'open_webview',
|
|
1238
|
+
buttonParamsJson: JSON.stringify({
|
|
1239
|
+
title: 'Follow Me!',
|
|
1240
|
+
link: {
|
|
1241
|
+
in_app_webview: true, // or false
|
|
1242
|
+
url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
|
|
1243
|
+
}
|
|
1244
|
+
})
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
name: 'mpm',
|
|
1248
|
+
buttonParamsJson: JSON.stringify({
|
|
1249
|
+
product_id: '8816262248471474'
|
|
1250
|
+
})
|
|
1251
|
+
},
|
|
1252
|
+
{
|
|
1253
|
+
name: 'wa_payment_transaction_details',
|
|
1254
|
+
buttonParamsJson: JSON.stringify({
|
|
1255
|
+
transaction_id: '12345848'
|
|
1256
|
+
})
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
name: 'automated_greeting_message_view_catalog',
|
|
1260
|
+
buttonParamsJson: JSON.stringify({
|
|
1261
|
+
business_phone_number: '628xxx',
|
|
1262
|
+
catalog_product_id: '12345'
|
|
1263
|
+
})
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
name: 'galaxy_message',
|
|
1267
|
+
buttonParamsJson: JSON.stringify({
|
|
1268
|
+
mode: 'published',
|
|
1269
|
+
flow_message_version: '3',
|
|
1270
|
+
flow_token: '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3',
|
|
1271
|
+
flow_id: '1307913409923914',
|
|
1272
|
+
flow_cta: 'blckrose >',
|
|
1273
|
+
flow_action: 'navigate',
|
|
1274
|
+
flow_action_payload: {
|
|
1275
|
+
screen: 'QUESTION_ONE',
|
|
1276
|
+
params: {
|
|
1277
|
+
user_id: '123456789',
|
|
1278
|
+
referral: 'campaign_xyz'
|
|
1279
|
+
}
|
|
1280
|
+
},
|
|
1281
|
+
flow_metadata: {
|
|
1282
|
+
flow_json_version: '201',
|
|
1283
|
+
data_api_protocol: 'v2',
|
|
1284
|
+
flow_name: 'Lead Qualification [en]',
|
|
1285
|
+
data_api_version: 'v2',
|
|
1286
|
+
categories: ['Lead Generation', 'Sales']
|
|
1287
|
+
}
|
|
1288
|
+
})
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
name: 'single_select',
|
|
1292
|
+
buttonParamsJson: JSON.stringify({
|
|
1293
|
+
title: 'Click Me!',
|
|
1294
|
+
sections: [
|
|
1295
|
+
{
|
|
1296
|
+
title: 'Title 1',
|
|
1297
|
+
highlight_label: 'Highlight label 1',
|
|
1298
|
+
rows: [
|
|
1299
|
+
{
|
|
1300
|
+
header: 'Header 1',
|
|
1301
|
+
title: 'Title 1',
|
|
1302
|
+
description: 'Description 1',
|
|
1303
|
+
id: 'Id 1'
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
header: 'Header 2',
|
|
1307
|
+
title: 'Title 2',
|
|
1308
|
+
description: 'Description 2',
|
|
1309
|
+
id: 'Id 2'
|
|
1310
|
+
}
|
|
1311
|
+
]
|
|
1312
|
+
}
|
|
1313
|
+
]
|
|
1314
|
+
})
|
|
1315
|
+
}
|
|
1316
|
+
]
|
|
1317
|
+
}
|
|
1318
|
+
)
|
|
1319
|
+
|
|
1320
|
+
// If you want to use an image
|
|
1321
|
+
await sock.sendMessage(
|
|
1322
|
+
jid,
|
|
1323
|
+
{
|
|
1324
|
+
image: {
|
|
1325
|
+
url: 'https://example.com/jdbenkksjs.jpg'
|
|
1326
|
+
},
|
|
1327
|
+
caption: 'Body',
|
|
1328
|
+
title: 'Title',
|
|
1329
|
+
subtitle: 'Subtitle',
|
|
1330
|
+
footer: 'Footer',
|
|
1331
|
+
interactiveButtons: [
|
|
1332
|
+
{
|
|
1333
|
+
name: 'quick_reply',
|
|
1334
|
+
buttonParamsJson: JSON.stringify({
|
|
1335
|
+
display_text: 'DisplayText',
|
|
1336
|
+
id: 'ID1'
|
|
1337
|
+
})
|
|
1338
|
+
}
|
|
1339
|
+
],
|
|
1340
|
+
hasMediaAttachment: false // or true
|
|
1341
|
+
}
|
|
1342
|
+
)
|
|
1343
|
+
|
|
1344
|
+
// If you want to use a video
|
|
1345
|
+
await sock.sendMessage(
|
|
1346
|
+
jid,
|
|
1347
|
+
{
|
|
1348
|
+
video: {
|
|
1349
|
+
url: 'https://example.com/jdbenkksjs.mp4'
|
|
1350
|
+
},
|
|
1351
|
+
caption: 'Body',
|
|
1352
|
+
title: 'Title',
|
|
1353
|
+
subtitle: 'Subtitle',
|
|
1354
|
+
footer: 'Footer',
|
|
1355
|
+
interactiveButtons: [
|
|
1356
|
+
{
|
|
1357
|
+
name: 'quick_reply',
|
|
1358
|
+
buttonParamsJson: JSON.stringify({
|
|
1359
|
+
display_text: 'DisplayText',
|
|
1360
|
+
id: 'ID1'
|
|
1361
|
+
})
|
|
1362
|
+
}
|
|
1363
|
+
],
|
|
1364
|
+
hasMediaAttachment: false // or true
|
|
1365
|
+
}
|
|
1366
|
+
)
|
|
1367
|
+
|
|
1368
|
+
// If you want to use a document
|
|
1369
|
+
await sock.sendMessage(
|
|
1370
|
+
jid,
|
|
1371
|
+
{
|
|
1372
|
+
document: {
|
|
1373
|
+
url: 'https://example.com/jdbenkksjs.jpg'
|
|
1374
|
+
},
|
|
1375
|
+
mimetype: 'image/jpeg',
|
|
1376
|
+
caption: 'Body',
|
|
1377
|
+
title: 'Title',
|
|
1378
|
+
subtitle: 'Subtitle',
|
|
1379
|
+
footer: 'Footer',
|
|
1380
|
+
interactiveButtons: [
|
|
1381
|
+
{
|
|
1382
|
+
name: 'quick_reply',
|
|
1383
|
+
buttonParamsJson: JSON.stringify({
|
|
1384
|
+
display_text: 'DisplayText',
|
|
1385
|
+
id: 'ID1'
|
|
1386
|
+
})
|
|
1387
|
+
}
|
|
1388
|
+
],
|
|
1389
|
+
hasMediaAttachment: false // or true
|
|
1390
|
+
}
|
|
1391
|
+
)
|
|
1392
|
+
|
|
1393
|
+
// If you want to use a location
|
|
1394
|
+
await sock.sendMessage(
|
|
1395
|
+
jid,
|
|
1396
|
+
{
|
|
1397
|
+
location: {
|
|
1398
|
+
degreesLatitude: -0,
|
|
1399
|
+
degreesLongitude: 0,
|
|
1400
|
+
name: 'Hi'
|
|
1401
|
+
},
|
|
1402
|
+
caption: 'Body',
|
|
1403
|
+
title: 'Title',
|
|
1404
|
+
subtitle: 'Subtitle',
|
|
1405
|
+
footer: 'Footer',
|
|
1406
|
+
interactiveButtons: [
|
|
1407
|
+
{
|
|
1408
|
+
name: 'quick_reply',
|
|
1409
|
+
buttonParamsJson: JSON.stringify({
|
|
1410
|
+
display_text: 'DisplayText',
|
|
1411
|
+
id: 'ID1'
|
|
1412
|
+
})
|
|
1413
|
+
}
|
|
1414
|
+
],
|
|
1415
|
+
hasMediaAttachment: false // or true
|
|
1416
|
+
}
|
|
1417
|
+
)
|
|
1418
|
+
```
|
|
1419
|
+
|
|
1420
|
+
### Buttons Interactive Message PIX
|
|
1421
|
+
```ts
|
|
1422
|
+
await sock.sendMessage(
|
|
1423
|
+
jid,
|
|
1424
|
+
{
|
|
1425
|
+
text: '', // This string is required. Even it's empty.
|
|
1426
|
+
interactiveButtons: [
|
|
1427
|
+
{
|
|
1428
|
+
name: 'payment_info',
|
|
1429
|
+
buttonParamsJson: JSON.stringify({
|
|
1430
|
+
payment_settings: [{
|
|
1431
|
+
type: "pix_static_code",
|
|
1432
|
+
pix_static_code: {
|
|
1433
|
+
merchant_name: 'blckrose',
|
|
1434
|
+
key: 'example@blckrose.com',
|
|
1435
|
+
key_type: 'EMAIL' // PHONE || EMAIL || CPF || EVP
|
|
1436
|
+
}
|
|
1437
|
+
}]
|
|
1438
|
+
})
|
|
1439
|
+
}
|
|
1440
|
+
],
|
|
1441
|
+
}
|
|
1442
|
+
)
|
|
1443
|
+
```
|
|
1444
|
+
|
|
1445
|
+
### Buttons Interactive Message PAY
|
|
1446
|
+
```ts
|
|
1447
|
+
await sock.sendMessage(
|
|
1448
|
+
jid,
|
|
1449
|
+
{
|
|
1450
|
+
text: '', // This string is required. Even it's empty.
|
|
1451
|
+
interactiveButtons: [
|
|
1452
|
+
{
|
|
1453
|
+
name: 'review_and_pay',
|
|
1454
|
+
buttonParamsJson: JSON.stringify({
|
|
1455
|
+
currency: 'IDR',
|
|
1456
|
+
payment_configuration: '',
|
|
1457
|
+
payment_type: '',
|
|
1458
|
+
total_amount: {
|
|
1459
|
+
value: '999999999',
|
|
1460
|
+
offset: '100'
|
|
1461
|
+
},
|
|
1462
|
+
reference_id: '45XXXXX',
|
|
1463
|
+
type: 'physical-goods',
|
|
1464
|
+
payment_method: 'confirm',
|
|
1465
|
+
payment_status: 'captured',
|
|
1466
|
+
payment_timestamp: Math.floor(Date.now() / 1000),
|
|
1467
|
+
order: {
|
|
1468
|
+
status: 'completed',
|
|
1469
|
+
description: '',
|
|
1470
|
+
subtotal: {
|
|
1471
|
+
value: '0',
|
|
1472
|
+
offset: '100'
|
|
1473
|
+
},
|
|
1474
|
+
order_type: 'PAYMENT_REQUEST',
|
|
1475
|
+
items: [{
|
|
1476
|
+
retailer_id: 'your_retailer_id',
|
|
1477
|
+
name: 'blckrose',
|
|
1478
|
+
amount: {
|
|
1479
|
+
value: '999999999',
|
|
1480
|
+
offset: '100'
|
|
1481
|
+
},
|
|
1482
|
+
quantity: '1',
|
|
1483
|
+
}]
|
|
1484
|
+
},
|
|
1485
|
+
additional_note: 'blckrose',
|
|
1486
|
+
native_payment_methods: [],
|
|
1487
|
+
share_payment_status: false
|
|
1488
|
+
})
|
|
1489
|
+
}
|
|
1490
|
+
],
|
|
1491
|
+
}
|
|
1492
|
+
)
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
### Status Mentions Message
|
|
1496
|
+
```ts
|
|
1497
|
+
const jidat = [
|
|
1498
|
+
'123451679@g.us',
|
|
1499
|
+
'124848899@g.us',
|
|
1500
|
+
'111384848@g.us',
|
|
1501
|
+
'62689xxxx@s.whatsapp.net',
|
|
1502
|
+
'62xxxxxxx@s.whatsapp.net'
|
|
1503
|
+
]
|
|
1504
|
+
// Text
|
|
1505
|
+
await sock.sendStatusMentions(
|
|
1506
|
+
{
|
|
1507
|
+
text: 'Hello Everyone :3',
|
|
1508
|
+
font: 2, // optional
|
|
1509
|
+
textColor: 'FF0000', // optional
|
|
1510
|
+
backgroundColor: '#000000' // optional
|
|
1511
|
+
},
|
|
1512
|
+
jids // Limit to 5 mentions per status
|
|
1513
|
+
)
|
|
1514
|
+
|
|
1515
|
+
// Image
|
|
1516
|
+
await sock.sendStatusMentions(
|
|
1517
|
+
{
|
|
1518
|
+
Image: { url: 'https://example.com/ruriooe.jpg' }, // or image buffer
|
|
1519
|
+
caption: 'Hello Everyone :3' // optional
|
|
1520
|
+
},
|
|
1521
|
+
jids // Limit to 5 mentions per status
|
|
1522
|
+
)
|
|
1523
|
+
|
|
1524
|
+
// Video
|
|
1525
|
+
await sock.sendStatusMentions(
|
|
1526
|
+
{
|
|
1527
|
+
video: { url: 'https://example.com/ruriooe.mp4' }, // or video buffer
|
|
1528
|
+
caption: 'Hello Everyone :3' // optional
|
|
1529
|
+
},
|
|
1530
|
+
jids // Limit to 5 mentions per status
|
|
1531
|
+
)
|
|
1532
|
+
|
|
1533
|
+
// Audio
|
|
1534
|
+
await sock.sendStatusMentions(
|
|
1535
|
+
{
|
|
1536
|
+
audio: { url: 'https://example.com/ruriooe.mp3' }, // or audio buffer
|
|
1537
|
+
backgroundColor: '#000000', // optional
|
|
1538
|
+
mimetype: 'audio/mp4',
|
|
1539
|
+
ppt: true
|
|
1540
|
+
},
|
|
1541
|
+
jids // Limit to 5 mentions per status
|
|
1542
|
+
)
|
|
1543
|
+
```
|
|
1544
|
+
|
|
1545
|
+
### Shop Message
|
|
1546
|
+
```ts
|
|
1547
|
+
await sock.sendMessage(
|
|
1548
|
+
jid,
|
|
1549
|
+
{
|
|
1550
|
+
text: 'Body',
|
|
1551
|
+
title: 'Title',
|
|
1552
|
+
subtitle: 'Subtitle',
|
|
1553
|
+
footer: 'Footer',
|
|
1554
|
+
shop: {
|
|
1555
|
+
surface: 1, // 2 | 3 | 4
|
|
1556
|
+
id: 'https://example.com'
|
|
1557
|
+
},
|
|
1558
|
+
viewOnce: true
|
|
1559
|
+
}
|
|
1560
|
+
)
|
|
1561
|
+
|
|
1562
|
+
// Image
|
|
1563
|
+
await sock.sendMessage(
|
|
1564
|
+
jid,
|
|
1565
|
+
{
|
|
1566
|
+
image: {
|
|
1567
|
+
url: 'https://example.com/jdbenkksjs.jpg'
|
|
1568
|
+
},
|
|
1569
|
+
caption: 'Body',
|
|
1570
|
+
title: 'Title',
|
|
1571
|
+
subtitle: 'Subtitle',
|
|
1572
|
+
footer: 'Footer',
|
|
1573
|
+
shop: {
|
|
1574
|
+
surface: 1, // 2 | 3 | 4
|
|
1575
|
+
id: 'https://example.com'
|
|
1576
|
+
},
|
|
1577
|
+
hasMediaAttachment: false, // or true
|
|
1578
|
+
viewOnce: true
|
|
1579
|
+
}
|
|
1580
|
+
)
|
|
1581
|
+
```
|
|
1582
|
+
|
|
1583
|
+
### Collection Message
|
|
1584
|
+
```ts
|
|
1585
|
+
await sock.sendMessage(
|
|
1586
|
+
jid,
|
|
1587
|
+
{
|
|
1588
|
+
text: 'Body',
|
|
1589
|
+
title: 'Title',
|
|
1590
|
+
subtitle: 'Subtitle',
|
|
1591
|
+
footer: 'Footer',
|
|
1592
|
+
collection: {
|
|
1593
|
+
bizJid: 'jid',
|
|
1594
|
+
id: 'https://example.com',
|
|
1595
|
+
version: 1
|
|
1596
|
+
},
|
|
1597
|
+
viewOnce: true
|
|
1598
|
+
}
|
|
1599
|
+
)
|
|
1600
|
+
|
|
1601
|
+
// Image
|
|
1602
|
+
await sock.sendMessage(
|
|
1603
|
+
jid,
|
|
1604
|
+
{
|
|
1605
|
+
image: {
|
|
1606
|
+
url: 'https://example.com/jdbenkksjs.jpg'
|
|
1607
|
+
},
|
|
1608
|
+
caption: 'Body',
|
|
1609
|
+
title: 'Title',
|
|
1610
|
+
subtitle: 'Subtitle',
|
|
1611
|
+
footer: 'Footer',
|
|
1612
|
+
collection: {
|
|
1613
|
+
bizJid: 'jid',
|
|
1614
|
+
id: 'https://example.com',
|
|
1615
|
+
version: 1
|
|
1616
|
+
},
|
|
1617
|
+
hasMediaAttachment: false, // or true
|
|
1618
|
+
viewOnce: true
|
|
1619
|
+
}
|
|
1620
|
+
)
|
|
1621
|
+
```
|
|
1622
|
+
|
|
1623
|
+
### AI Icon Feature
|
|
1624
|
+
```ts
|
|
1625
|
+
await sock.sendMessage(
|
|
1626
|
+
jid,
|
|
1627
|
+
{
|
|
1628
|
+
text: 'Hi'
|
|
1629
|
+
}, {
|
|
1630
|
+
ai: true // Add ai usage and change it to true
|
|
1631
|
+
}
|
|
1632
|
+
)
|
|
1633
|
+
|
|
1634
|
+
// If using relay
|
|
1635
|
+
await sock.relayMessage(
|
|
1636
|
+
jid,
|
|
1637
|
+
{
|
|
1638
|
+
extendedTextMessage: {
|
|
1639
|
+
text: 'Hi'
|
|
1640
|
+
}
|
|
1641
|
+
}, {
|
|
1642
|
+
AI: true // Use capital letters
|
|
1643
|
+
}
|
|
1644
|
+
)
|
|
1645
|
+
```
|
|
1646
|
+
|
|
592
1647
|
### Sending Messages with Link Previews
|
|
593
1648
|
|
|
594
1649
|
1. By default, wa does not have link generation when sent from the web
|
|
@@ -680,6 +1735,45 @@ await sock.sendMessage(
|
|
|
680
1735
|
)
|
|
681
1736
|
```
|
|
682
1737
|
|
|
1738
|
+
### Album Message
|
|
1739
|
+
```ts
|
|
1740
|
+
await sock.sendMessage(
|
|
1741
|
+
id,
|
|
1742
|
+
{
|
|
1743
|
+
album: [{
|
|
1744
|
+
image: {
|
|
1745
|
+
url: 'https://example.com/blckrose.jpg'
|
|
1746
|
+
},
|
|
1747
|
+
caption: 'Hay'
|
|
1748
|
+
}, {
|
|
1749
|
+
image: Buffer,
|
|
1750
|
+
caption: 'Hay'
|
|
1751
|
+
}, {
|
|
1752
|
+
video: {
|
|
1753
|
+
url: 'https://example.com/blckrose.mp4'
|
|
1754
|
+
},
|
|
1755
|
+
caption: 'Hay'
|
|
1756
|
+
}, {
|
|
1757
|
+
video: Buffer,
|
|
1758
|
+
caption: 'Hay'
|
|
1759
|
+
}]
|
|
1760
|
+
}
|
|
1761
|
+
)
|
|
1762
|
+
```
|
|
1763
|
+
|
|
1764
|
+
#### Ptv Video Message
|
|
1765
|
+
```ts
|
|
1766
|
+
await sock.sendMessage(
|
|
1767
|
+
id,
|
|
1768
|
+
{
|
|
1769
|
+
video: {
|
|
1770
|
+
url: './Media/ma_gif.mp4'
|
|
1771
|
+
},
|
|
1772
|
+
ptv: true
|
|
1773
|
+
}
|
|
1774
|
+
)
|
|
1775
|
+
```
|
|
1776
|
+
|
|
683
1777
|
#### View Once Message
|
|
684
1778
|
|
|
685
1779
|
- You can send all messages above as `viewOnce`, you only need to pass `viewOnce: true` in content object
|
|
@@ -924,6 +2018,11 @@ await sock.sendMessage(
|
|
|
924
2018
|
)
|
|
925
2019
|
```
|
|
926
2020
|
|
|
2021
|
+
### Clear Messages
|
|
2022
|
+
```ts
|
|
2023
|
+
await sock.clearMessage(jid, key, timestamps)
|
|
2024
|
+
```
|
|
2025
|
+
|
|
927
2026
|
## User Querys
|
|
928
2027
|
|
|
929
2028
|
### Check If ID Exists in Whatsapp
|