@realvare/based 2.7.54 → 2.7.56

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
@@ -593,33 +593,95 @@ await conn.sendMessage(jid, {
593
593
  ```
594
594
 
595
595
  #### Advanced Media
596
+
596
597
  ```typescript
597
598
  // Album (Multiple images)
598
599
  await conn.sendMessage(jid, {
599
600
  album: imageBuffers.map(buffer => ({ image: buffer })),
600
601
  caption: 'ts gettin real'
601
602
  });
603
+ ```
604
+
605
+ #### Stickers
602
606
 
603
- // Sticker
607
+ Sending stickers is supported. You can send a sticker from a URL or a buffer. For creating stickers from images, you can use an external library like `wa-sticker-formatter`.
608
+
609
+ ```typescript
610
+ // Sticker from URL
604
611
  await conn.sendMessage(jid, {
605
612
  sticker: { url: './stickers/sticker.webp' }
606
613
  });
607
614
 
608
- // Location message
609
- await conn.sendMessage(jid, {
610
- location: {
611
- degreesLatitude: 45.4642,
612
- degreesLongitude: 9.1900,
613
- name: "Milano",
614
- address: "Piazza del Duomo, Milano"
615
- }
616
- });
615
+ // Sticker from buffer using wa-sticker-formatter
616
+ const { Sticker } = require('wa-sticker-formatter'); // Optional external library
617
+ const sticker = new Sticker('path/to/image.jpg', { pack: 'My Pack', author: 'My Bot' });
618
+ const buffer = await sticker.toBuffer();
619
+ await conn.sendMessage(jid, { sticker: buffer });
620
+ ```
621
+
622
+ ##### Sticker Packs
623
+
624
+ While WhatsApp supports installable sticker packs, Baileys (and this fork) does not have a native feature to create or send a pack as a single multi-sticker message (`StickerPackMessage`). This is a requested feature in Baileys (see issues [#1548](https://github.com/WhiskeySockets/Baileys/issues/1548)), but not yet implemented.
625
+
626
+ However, the library provides a way to send a sticker pack by sending a metadata message followed by the individual stickers. This simulates a sticker pack in the chat.
627
+
628
+ Here is how you can send a sticker pack:
629
+
630
+ ```typescript
631
+ import { Sticker } from 'wa-sticker-formatter';
632
+
633
+ const sticker1 = new Sticker('path/to/image1.png', { pack: 'My Sticker Pack', author: 'Me' });
634
+ const sticker2 = new Sticker('path/to/image2.png', { pack: 'My Sticker Pack', author: 'Me' });
635
+
636
+ const stickerPack = {
637
+ name: 'My Sticker Pack',
638
+ publisher: 'My Bot',
639
+ description: 'A cool sticker pack',
640
+ cover: 'path/to/cover.png', // or a buffer
641
+ stickers: [
642
+ {
643
+ sticker: await sticker1.toBuffer(),
644
+ emojis: ['🎉', '🎊'],
645
+ },
646
+ {
647
+ sticker: await sticker2.toBuffer(),
648
+ emojis: ['😄', '😊'],
649
+ }
650
+ ]
651
+ };
652
+
653
+ await conn.sendMessage(jid, { stickerPack: stickerPack });
654
+ ```
655
+
656
+ Alternatively, you can simulate a pack by sending multiple stickers in sequence with a small delay between them:
657
+
658
+ ```typescript
659
+ // Simulate a pack by sending multiple stickers
660
+ const stickers = ['sticker1.webp', 'sticker2.webp'];
661
+ for (const url of stickers) {
662
+ await conn.sendMessage(jid, { sticker: { url } });
663
+ await new Promise(resolve => setTimeout(resolve, 500)); // Small delay
664
+ }
665
+ ```
666
+ To create actual sticker packs that users can install, you should use external tools like the official WhatsApp Sticker Maker app. You can then integrate the individual stickers into your bot.
667
+
668
+ ##### Stickers on Status (2025 Feature)
669
+
670
+ The new interactive stickers on Status (e.g., with lyrics or questions) can be sent by sending a sticker to `status@broadcast`.
671
+
672
+ ```typescript
673
+ await conn.sendMessage('status@broadcast', {
674
+ sticker: { url: './sticker.webp' },
675
+ caption: 'Interactive sticker on Status'
676
+ }, { statusJidList: ['user1@s.whatsapp.net', 'user2@s.whatsapp.net'] });
617
677
  ```
618
678
 
619
679
  #### Interactive Messages
620
- These messages include interactive elements like buttons, lists, and templates.
680
+
681
+ These messages include interactive elements like buttons, lists, and polls.
621
682
 
622
683
  ##### Messages with Simple Buttons
684
+
623
685
  Send quick reply buttons.
624
686
 
625
687
  ```typescript
@@ -627,15 +689,16 @@ await conn.sendMessage(jid, {
627
689
  text: 'Choose an option:',
628
690
  footer: 'Footer',
629
691
  buttons: [
630
- { buttonId: 'cmd1', buttonText: { displayText: 'text1' }, type: 1 },
631
- { buttonId: 'cmd2', buttonText: { displayText: 'text2' }, type: 1 },
692
+ { buttonId: 'cmd1', buttonText: { displayText: 'Option 1' }, type: 1 },
693
+ { buttonId: 'cmd2', buttonText: { displayText: 'Option 2' }, type: 1 },
632
694
  ],
633
695
  headerType: 1,
634
696
  });
635
697
  ```
636
698
 
637
699
  ##### Messages with Buttons and Image
638
- Combine image with buttons.
700
+
701
+ Combine an image with buttons.
639
702
 
640
703
  ```typescript
641
704
  await conn.sendMessage(jid, {
@@ -649,7 +712,8 @@ await conn.sendMessage(jid, {
649
712
  ```
650
713
 
651
714
  ##### List Messages
652
- Send a list of options (only in private).
715
+
716
+ Send a list of options (only in private chats).
653
717
 
654
718
  ```typescript
655
719
  await conn.sendMessage(jid, {
@@ -669,6 +733,29 @@ await conn.sendMessage(jid, {
669
733
  });
670
734
  ```
671
735
 
736
+ ##### Poll Messages
737
+
738
+ Create a poll for users to vote on.
739
+
740
+ ```typescript
741
+ await conn.sendMessage(jid, {
742
+ poll: {
743
+ name: 'Favorite Anime?',
744
+ values: ['Aot', 'Bleach', 'Death note'],
745
+ selectableCount: 1 // or >1 for multi-select
746
+ }
747
+ });
748
+ ```
749
+
750
+ #### New Interactive Features (2025)
751
+
752
+ WhatsApp introduced several new features in 2025. Here's how to handle them with Baileys:
753
+
754
+ - **Missed Call Messages**: Baileys is primarily for messaging and does not handle calls. To approximate this feature, you could potentially listen for call events (if supported) and then send a voice or video note as a follow-up message.
755
+ - **Interactive Stickers on Status**: As shown in the sticker section, you can send stickers to `status@broadcast` with an interactive caption.
756
+ - **AI-Generated Images**: This is not a native Baileys feature. You need to integrate an external AI image generation API (like Meta AI), generate the image, and then send it as a regular image message.
757
+ - **Advanced Interactive Messages**: Features like "native flow" are partially supported in some forks (see issue [#398](https://github.com/WhiskeySockets/Baileys/issues/398)).
758
+
672
759
  #### Other Messages
673
760
  ```typescript
674
761
  // Message with quote
@@ -677,6 +764,16 @@ await conn.sendMessage(jid, {
677
764
  quoted: quotedMessage // The message to quote/reply/cite
678
765
  });
679
766
 
767
+ // Location message
768
+ await conn.sendMessage(jid, {
769
+ location: {
770
+ degreesLatitude: 45.4642,
771
+ degreesLongitude: 9.1900,
772
+ name: "Milano",
773
+ address: "Piazza del Duomo, Milano"
774
+ }
775
+ });
776
+
680
777
  // Contact Messages
681
778
  await conn.sendMessage(jid, {
682
779
  contacts: {
@@ -685,15 +782,6 @@ await conn.sendMessage(jid, {
685
782
  }
686
783
  });
687
784
 
688
- // Poll Messages (Survey)
689
- await conn.sendMessage(jid, {
690
- poll: {
691
- name: 'Favorite Anime?',
692
- values: ['Aot', 'Bleach', 'Death note'],
693
- selectableCount: 1 // how many choices possible
694
- }
695
- });
696
-
697
785
  // Ephemeral Messages (Self-Destructing)
698
786
  await conn.sendMessage(jid, {
699
787
  text: "This message will self-destruct {hopefully like israel}"
@@ -43,7 +43,7 @@ exports.DEFAULT_CONNECTION_CONFIG = {
43
43
  defaultQueryTimeoutMs: 60000,
44
44
  customUploadHosts: [],
45
45
  retryRequestDelayMs: 250,
46
- maxMsgRetryCount: 5,
46
+ maxMsgRetryCount: 10,
47
47
  fireInitQueries: true,
48
48
  auth: undefined,
49
49
  markOnlineOnConnect: false,
@@ -46,7 +46,7 @@ const makeMessagesRecvSocket = (config) => {
46
46
  tag: 'ack',
47
47
  attrs: {
48
48
  id: attrs.id,
49
- to: resolveJid(attrs.from),
49
+ to: attrs.from,
50
50
  class: tag
51
51
  }
52
52
  };
@@ -54,10 +54,10 @@ const makeMessagesRecvSocket = (config) => {
54
54
  stanza.attrs.error = errorCode.toString();
55
55
  }
56
56
  if (!!attrs.participant) {
57
- stanza.attrs.participant = resolveJid(attrs.participant);
57
+ stanza.attrs.participant = attrs.participant;
58
58
  }
59
59
  if (!!attrs.recipient) {
60
- stanza.attrs.recipient = resolveJid(attrs.recipient);
60
+ stanza.attrs.recipient = attrs.recipient;
61
61
  }
62
62
  if (!!attrs.type && (tag !== 'message' || (0, WABinary_1.getBinaryNodeChild)({ tag, attrs, content }, 'unavailable') || errorCode !== 0)) {
63
63
  stanza.attrs.type = attrs.type;
@@ -68,6 +68,7 @@ const makeMessagesRecvSocket = (config) => {
68
68
  logger.debug({ recv: { tag, attrs }, sent: stanza.attrs }, 'sent ack');
69
69
  await sendNode(stanza);
70
70
  };
71
+
71
72
  // Add withAck wrapper for guaranteed acknowledgments
72
73
  const withAck = (processFn) => async (node) => {
73
74
  try {
@@ -78,6 +79,7 @@ const makeMessagesRecvSocket = (config) => {
78
79
  }
79
80
  };
80
81
  const offerCall = async (toJid, isVideo = false) => {
82
+ toJid = resolveJid(toJid);
81
83
  const callId = (0, crypto_1.randomBytes)(16).toString('hex').toUpperCase().substring(0, 64);
82
84
  const offerContent = [];
83
85
  offerContent.push({ tag: 'audio', attrs: { enc: 'opus', rate: '16000' }, content: undefined });
@@ -117,7 +119,7 @@ const makeMessagesRecvSocket = (config) => {
117
119
  const stanza = ({
118
120
  tag: 'call',
119
121
  attrs: {
120
- to: resolveJid(toJid),
122
+ to: toJid,
121
123
  },
122
124
  content: [{
123
125
  tag: 'offer',
@@ -136,17 +138,18 @@ const makeMessagesRecvSocket = (config) => {
136
138
  };
137
139
  };
138
140
  const rejectCall = async (callId, callFrom) => {
141
+ callFrom = resolveJid(callFrom);
139
142
  const stanza = ({
140
143
  tag: 'call',
141
144
  attrs: {
142
145
  from: authState.creds.me.id,
143
- to: resolveJid(callFrom),
146
+ to: callFrom,
144
147
  },
145
148
  content: [{
146
149
  tag: 'reject',
147
150
  attrs: {
148
151
  'call-id': callId,
149
- 'call-creator': resolveJid(callFrom),
152
+ 'call-creator': callFrom,
150
153
  count: '0',
151
154
  },
152
155
  content: undefined,
@@ -180,7 +183,7 @@ const makeMessagesRecvSocket = (config) => {
180
183
  attrs: {
181
184
  id: msgId,
182
185
  type: 'retry',
183
- to: resolveJid(node.attrs.from)
186
+ to: node.attrs.from
184
187
  },
185
188
  content: [
186
189
  {
@@ -200,10 +203,10 @@ const makeMessagesRecvSocket = (config) => {
200
203
  ]
201
204
  };
202
205
  if (node.attrs.recipient) {
203
- receipt.attrs.recipient = resolveJid(node.attrs.recipient);
206
+ receipt.attrs.recipient = node.attrs.recipient;
204
207
  }
205
208
  if (node.attrs.participant) {
206
- receipt.attrs.participant = resolveJid(node.attrs.participant);
209
+ receipt.attrs.participant = node.attrs.participant;
207
210
  }
208
211
  if (retryCount > 1 || forceIncludeKeys) {
209
212
  const { update, preKeys } = await (0, Utils_1.getNextPreKeys)(authState, 1);
@@ -228,7 +231,7 @@ const makeMessagesRecvSocket = (config) => {
228
231
  });
229
232
  };
230
233
  const handleEncryptNotification = async (node) => {
231
- const from = resolveJid(node.attrs.from);
234
+ const from = node.attrs.from;
232
235
  if (from === WABinary_1.S_WHATSAPP_NET) {
233
236
  const countChild = (0, WABinary_1.getBinaryNodeChild)(node, 'count');
234
237
  const count = +countChild.attrs.value;
@@ -293,24 +296,22 @@ const makeMessagesRecvSocket = (config) => {
293
296
  msg.messageStubParameters = oldNumber || [];
294
297
  msg.messageStubType = Types_1.WAMessageStubType.GROUP_PARTICIPANT_CHANGE_NUMBER;
295
298
  break;
296
- case 'add':
297
- case 'remove':
298
299
  case 'promote':
299
300
  case 'demote':
301
+ case 'remove':
302
+ case 'add':
300
303
  case 'leave':
301
- const stubTypes = {
302
- add: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
303
- remove: Types_1.WAMessageStubType.GROUP_PARTICIPANT_REMOVE,
304
- promote: Types_1.WAMessageStubType.GROUP_PARTICIPANT_PROMOTE,
305
- demote: Types_1.WAMessageStubType.GROUP_PARTICIPANT_DEMOTE,
306
- leave: Types_1.WAMessageStubType.GROUP_PARTICIPANT_LEAVE,
307
- };
308
- msg.messageStubType = stubTypes[child.tag];
309
- let affected = (0, WABinary_1.getBinaryNodeChildren)(child, 'participant').map(p => p.attrs.jid);
310
- if (affected.length === 0) {
311
- affected = [participant];
304
+ const stubType = `GROUP_PARTICIPANT_${child.tag.toUpperCase()}`;
305
+ msg.messageStubType = Types_1.WAMessageStubType[stubType];
306
+ const participants = (0, WABinary_1.getBinaryNodeChildren)(child, 'participant').map(p => p.attrs.jid);
307
+ if (participants.length === 1 &&
308
+ // if recv. "remove" message and sender removed themselves
309
+ // mark as left
310
+ (0, WABinary_1.areJidsSameUser)(participants[0], participant) &&
311
+ child.tag === 'remove') {
312
+ msg.messageStubType = Types_1.WAMessageStubType.GROUP_PARTICIPANT_LEAVE;
312
313
  }
313
- msg.messageStubParameters = affected;
314
+ msg.messageStubParameters = participants;
314
315
  break;
315
316
  case 'subject':
316
317
  msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_SUBJECT;
@@ -422,7 +423,9 @@ const makeMessagesRecvSocket = (config) => {
422
423
  action = 'demote';
423
424
  contentPath = content.data[Types_1.XWAPaths.DEMOTE];
424
425
  }
425
- ev.emit('newsletter-participants.update', { id, author: contentPath.actor.pn, user: contentPath.user.pn, new_role: contentPath.user_new_role, action });
426
+ const author = resolveJid(contentPath.actor.pn);
427
+ const user = resolveJid(contentPath.user.pn);
428
+ ev.emit('newsletter-participants.update', { id, author, user, new_role: contentPath.user_new_role, action });
426
429
  }
427
430
  if (operation === Types_1.MexOperations.UPDATE) {
428
431
  contentPath = content.data[Types_1.XWAPaths.METADATA_UPDATE];
@@ -623,7 +626,7 @@ const makeMessagesRecvSocket = (config) => {
623
626
  // todo: implement a cache to store the last 256 sent messages (copy whatsmeow)
624
627
  const msgs = await Promise.all(ids.map(id => getMessage({ ...key, id })));
625
628
  const remoteJid = key.remoteJid;
626
- const participant = resolveJid(key.participant || remoteJid);
629
+ const participant = key.participant || remoteJid;
627
630
  // if it's the primary jid sending the request
628
631
  // just re-send the message to everyone
629
632
  // prevents the first message decryption failure
@@ -658,7 +661,7 @@ const makeMessagesRecvSocket = (config) => {
658
661
  const { attrs, content } = node;
659
662
  const isLid = attrs.from.includes('lid');
660
663
  const isNodeFromMe = (0, WABinary_1.areJidsSameUser)(resolveJid(attrs.participant) || resolveJid(attrs.from), isLid ? (_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.lid : (_b = authState.creds.me) === null || _b === void 0 ? void 0 : _b.id);
661
- const remoteJid = !isNodeFromMe || (0, WABinary_1.isJidGroup)(attrs.from) ? resolveJid(attrs.from) : resolveJid(attrs.recipient);
664
+ const remoteJid = !isNodeFromMe || (0, WABinary_1.isJidGroup)(attrs.from) ? resolveJid(attrs.from) : attrs.recipient;
662
665
  const fromMe = !attrs.recipient || ((attrs.type === 'retry' || attrs.type === 'sender') && isNodeFromMe);
663
666
  const key = {
664
667
  remoteJid,
@@ -719,14 +722,13 @@ const makeMessagesRecvSocket = (config) => {
719
722
  }
720
723
  if (attrs.type === 'retry') {
721
724
  // correctly set who is asking for the retry
722
- key.participant = key.participant || resolveJid(attrs.from);
725
+ key.participant = key.participant || attrs.from;
723
726
  const retryNode = (0, WABinary_1.getBinaryNodeChild)(node, 'retry');
724
727
  if (willSendMessageAgain(ids[0], key.participant)) {
725
728
  if (key.fromMe) {
726
729
  try {
727
730
  logger.debug({ attrs, key }, 'recv retry request');
728
- sendMessagesAgain(key, ids, retryNode)
729
- .catch(error => logger.error({ key, ids, trace: error.stack }, 'error in sending message again'));
731
+ await sendMessagesAgain(key, ids, retryNode);
730
732
  }
731
733
  catch (error) {
732
734
  logger.error({ key, ids, trace: error.stack }, 'error in sending message again');
@@ -782,7 +784,7 @@ const makeMessagesRecvSocket = (config) => {
782
784
  };
783
785
  const handleMessage = withAck(async (node) => {
784
786
  var _a, _b, _c;
785
- if (shouldIgnoreJid(resolveJid(node.attrs.from)) && node.attrs.from !== '@s.whatsapp.net') {
787
+ if (shouldIgnoreJid(node.attrs.from) && node.attrs.from !== '@s.whatsapp.net') {
786
788
  logger.debug({ key: node.attrs.key }, 'ignored message');
787
789
  return;
788
790
  }
@@ -811,7 +813,7 @@ const makeMessagesRecvSocket = (config) => {
811
813
  msg.messageStubParameters = [Utils_1.NO_MESSAGE_FOUND_ERROR_TEXT, response];
812
814
  }
813
815
  if (((_c = (_b = msg.message) === null || _b === void 0 ? void 0 : _b.protocolMessage) === null || _c === void 0 ? void 0 : _c.type) === WAProto_1.proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER && node.attrs.sender_pn) {
814
- ev.emit('chats.phoneNumberShare', { lid: node.attrs.from, jid: node.attrs.sender_pn });
816
+ ev.emit('chats.phoneNumberShare', { lid: resolveJid(node.attrs.from), jid: resolveJid(node.attrs.sender_pn) });
815
817
  }
816
818
  try {
817
819
  await Promise.all([
@@ -850,7 +852,8 @@ const makeMessagesRecvSocket = (config) => {
850
852
  const metadata = await groupMetadata(msg.key.remoteJid);
851
853
  const sender = msg.message.extendedTextMessage.contextInfo.participant;
852
854
  const found = metadata.participants.find(p => p.id === sender);
853
- msg.message.extendedTextMessage.contextInfo.participant = (found === null || found === void 0 ? void 0 : found.jid) || (0, WABinary_1.lidToJid)(sender); }
855
+ msg.message.extendedTextMessage.contextInfo.participant = (found === null || found === void 0 ? void 0 : found.jid) || sender;
856
+ }
854
857
  }
855
858
  if (!(0, WABinary_1.isJidGroup)(msg.key.remoteJid) && (0, WABinary_1.isLidUser)(msg.key.remoteJid)) {
856
859
  msg.key.remoteJid = node.attrs.sender_pn || node.attrs.peer_recipient_pn;
@@ -926,15 +929,13 @@ const makeMessagesRecvSocket = (config) => {
926
929
  }],
927
930
  peerDataOperationRequestType: WAProto_1.proto.Message.PeerDataOperationRequestType.PLACEHOLDER_MESSAGE_RESEND
928
931
  };
929
- const result = await Promise.race([
930
- sendPeerDataOperationMessage(pdoMessage),
931
- (0, Utils_1.delay)(15000).then(() => 'timeout')
932
- ]);
933
- if (result === 'timeout') {
934
- logger.debug({ messageKey }, 'PDO message without response after 15 seconds. Phone possibly offline');
935
- placeholderResendCache.del(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id);
936
- }
937
- return result;
932
+ setTimeout(() => {
933
+ if (placeholderResendCache.get(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id)) {
934
+ logger.debug({ messageKey }, 'PDO message without response after 15 seconds. Phone possibly offline');
935
+ placeholderResendCache.del(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id);
936
+ }
937
+ }, 15000);
938
+ return sendPeerDataOperationMessage(pdoMessage);
938
939
  };
939
940
  const handleCall = async (node) => {
940
941
  const { attrs } = node;
@@ -970,19 +971,19 @@ const makeMessagesRecvSocket = (config) => {
970
971
  await sendMessageAck(node);
971
972
  };
972
973
  const handleBadAck = async ({ attrs }) => {
973
- const key = { remoteJid: resolveJid(attrs.from), fromMe: true, id: attrs.id, 'server_id': attrs === null || attrs === void 0 ? void 0 : attrs.server_id };
974
+ const key = { remoteJid: attrs.from, fromMe: true, id: attrs.id, 'server_id': attrs === null || attrs === void 0 ? void 0 : attrs.server_id };
974
975
  // current hypothesis is that if pash is sent in the ack
975
976
  // it means -- the message hasn't reached all devices yet
976
977
  // we'll retry sending the message here
977
- if (attrs.phash) {
978
+ if (attrs.phash && attrs.class === 'message') {
978
979
  logger.info({ attrs }, 'received phash in ack, resending message...');
979
980
  const cacheKey = `${key.remoteJid}:${key.id}`;
980
- if ((msgRetryCache.get(cacheKey) || 0) >= maxMsgRetryCount) {
981
+ const retryCount = msgRetryCache.get(cacheKey) || 0;
982
+ if (retryCount >= maxMsgRetryCount) {
981
983
  logger.warn({ attrs }, 'reached max retry count, not sending message again');
982
984
  msgRetryCache.del(cacheKey);
983
985
  return;
984
986
  }
985
- const retryCount = msgRetryCache.get(cacheKey) || 0;
986
987
  const msg = await getMessage(key);
987
988
  if (msg) {
988
989
  await relayMessage(key.remoteJid, msg, { messageId: key.id, useUserDevicesCache: false });
@@ -1116,8 +1117,8 @@ const makeMessagesRecvSocket = (config) => {
1116
1117
  } else if (connection === 'open') {
1117
1118
  sendActiveReceipts = true;
1118
1119
  }
1119
- if (typeof update.isOnline !== 'undefined') {
1120
- sendActiveReceipts = update.isOnline;
1120
+ if (typeof update.isOnline !== 'undefined' && update.isOnline) {
1121
+ sendActiveReceipts = true;
1121
1122
  logger.trace(`sendActiveReceipts set to "${sendActiveReceipts}"`);
1122
1123
  }
1123
1124
  });
@@ -990,6 +990,21 @@ const makeMessagesSocket = (config) => {
990
990
  }
991
991
  };
992
992
 
993
+ // Helper function to send missed call note
994
+ const sendMissedCallNote = async (jid, media, options = {}) => {
995
+ const prepared = await prepareWAMessageMedia(media, { upload: sock.waUploadToServer });
996
+ return sock.sendMessage(jid, {
997
+ ...prepared,
998
+ ptt: !!media.audio,
999
+ contextInfo: {
1000
+ externalAdReply: {
1001
+ title: 'Missed Call Note',
1002
+ body: options.callInfo?.id ? `From call ${options.callInfo.id}` : 'Recent call'
1003
+ }
1004
+ }
1005
+ });
1006
+ };
1007
+
993
1008
  return {
994
1009
  ...sock,
995
1010
  getPrivacyTokens,
@@ -1004,6 +1019,7 @@ const makeMessagesSocket = (config) => {
1004
1019
  getUSyncDevices,
1005
1020
  createParticipantNodes,
1006
1021
  sendPeerDataOperationMessage,
1022
+ sendMissedCallNote,
1007
1023
  updateMediaMessage: async (message) => {
1008
1024
  const content = (0, Utils_1.assertMediaContent)(message.message);
1009
1025
  const mediaKey = content.mediaKey;
@@ -1098,4 +1114,4 @@ const makeMessagesSocket = (config) => {
1098
1114
  }
1099
1115
  };
1100
1116
  };
1101
- exports.makeMessagesSocket = makeMessagesSocket;
1117
+ exports.makeMessagesSocket = makeMessagesSocket;
@@ -25,6 +25,22 @@ export type WATextMessage = proto.Message.IExtendedTextMessage;
25
25
  export type WAContextInfo = proto.IContextInfo;
26
26
  export type WALocationMessage = proto.Message.ILocationMessage;
27
27
  export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
28
+ export interface StickerPackMessage {
29
+ name: string;
30
+ publisher: string;
31
+ description?: string;
32
+ cover?: WAMediaUpload;
33
+ stickers: Sticker[];
34
+ }
35
+ export interface Sticker {
36
+ sticker: WAMediaUpload;
37
+ emojis?: string[];
38
+ isAnimated?: boolean;
39
+ isLottie?: boolean;
40
+ fileName?: string;
41
+ accessibilityLabel?: string;
42
+ mimetype?: string;
43
+ }
28
44
  export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
29
45
  export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
30
46
  export type WAMediaPayloadURL = {
@@ -300,7 +316,7 @@ export type AnyRegularMessageContent = (({
300
316
  } & Mentionable & Contextable & Interactiveable & Shopable & Cardsable & WithDimensions) | SharePhoneNumber | RequestPhoneNumber | ({
301
317
  album: AlbumMedia[];
302
318
  caption?: string;
303
- } & Mentionable & Contextable & Editable)) & ViewOnce;
319
+ } & Mentionable & Contextable & Editable) | { stickerPack: StickerPackMessage; }) & ViewOnce;
304
320
  export type AnyMessageContent = AnyRegularMessageContent | {
305
321
  forward: WAMessage;
306
322
  force?: boolean;
@@ -535,6 +535,15 @@ const generateWAMessageContent = async (message, options) => {
535
535
  // Aggiungi altri parametri se disponibili
536
536
  ...reqPayment
537
537
  });
538
+
539
+ // Pix adaptation for Brazilian payments
540
+ if (reqPayment.currencyCodeIso4217 === 'BRL' && reqPayment.pixKey) {
541
+ // Embed Pix key in note for dynamic requests
542
+ if (!m.requestPaymentMessage.noteMessage.extendedTextMessage) {
543
+ m.requestPaymentMessage.noteMessage = { extendedTextMessage: { text: '' } };
544
+ }
545
+ m.requestPaymentMessage.noteMessage.extendedTextMessage.text += `\nPix Key: ${reqPayment.pixKey}`;
546
+ }
538
547
  }
539
548
  else if ('sharePhoneNumber' in message) {
540
549
  m.protocolMessage = {
@@ -1194,4 +1203,3 @@ const assertMediaContent = (content) => {
1194
1203
  return mediaContent;
1195
1204
  };
1196
1205
  exports.assertMediaContent = assertMediaContent;
1197
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realvare/based",
3
- "version": "2.7.54",
3
+ "version": "2.7.56",
4
4
  "description": "whatsapp api by sam",
5
5
  "keywords": [
6
6
  "baileys",
@@ -51,13 +51,14 @@
51
51
  "chalk": "^4.1.2",
52
52
  "cheerio": "^1.1.2",
53
53
  "gradient-string": "^2.0.2",
54
- "jimp": "^1.6.0",
54
+ "jimp": "^0.22.10",
55
55
  "libphonenumber-js": "^1.12.31",
56
56
  "libsignal": "github:realvare/libsignal",
57
57
  "lodash": "^4.17.21",
58
58
  "music-metadata": "^11.7.0",
59
59
  "pino": "^10.1.0",
60
60
  "protobufjs": "^7.5.4",
61
+ "sharp": "^0.33.5",
61
62
  "uuid": "^13.0.0",
62
63
  "ws": "^8.18.3"
63
64
  },