delkira-baileys 0.8.2
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/LICENSE +21 -0
- package/README.md +1584 -0
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +6035 -0
- package/WAProto/fix-imports.js +81 -0
- package/WAProto/index.d.ts +2 -0
- package/WAProto/index.js +132326 -0
- package/lib/Defaults/index.d.ts +74 -0
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +140 -0
- package/lib/Defaults/index.js.map +1 -0
- package/lib/Modded/message_builder.js +2330 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/ciphertext-message.js.map +1 -0
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group-session-builder.js.map +1 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.d.ts.map +1 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/index.js.map +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/keyhelper.js.map +1 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-chain-key.js.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-name.js.map +1 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-record.js.map +1 -0
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-key-state.js.map +1 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/Group/sender-message-key.js.map +1 -0
- package/lib/Signal/libsignal.d.ts +5 -0
- package/lib/Signal/libsignal.d.ts.map +1 -0
- package/lib/Signal/libsignal.js +403 -0
- package/lib/Signal/libsignal.js.map +1 -0
- package/lib/Signal/lid-mapping.d.ts +19 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -0
- package/lib/Signal/lid-mapping.js +271 -0
- package/lib/Signal/lid-mapping.js.map +1 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.d.ts.map +1 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/index.js.map +1 -0
- package/lib/Socket/Client/types.d.ts +16 -0
- package/lib/Socket/Client/types.d.ts.map +1 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/types.js.map +1 -0
- package/lib/Socket/Client/websocket.d.ts +13 -0
- package/lib/Socket/Client/websocket.d.ts.map +1 -0
- package/lib/Socket/Client/websocket.js +54 -0
- package/lib/Socket/Client/websocket.js.map +1 -0
- package/lib/Socket/business.d.ts +536 -0
- package/lib/Socket/business.d.ts.map +1 -0
- package/lib/Socket/business.js +422 -0
- package/lib/Socket/business.js.map +1 -0
- package/lib/Socket/chats.d.ts +111 -0
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +991 -0
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +645 -0
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/dugong.d.ts +130 -0
- package/lib/Socket/dugong.d.ts.map +1 -0
- package/lib/Socket/dugong.js +768 -0
- package/lib/Socket/dugong.js.map +1 -0
- package/lib/Socket/groups.d.ts +150 -0
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +327 -0
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +636 -0
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +15 -0
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/messages-recv.d.ts +238 -0
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +1308 -0
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Socket/messages-send.d.ts +579 -0
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +1595 -0
- package/lib/Socket/messages-send.js.map +1 -0
- package/lib/Socket/mex.d.ts +3 -0
- package/lib/Socket/mex.d.ts.map +1 -0
- package/lib/Socket/mex.js +48 -0
- package/lib/Socket/mex.js.map +1 -0
- package/lib/Socket/newsletter.d.ts +177 -0
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +456 -0
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/socket.d.ts +55 -0
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +936 -0
- package/lib/Socket/socket.js.map +1 -0
- package/lib/Types/Auth.d.ts +116 -0
- package/lib/Types/Auth.d.ts.map +1 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Auth.js.map +1 -0
- package/lib/Types/Bussines.d.ts +37 -0
- package/lib/Types/Bussines.d.ts.map +1 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Bussines.js.map +1 -0
- package/lib/Types/Call.d.ts +15 -0
- package/lib/Types/Call.d.ts.map +1 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Call.js.map +1 -0
- package/lib/Types/Chat.d.ts +123 -0
- package/lib/Types/Chat.d.ts.map +1 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Chat.js.map +1 -0
- package/lib/Types/Contact.d.ts +24 -0
- package/lib/Types/Contact.d.ts.map +1 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Contact.js.map +1 -0
- package/lib/Types/Events.d.ts +237 -0
- package/lib/Types/Events.d.ts.map +1 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/Events.js.map +1 -0
- package/lib/Types/GroupMetadata.d.ts +68 -0
- package/lib/Types/GroupMetadata.d.ts.map +1 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/GroupMetadata.js.map +1 -0
- package/lib/Types/Label.d.ts +47 -0
- package/lib/Types/Label.d.ts.map +1 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/Label.js.map +1 -0
- package/lib/Types/LabelAssociation.d.ts +30 -0
- package/lib/Types/LabelAssociation.d.ts.map +1 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/LabelAssociation.js.map +1 -0
- package/lib/Types/Message.d.ts +422 -0
- package/lib/Types/Message.d.ts.map +1 -0
- package/lib/Types/Message.js +11 -0
- package/lib/Types/Message.js.map +1 -0
- package/lib/Types/Newsletter.d.ts +135 -0
- package/lib/Types/Newsletter.d.ts.map +1 -0
- package/lib/Types/Newsletter.js +31 -0
- package/lib/Types/Newsletter.js.map +1 -0
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/Product.d.ts.map +1 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Product.js.map +1 -0
- package/lib/Types/Signal.d.ts +76 -0
- package/lib/Types/Signal.d.ts.map +1 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Signal.js.map +1 -0
- package/lib/Types/Socket.d.ts +158 -0
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +3 -0
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/State.d.ts +39 -0
- package/lib/Types/State.d.ts.map +1 -0
- package/lib/Types/State.js +13 -0
- package/lib/Types/State.js.map +1 -0
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/USync.d.ts.map +1 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/USync.js.map +1 -0
- package/lib/Types/index.d.ts +66 -0
- package/lib/Types/index.d.ts.map +1 -0
- package/lib/Types/index.js +33 -0
- package/lib/Types/index.js.map +1 -0
- package/lib/Utils/auth-utils.d.ts +19 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +290 -0
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/browser-utils.js.map +1 -0
- package/lib/Utils/business.d.ts +23 -0
- package/lib/Utils/business.d.ts.map +1 -0
- package/lib/Utils/business.js +231 -0
- package/lib/Utils/business.js.map +1 -0
- package/lib/Utils/chat-utils.d.ts +70 -0
- package/lib/Utils/chat-utils.d.ts.map +1 -0
- package/lib/Utils/chat-utils.js +812 -0
- package/lib/Utils/chat-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +37 -0
- package/lib/Utils/crypto.d.ts.map +1 -0
- package/lib/Utils/crypto.js +118 -0
- package/lib/Utils/crypto.js.map +1 -0
- package/lib/Utils/decode-wa-message.d.ts +48 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +283 -0
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +34 -0
- package/lib/Utils/event-buffer.d.ts.map +1 -0
- package/lib/Utils/event-buffer.js +574 -0
- package/lib/Utils/event-buffer.js.map +1 -0
- package/lib/Utils/generics.d.ts +91 -0
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +384 -0
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +22 -0
- package/lib/Utils/history.d.ts.map +1 -0
- package/lib/Utils/history.js +131 -0
- package/lib/Utils/history.js.map +1 -0
- package/lib/Utils/identity-change-handler.d.ts +37 -0
- package/lib/Utils/identity-change-handler.d.ts.map +1 -0
- package/lib/Utils/identity-change-handler.js +49 -0
- package/lib/Utils/identity-change-handler.js.map +1 -0
- package/lib/Utils/index.d.ts +23 -0
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +23 -0
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.d.ts.map +1 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/link-preview.js.map +1 -0
- package/lib/Utils/logger.d.ts +13 -0
- package/lib/Utils/logger.d.ts.map +1 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/logger.js.map +1 -0
- package/lib/Utils/lt-hash.d.ts +8 -0
- package/lib/Utils/lt-hash.d.ts.map +1 -0
- package/lib/Utils/lt-hash.js +8 -0
- package/lib/Utils/lt-hash.js.map +1 -0
- package/lib/Utils/make-mutex.d.ts +9 -0
- package/lib/Utils/make-mutex.d.ts.map +1 -0
- package/lib/Utils/make-mutex.js +33 -0
- package/lib/Utils/make-mutex.js.map +1 -0
- package/lib/Utils/message-retry-manager.d.ts +110 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -0
- package/lib/Utils/message-retry-manager.js +225 -0
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +130 -0
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +782 -0
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +91 -0
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +1240 -0
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.d.ts.map +1 -0
- package/lib/Utils/noise-handler.js +201 -0
- package/lib/Utils/noise-handler.js.map +1 -0
- package/lib/Utils/offline-node-processor.d.ts +17 -0
- package/lib/Utils/offline-node-processor.d.ts.map +1 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/offline-node-processor.js.map +1 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.d.ts.map +1 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/pre-key-manager.js.map +1 -0
- package/lib/Utils/process-message.d.ts +60 -0
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +528 -0
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/reporting-utils.d.ts +11 -0
- package/lib/Utils/reporting-utils.d.ts.map +1 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/reporting-utils.js.map +1 -0
- package/lib/Utils/rich-messages.d.ts +277 -0
- package/lib/Utils/rich-messages.d.ts.map +1 -0
- package/lib/Utils/rich-messages.js +1144 -0
- package/lib/Utils/rich-messages.js.map +1 -0
- package/lib/Utils/signal.d.ts +34 -0
- package/lib/Utils/signal.d.ts.map +1 -0
- package/lib/Utils/signal.js +159 -0
- package/lib/Utils/signal.js.map +1 -0
- package/lib/Utils/stanza-ack.d.ts +11 -0
- package/lib/Utils/stanza-ack.d.ts.map +1 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/stanza-ack.js.map +1 -0
- package/lib/Utils/sticker-pack.d.ts +10 -0
- package/lib/Utils/sticker-pack.js +111 -0
- package/lib/Utils/sync-action-utils.d.ts +19 -0
- package/lib/Utils/sync-action-utils.d.ts.map +1 -0
- package/lib/Utils/sync-action-utils.js +48 -0
- package/lib/Utils/sync-action-utils.js.map +1 -0
- package/lib/Utils/tc-token-utils.d.ts +12 -0
- package/lib/Utils/tc-token-utils.d.ts.map +1 -0
- package/lib/Utils/tc-token-utils.js +18 -0
- package/lib/Utils/tc-token-utils.js.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -0
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.d.ts.map +1 -0
- package/lib/Utils/validate-connection.js +200 -0
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/WABinary/constants.d.ts +28 -0
- package/lib/WABinary/constants.d.ts.map +1 -0
- package/lib/WABinary/constants.js +1301 -0
- package/lib/WABinary/constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +7 -0
- package/lib/WABinary/decode.d.ts.map +1 -0
- package/lib/WABinary/decode.js +262 -0
- package/lib/WABinary/decode.js.map +1 -0
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.d.ts.map +1 -0
- package/lib/WABinary/encode.js +220 -0
- package/lib/WABinary/encode.js.map +1 -0
- package/lib/WABinary/generic-utils.d.ts +17 -0
- package/lib/WABinary/generic-utils.d.ts.map +1 -0
- package/lib/WABinary/generic-utils.js +191 -0
- package/lib/WABinary/generic-utils.js.map +1 -0
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.d.ts.map +1 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/index.js.map +1 -0
- package/lib/WABinary/jid-utils.d.ts +48 -0
- package/lib/WABinary/jid-utils.d.ts.map +1 -0
- package/lib/WABinary/jid-utils.js +96 -0
- package/lib/WABinary/jid-utils.js.map +1 -0
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WABinary/types.d.ts.map +1 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WABinary/types.js.map +1 -0
- package/lib/WAM/BinaryInfo.d.ts +9 -0
- package/lib/WAM/BinaryInfo.d.ts.map +1 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/BinaryInfo.js.map +1 -0
- package/lib/WAM/constants.d.ts +40 -0
- package/lib/WAM/constants.d.ts.map +1 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/constants.js.map +1 -0
- package/lib/WAM/encode.d.ts +3 -0
- package/lib/WAM/encode.d.ts.map +1 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/encode.js.map +1 -0
- package/lib/WAM/index.d.ts +4 -0
- package/lib/WAM/index.d.ts.map +1 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAM/index.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +29 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +5 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +29 -0
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +94 -0
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +13 -0
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +23 -0
- package/lib/WAUSync/USyncUser.js.map +1 -0
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.d.ts.map +1 -0
- package/lib/WAUSync/index.js +4 -0
- package/lib/WAUSync/index.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -0
- package/package.json +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,1584 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://files.catbox.moe/e4lft4.jpg" alt="delkira-baileys banner" width="100%" />
|
|
4
|
+
|
|
5
|
+
# delkira-baileys
|
|
6
|
+
|
|
7
|
+
### Modded Baileys v7 β Interactive Messages, AI Rich Responses, Albums & More
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/delkira-baileys)
|
|
10
|
+
[](https://www.npmjs.com/package/delkira-baileys)
|
|
11
|
+
[](https://github.com/olivea777/delkira-baileys)
|
|
12
|
+
[](LICENSE)
|
|
13
|
+
[](https://nodejs.org)
|
|
14
|
+
[](#)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
**A modded build of [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)**
|
|
19
|
+
with native support for interactive messages, album messages, unified rich responses, newsletter helpers, status mentions, and additional business/community utilities.
|
|
20
|
+
|
|
21
|
+
This repository is a **distribution/build repo** for `delkira-baileys`.
|
|
22
|
+
It ships compiled runtime files in `lib/` and protobuf artifacts in `WAProto/`, and is intended to be consumed directly from npm or as a vendored dependency inside the **Delkira-MD** ecosystem.
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Table of Contents
|
|
29
|
+
|
|
30
|
+
- [delkira-baileys](#delkira-baileys)
|
|
31
|
+
- [Modded Baileys v7 β Interactive Messages, AI Rich Responses, Albums \& More](#modded-baileys-v7--interactive-messages-ai-rich-responses-albums--more)
|
|
32
|
+
- [Table of Contents](#table-of-contents)
|
|
33
|
+
- [β¨ Features](#-features)
|
|
34
|
+
- [β
Requirements](#-requirements)
|
|
35
|
+
- [π Whatβs Inside This Repo](#-whats-inside-this-repo)
|
|
36
|
+
- [π¦ Installation](#-installation)
|
|
37
|
+
- [From NPM](#from-npm)
|
|
38
|
+
- [Using Alias (Recommended for Delkira-MD Bots)](#using-alias-recommended-for-delkira-md-bots)
|
|
39
|
+
- [π οΈ Quick Start](#οΈ-quick-start)
|
|
40
|
+
- [1. Project Setup](#1-project-setup)
|
|
41
|
+
- [2. Install Dependencies](#2-install-dependencies)
|
|
42
|
+
- [3. Create `index.js`](#3-create-indexjs)
|
|
43
|
+
- [4. Run](#4-run)
|
|
44
|
+
- [5. Pairing Code Example](#5-pairing-code-example)
|
|
45
|
+
- [ποΈ Architecture](#οΈ-architecture)
|
|
46
|
+
- [Socket Layer Chain](#socket-layer-chain)
|
|
47
|
+
- [Key Modules](#key-modules)
|
|
48
|
+
- [Build Repo Layout](#build-repo-layout)
|
|
49
|
+
- [Connection Flow](#connection-flow)
|
|
50
|
+
- [π‘ Socket API Reference](#-socket-api-reference)
|
|
51
|
+
- [Connection \& Authentication](#connection--authentication)
|
|
52
|
+
- [Message Sending](#message-sending)
|
|
53
|
+
- [Interactive Messages](#interactive-messages)
|
|
54
|
+
- [Album Messages](#album-messages)
|
|
55
|
+
- [AI Rich Response Messages](#ai-rich-response-messages)
|
|
56
|
+
- [Code Block V2 (Unified Response)](#code-block-v2-unified-response)
|
|
57
|
+
- [Link Message (Inline Embeds)](#link-message-inline-embeds)
|
|
58
|
+
- [Other Message Types](#other-message-types)
|
|
59
|
+
- [Newsletter Methods](#newsletter-methods)
|
|
60
|
+
- [Group Methods](#group-methods)
|
|
61
|
+
- [Community Methods](#community-methods)
|
|
62
|
+
- [Business Methods](#business-methods)
|
|
63
|
+
- [Chat \& Profile Methods](#chat--profile-methods)
|
|
64
|
+
- [Privacy Settings](#privacy-settings)
|
|
65
|
+
- [π‘ Event Reference](#-event-reference)
|
|
66
|
+
- [π§ Utility Exports](#-utility-exports)
|
|
67
|
+
- [ποΈ Building This Package](#οΈ-building-this-package)
|
|
68
|
+
- [π Differences from Official Baileys](#-differences-from-official-baileys)
|
|
69
|
+
- [π€ Contributing](#-contributing)
|
|
70
|
+
- [π License](#-license)
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## β¨ Features
|
|
75
|
+
|
|
76
|
+
| Feature | Description | Status |
|
|
77
|
+
| --------------------------- | -------------------------------------------------------------------------------------- | ------ |
|
|
78
|
+
| **Interactive Messages** | Native flow buttons, list/select menus, button wrappers, carousel support via `Dugong` | β
|
|
|
79
|
+
| **Album Messages** | Multi-image/video album relay with count metadata and grouped delivery | β
|
|
|
80
|
+
| **Rich Response Helpers** | `sendTable`, `sendList`, `sendCodeBlock`, `sendRichMessage`, `sendUnifiedResponse` | β
|
|
|
81
|
+
| **Unified Response V2** | `sendTableV2`, `sendCodeBlockV2`, `sendLinkV2` with Meta-AI-style unified sections | β
|
|
|
82
|
+
| **Link Messages** | Rich inline links with citations, proofs, and forwarded bot context | β
|
|
|
83
|
+
| **Latex Rendering Hooks** | `sendLatex`, `sendLatexImage`, `sendLatexInlineImage` helper APIs | β
|
|
|
84
|
+
| **Payment Messages** | Request payment messages with note/sticker support | β
|
|
|
85
|
+
| **Product / Catalog** | Business product messages, catalog fetch/create/update/delete, cover photo helpers | β
|
|
|
86
|
+
| **Event / Poll Result** | Event message builders and poll result snapshots | β
|
|
|
87
|
+
| **Newsletter Extras** | URL resolve, metadata fetch, create/update, bulk follow, admin utilities, live updates | β
|
|
|
88
|
+
| **Communities & Groups** | Community CRUD, linked groups, invite workflows, join approval, labels | β
|
|
|
89
|
+
| **Status Mention** | `sendStatusMention()` helper to mention users/groups in status flows | β
|
|
|
90
|
+
| **LID & Session Handling** | LIDβPN mapping, session migration, retry/session recreation helpers | β
|
|
|
91
|
+
| **Build Output Ready** | Published runtime in `lib/` and protobuf artifacts in `WAProto/` | β
|
|
|
92
|
+
| **TypeScript Declarations** | Included `.d.ts` files for exported APIs and socket methods | β
|
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## β
Requirements
|
|
97
|
+
|
|
98
|
+
- **Node.js** `>= 20.0.0`
|
|
99
|
+
- **ESM project** (`"type": "module"` in your `package.json`)
|
|
100
|
+
- A persistent auth store implementation for production use
|
|
101
|
+
- Optional helpers depending on your use case:
|
|
102
|
+
- `pino` for logging
|
|
103
|
+
- `qrcode-terminal` if you want to render QR codes in the terminal yourself
|
|
104
|
+
- `sharp`, `jimp`, `audio-decode`, `link-preview-js` for optional media/rich utilities
|
|
105
|
+
|
|
106
|
+
> [!IMPORTANT]
|
|
107
|
+
> `delkira-baileys` is **ESM-only**. CommonJS projects will need migration or dynamic import wrappers.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## π Whatβs Inside This Repo
|
|
112
|
+
|
|
113
|
+
This package is not the TypeScript source workspace. It contains the compiled distributable files you actually publish/use.
|
|
114
|
+
|
|
115
|
+
| Path | Purpose |
|
|
116
|
+
| --------------------- | ------------------------------------------------------ |
|
|
117
|
+
| `lib/` | Main compiled runtime, types, socket layers, utilities |
|
|
118
|
+
| `WAProto/` | Generated protobuf runtime and typings |
|
|
119
|
+
| `package.json` | Published package metadata, dependencies, build script |
|
|
120
|
+
| `tsconfig.json` | TypeScript config used for authoring/build pipeline |
|
|
121
|
+
| `tsconfig.build.json` | Build-specific TS emit config targeting `lib/` |
|
|
122
|
+
| `proto-extract/` | Protobuf-related extraction/build assets |
|
|
123
|
+
|
|
124
|
+
If you are documenting or integrating this project, treat `lib/index.js` and `lib/index.d.ts` as the primary public surface.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## π¦ Installation
|
|
129
|
+
|
|
130
|
+
### From NPM
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npm install github:olivea777/delkira-baileys
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Recommended companion packages for examples in this README:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npm install pino qrcode-terminal
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Using Alias (Recommended for Delkira-MD Bots)
|
|
143
|
+
|
|
144
|
+
Add to `package.json`:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"dependencies": {
|
|
149
|
+
"delkira": "github:olivea777/delkira-baileys"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Then run:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm install
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
> [!TIP]
|
|
161
|
+
> Using the alias `delkira` allows you to `import delkira from 'delkira'` without changing existing code.
|
|
162
|
+
|
|
163
|
+
> [!NOTE]
|
|
164
|
+
> Peer dependencies such as `sharp`, `jimp`, `audio-decode`, and `link-preview-js` are optional. Install only what your bot features need.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## π οΈ Quick Start
|
|
169
|
+
|
|
170
|
+
### 1. Project Setup
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
mkdir my-bot && cd my-bot
|
|
174
|
+
npm init -y
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Ensure `package.json` has `"type": "module"`:
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"name": "my-bot",
|
|
182
|
+
"type": "module",
|
|
183
|
+
"dependencies": {
|
|
184
|
+
"delkira": "github:olivea777/delkira-baileys"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
> [!IMPORTANT]
|
|
190
|
+
> **Required**: `"type": "module"` β delkira-baileys is ESM-only. Without this, imports will fail.
|
|
191
|
+
|
|
192
|
+
### 2. Install Dependencies
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npm install github:olivea777/delkira-baileys pino qrcode-terminal
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 3. Create `index.js`
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
import makeWASocket, {
|
|
202
|
+
useMultiFileAuthState,
|
|
203
|
+
DisconnectReason,
|
|
204
|
+
Browsers,
|
|
205
|
+
} from "delkira-baileys";
|
|
206
|
+
import pino from "pino";
|
|
207
|
+
import qrcode from "qrcode-terminal";
|
|
208
|
+
|
|
209
|
+
const logger = pino({ level: "silent" });
|
|
210
|
+
|
|
211
|
+
async function startBot() {
|
|
212
|
+
const { state, saveCreds } = await useMultiFileAuthState("./session");
|
|
213
|
+
|
|
214
|
+
const sock = makeWASocket({
|
|
215
|
+
auth: state,
|
|
216
|
+
logger,
|
|
217
|
+
browser: Browsers.ubuntu("Chrome"),
|
|
218
|
+
syncFullHistory: false,
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
sock.ev.on("creds.update", saveCreds);
|
|
222
|
+
|
|
223
|
+
sock.ev.on("connection.update", ({ connection, lastDisconnect, qr }) => {
|
|
224
|
+
if (qr) {
|
|
225
|
+
qrcode.generate(qr, { small: true });
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (connection === "close") {
|
|
229
|
+
const shouldReconnect =
|
|
230
|
+
lastDisconnect?.error?.output?.statusCode !==
|
|
231
|
+
DisconnectReason.loggedOut;
|
|
232
|
+
if (shouldReconnect) startBot();
|
|
233
|
+
}
|
|
234
|
+
if (connection === "open") console.log("Connected!");
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
sock.ev.on("messages.upsert", async ({ messages }) => {
|
|
238
|
+
const msg = messages[0];
|
|
239
|
+
if (!msg?.message || msg.key.fromMe) return;
|
|
240
|
+
|
|
241
|
+
const text =
|
|
242
|
+
msg.message.conversation || msg.message.extendedTextMessage?.text || "";
|
|
243
|
+
|
|
244
|
+
if (text === ".ping") {
|
|
245
|
+
await sock.sendMessage(msg.key.remoteJid, { text: "Pong!" });
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
startBot();
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### 4. Run
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
node index.js
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Scan the QR code, wait until the socket reaches `connection: "open"`, then send `.ping` to test.
|
|
260
|
+
|
|
261
|
+
### 5. Pairing Code Example
|
|
262
|
+
|
|
263
|
+
If you prefer pairing code over QR:
|
|
264
|
+
|
|
265
|
+
```js
|
|
266
|
+
const sock = makeWASocket({
|
|
267
|
+
auth: state,
|
|
268
|
+
logger,
|
|
269
|
+
browser: Browsers.windows("Chrome"),
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
sock.ev.on("connection.update", async ({ connection }) => {
|
|
273
|
+
if (connection === "connecting") {
|
|
274
|
+
const code = await sock.requestPairingCode("6281234567890");
|
|
275
|
+
console.log("Pairing code:", code);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
You can also provide your own custom pairing code:
|
|
281
|
+
|
|
282
|
+
```js
|
|
283
|
+
const code = await sock.requestPairingCode("6281234567890", "A1B2C3D4");
|
|
284
|
+
console.log("Custom pairing code:", code);
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Custom pairing codes must be exactly `8` characters.
|
|
288
|
+
|
|
289
|
+
> [!WARNING]
|
|
290
|
+
> `printQRInTerminal` still exists in the type surface for compatibility, but it is **deprecated** in the current build. Prefer handling the `qr` value from `connection.update` yourself.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## ποΈ Architecture
|
|
295
|
+
|
|
296
|
+
### Socket Layer Chain
|
|
297
|
+
|
|
298
|
+
Each socket layer extends the previous via composition, adding functionality from bottom to top:
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
makeSocket β WebSocket + Noise protocol + pre-key management
|
|
302
|
+
makeChatsSocket β App state sync + chat modifications + profile
|
|
303
|
+
makeGroupsSocket β Group CRUD + participant management
|
|
304
|
+
makeMessagesSendSocket β Message sending + rich messages + relay
|
|
305
|
+
makeMessagesRecvSocket β Message receiving + decryption + notifications
|
|
306
|
+
makeBusinessSocket β Product catalog + business profile
|
|
307
|
+
makeCommunitiesSocket β Community CRUD + sub-groups
|
|
308
|
+
makeNewsletterSocket β Newsletter follow/unfollow/metadata
|
|
309
|
+
makeWASocket β TOP LEVEL EXPORT
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Key Modules
|
|
313
|
+
|
|
314
|
+
| Module | Path | Description |
|
|
315
|
+
| ------------ | --------------- | ---------------------------------------------------------------- |
|
|
316
|
+
| **Socket** | `lib/Socket/` | Connection, messaging, groups, newsletter, business, communities |
|
|
317
|
+
| **Signal** | `lib/Signal/` | Signal protocol: 1:1 encryption, group SenderKey, LID mapping |
|
|
318
|
+
| **WABinary** | `lib/WABinary/` | Binary node encoding/decoding, JID utilities |
|
|
319
|
+
| **Utils** | `lib/Utils/` | Crypto, auth state, noise handler, rich messages, media |
|
|
320
|
+
| **WAProto** | `WAProto/` | Compiled protobuf encode/decode |
|
|
321
|
+
| **WAUSync** | `lib/WAUSync/` | User sync protocol (contact, device, LID) |
|
|
322
|
+
| **WAM** | `lib/WAM/` | WhatsApp analytics binary encoding |
|
|
323
|
+
| **Types** | `lib/Types/` | Full TypeScript type definitions |
|
|
324
|
+
|
|
325
|
+
### Build Repo Layout
|
|
326
|
+
|
|
327
|
+
This repository does **not** currently expose a `src/` directory in the checked-in package tree.
|
|
328
|
+
|
|
329
|
+
That means:
|
|
330
|
+
|
|
331
|
+
- Documentation should reference **`lib/` as the public implementation**
|
|
332
|
+
- API discovery is best done through:
|
|
333
|
+
- `lib/index.js`
|
|
334
|
+
- `lib/index.d.ts`
|
|
335
|
+
- `lib/Socket/*.d.ts`
|
|
336
|
+
- `lib/Utils/*.d.ts`
|
|
337
|
+
- Consumers should treat this repo as a **ready-to-install runtime artifact**, not the authoring source tree
|
|
338
|
+
|
|
339
|
+
### Connection Flow
|
|
340
|
+
|
|
341
|
+
1. WebSocket connect β Noise XX handshake (Curve25519 + AES-256-GCM)
|
|
342
|
+
2. QR code or Pairing Code authentication
|
|
343
|
+
3. `CB:success` β upload pre-keys β send passive IQ β emit `connection: 'open'`
|
|
344
|
+
4. Store own LIDβPN mapping, migrate own session
|
|
345
|
+
5. Buffer events β process offline notifications β flush β `receivedPendingNotifications: true`
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## π‘ Socket API Reference
|
|
350
|
+
|
|
351
|
+
### Connection & Authentication
|
|
352
|
+
|
|
353
|
+
```js
|
|
354
|
+
const sock = makeWASocket({
|
|
355
|
+
auth: state, // AuthenticationState from useMultiFileAuthState
|
|
356
|
+
logger, // pino logger instance
|
|
357
|
+
browser: Browsers.ubuntu("Chrome"), // Browser identity
|
|
358
|
+
version: [2, 3000, 1035194821], // WA version
|
|
359
|
+
connectTimeoutMs: 20_000, // Connection timeout
|
|
360
|
+
defaultQueryTimeoutMs: 60_000, // Query timeout
|
|
361
|
+
retryRequestDelayMs: 250, // Retry delay
|
|
362
|
+
maxMsgRetryCount: 5, // Max message retry count
|
|
363
|
+
enableRecentMessageCache: true, // Enable message retry manager
|
|
364
|
+
enableAutoSessionRecreation: true,
|
|
365
|
+
syncFullHistory: false, // Sync full chat history
|
|
366
|
+
shouldIgnoreJid: (jid) => false, // Filter specific JIDs
|
|
367
|
+
qrTimeout: 60_000,
|
|
368
|
+
generateHighQualityLinkPreview: false,
|
|
369
|
+
});
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**Pairing Code Authentication:**
|
|
373
|
+
|
|
374
|
+
```js
|
|
375
|
+
const sock = makeWASocket({
|
|
376
|
+
auth: state,
|
|
377
|
+
logger,
|
|
378
|
+
browser: Browsers.windows("Chrome"),
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
sock.ev.on("connection.update", async ({ connection, qr, isNewLogin }) => {
|
|
382
|
+
if (qr) {
|
|
383
|
+
// QR code available (fallback)
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Request pairing code
|
|
388
|
+
const code = await sock.requestPairingCode("6281234567890");
|
|
389
|
+
console.log("Pairing code:", code); // e.g. "A1B2-C3D4"
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
**Authentication State:**
|
|
393
|
+
|
|
394
|
+
```js
|
|
395
|
+
import { useMultiFileAuthState } from "delkira-baileys";
|
|
396
|
+
|
|
397
|
+
const { state, saveCreds } = await useMultiFileAuthState("./session");
|
|
398
|
+
// state.creds β credentials (me, platform, noise keys, etc.)
|
|
399
|
+
// state.keys β SignalKeyStore (pre-keys, sessions, identity keys, etc.)
|
|
400
|
+
// saveCreds() β persist credentials to disk
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Custom Data Store / Memory Store Pattern:**
|
|
404
|
+
|
|
405
|
+
```js
|
|
406
|
+
import {
|
|
407
|
+
BufferJSON,
|
|
408
|
+
initAuthCreds,
|
|
409
|
+
makeCacheableSignalKeyStore,
|
|
410
|
+
} from "delkira-baileys";
|
|
411
|
+
|
|
412
|
+
const credsStore = new Map();
|
|
413
|
+
const keyStoreData = new Map();
|
|
414
|
+
|
|
415
|
+
const creds = credsStore.get("creds") || initAuthCreds();
|
|
416
|
+
|
|
417
|
+
const keys = makeCacheableSignalKeyStore({
|
|
418
|
+
get: async (type, ids) => {
|
|
419
|
+
const data = {};
|
|
420
|
+
for (const id of ids) {
|
|
421
|
+
data[id] = keyStoreData.get(`${type}:${id}`);
|
|
422
|
+
}
|
|
423
|
+
return data;
|
|
424
|
+
},
|
|
425
|
+
set: async (data) => {
|
|
426
|
+
for (const category in data) {
|
|
427
|
+
for (const id in data[category]) {
|
|
428
|
+
const value = data[category][id];
|
|
429
|
+
const key = `${category}:${id}`;
|
|
430
|
+
if (value == null) keyStoreData.delete(key);
|
|
431
|
+
else keyStoreData.set(key, value);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
const state = { creds, keys };
|
|
438
|
+
|
|
439
|
+
const saveCreds = async () => {
|
|
440
|
+
credsStore.set(
|
|
441
|
+
"creds",
|
|
442
|
+
JSON.parse(
|
|
443
|
+
JSON.stringify(state.creds, BufferJSON.replacer),
|
|
444
|
+
BufferJSON.reviver,
|
|
445
|
+
),
|
|
446
|
+
);
|
|
447
|
+
};
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
This package does **not** currently ship a built-in `makeInMemoryStore()` helper.
|
|
451
|
+
|
|
452
|
+
Use these patterns instead:
|
|
453
|
+
|
|
454
|
+
- `useMultiFileAuthState()` for bot/local usage
|
|
455
|
+
- `initAuthCreds()` + custom `SignalKeyStore` for DB/Redis/in-memory persistence
|
|
456
|
+
- `makeCacheableSignalKeyStore()` when you want faster repeated key access with caching
|
|
457
|
+
|
|
458
|
+
> [!WARNING]
|
|
459
|
+
> `useMultiFileAuthState()` is convenient for bots and local testing, but the package itself warns against using it as your long-term production persistence layer. For production, write your own SQL/NoSQL-backed auth store.
|
|
460
|
+
|
|
461
|
+
**Useful companion helpers:**
|
|
462
|
+
|
|
463
|
+
```js
|
|
464
|
+
import {
|
|
465
|
+
Browsers,
|
|
466
|
+
DisconnectReason,
|
|
467
|
+
fetchLatestBaileysVersion,
|
|
468
|
+
makeCacheableSignalKeyStore,
|
|
469
|
+
} from "delkira-baileys";
|
|
470
|
+
|
|
471
|
+
const { version, isLatest } = await fetchLatestBaileysVersion();
|
|
472
|
+
console.log(version, isLatest);
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
### Message Sending
|
|
478
|
+
|
|
479
|
+
```js
|
|
480
|
+
// Text
|
|
481
|
+
await sock.sendMessage(jid, { text: "Hello!" });
|
|
482
|
+
|
|
483
|
+
// Text with mention
|
|
484
|
+
await sock.sendMessage(jid, {
|
|
485
|
+
text: "Hello @628xxx!",
|
|
486
|
+
mentions: ["628xxx@s.whatsapp.net"],
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
// Image
|
|
490
|
+
await sock.sendMessage(jid, {
|
|
491
|
+
image: { url: "./photo.jpg" },
|
|
492
|
+
caption: "A photo",
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// Video
|
|
496
|
+
await sock.sendMessage(jid, {
|
|
497
|
+
video: { url: "./video.mp4" },
|
|
498
|
+
caption: "A video",
|
|
499
|
+
gifPlayback: false,
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
// Audio
|
|
503
|
+
await sock.sendMessage(jid, {
|
|
504
|
+
audio: { url: "./audio.ogg" },
|
|
505
|
+
mimetype: "audio/ogg; codecs=opus",
|
|
506
|
+
ptt: true, // voice note
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
// Sticker
|
|
510
|
+
await sock.sendMessage(jid, {
|
|
511
|
+
sticker: { url: "./sticker.webp" },
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// Sticker pack
|
|
515
|
+
await sock.sendMessage(
|
|
516
|
+
jid,
|
|
517
|
+
makeStickerPack({
|
|
518
|
+
name: "Delkira Starter Pack",
|
|
519
|
+
publisher: "Delkira",
|
|
520
|
+
description: "Starter sticker pack",
|
|
521
|
+
stickers: [
|
|
522
|
+
{ url: "./stickers/1.webp", emojis: ["π₯"] },
|
|
523
|
+
{ url: "./stickers/2.webp", emojis: ["π"] },
|
|
524
|
+
],
|
|
525
|
+
cover: { url: "./stickers/cover.webp" },
|
|
526
|
+
}),
|
|
527
|
+
);
|
|
528
|
+
|
|
529
|
+
// Document
|
|
530
|
+
await sock.sendMessage(jid, {
|
|
531
|
+
document: { url: "./file.pdf" },
|
|
532
|
+
fileName: "document.pdf",
|
|
533
|
+
mimetype: "application/pdf",
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// Reaction
|
|
537
|
+
await sock.sendMessage(jid, {
|
|
538
|
+
react: { key: msg.key, text: "π" },
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
// Location
|
|
542
|
+
await sock.sendMessage(jid, {
|
|
543
|
+
location: {
|
|
544
|
+
degreesLatitude: -6.2,
|
|
545
|
+
degreesLongitude: 106.8,
|
|
546
|
+
name: "Jakarta",
|
|
547
|
+
},
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
// Contact
|
|
551
|
+
await sock.sendMessage(jid, {
|
|
552
|
+
contacts: {
|
|
553
|
+
displayName: "Contacts",
|
|
554
|
+
contacts: [
|
|
555
|
+
{ vcard: "BEGIN:VCARD\nVERSION:3.0\nFN:John\nTEL:+628xxx\nEND:VCARD" },
|
|
556
|
+
],
|
|
557
|
+
},
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// Poll
|
|
561
|
+
await sock.sendMessage(jid, {
|
|
562
|
+
poll: {
|
|
563
|
+
name: "Vote!",
|
|
564
|
+
values: ["Option A", "Option B", "Option C"],
|
|
565
|
+
selectableCount: 1,
|
|
566
|
+
},
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
// Forward message
|
|
570
|
+
await sock.sendMessage(jid, {
|
|
571
|
+
forward: msg,
|
|
572
|
+
forwardingScore: 1,
|
|
573
|
+
isForwarded: true,
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
// Delete message
|
|
577
|
+
await sock.sendMessage(jid, { delete: msg.key });
|
|
578
|
+
|
|
579
|
+
// Edit message
|
|
580
|
+
await sock.sendMessage(jid, {
|
|
581
|
+
text: "Edited text",
|
|
582
|
+
edit: msg.key,
|
|
583
|
+
});
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
### Interactive Messages
|
|
589
|
+
|
|
590
|
+
**Native Flow Buttons:**
|
|
591
|
+
|
|
592
|
+
```js
|
|
593
|
+
await sock.sendMessage(jid, {
|
|
594
|
+
interactiveMessage: {
|
|
595
|
+
title: "Welcome!",
|
|
596
|
+
footer: "Powered by Delkira",
|
|
597
|
+
buttons: [
|
|
598
|
+
{
|
|
599
|
+
name: "quick_reply",
|
|
600
|
+
buttonParamsJson: JSON.stringify({
|
|
601
|
+
display_text: "Menu",
|
|
602
|
+
id: "menu",
|
|
603
|
+
}),
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
name: "cta_url",
|
|
607
|
+
buttonParamsJson: JSON.stringify({
|
|
608
|
+
display_text: "Website",
|
|
609
|
+
url: "https://example.com",
|
|
610
|
+
}),
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
name: "cta_copy",
|
|
614
|
+
buttonParamsJson: JSON.stringify({
|
|
615
|
+
display_text: "Copy Code",
|
|
616
|
+
copy_code: "DELKIRA",
|
|
617
|
+
}),
|
|
618
|
+
},
|
|
619
|
+
],
|
|
620
|
+
header: "Choose an option",
|
|
621
|
+
image: { url: "https://example.com/banner.jpg" },
|
|
622
|
+
},
|
|
623
|
+
});
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
**List Menu (single_select):**
|
|
627
|
+
|
|
628
|
+
```js
|
|
629
|
+
await sock.sendMessage(jid, {
|
|
630
|
+
interactiveMessage: {
|
|
631
|
+
title: "Select Category",
|
|
632
|
+
footer: "Powered by Delkira",
|
|
633
|
+
buttons: [
|
|
634
|
+
{
|
|
635
|
+
name: "single_select",
|
|
636
|
+
buttonParamsJson: JSON.stringify({
|
|
637
|
+
title: "Menu",
|
|
638
|
+
sections: [
|
|
639
|
+
{
|
|
640
|
+
title: "Games",
|
|
641
|
+
rows: [
|
|
642
|
+
{ title: "Quiz", id: ".quiz" },
|
|
643
|
+
{ title: "Tebak Gambar", id: ".tebakgambar" },
|
|
644
|
+
],
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
title: "Tools",
|
|
648
|
+
rows: [
|
|
649
|
+
{ title: "Sticker", id: ".sticker" },
|
|
650
|
+
{ title: "TTS", id: ".tts" },
|
|
651
|
+
],
|
|
652
|
+
},
|
|
653
|
+
],
|
|
654
|
+
}),
|
|
655
|
+
},
|
|
656
|
+
],
|
|
657
|
+
header: "Bot Menu",
|
|
658
|
+
},
|
|
659
|
+
});
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
### Album Messages
|
|
665
|
+
|
|
666
|
+
```js
|
|
667
|
+
await sock.sendMessage(jid, {
|
|
668
|
+
albumMessage: [
|
|
669
|
+
{ image: { url: "./photo1.jpg" }, caption: "First" },
|
|
670
|
+
{ image: { url: "./photo2.jpg" }, caption: "Second" },
|
|
671
|
+
{ video: { url: "./clip.mp4" }, caption: "Video" },
|
|
672
|
+
],
|
|
673
|
+
});
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
> [!NOTE]
|
|
677
|
+
> Albums automatically set `expectedImageCount` and `expectedVideoCount` based on array content.
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
### AI Rich Response Messages
|
|
682
|
+
|
|
683
|
+
Send messages styled like Meta AI β tables, code blocks, and rich text. All rendered via `botForwardedMessage` > `richResponseMessage`.
|
|
684
|
+
|
|
685
|
+
**Table (with heading):**
|
|
686
|
+
|
|
687
|
+
```js
|
|
688
|
+
await sock.sendTable(
|
|
689
|
+
jid,
|
|
690
|
+
"Java vs JavaScript",
|
|
691
|
+
["Feature", "Java", "JavaScript"],
|
|
692
|
+
[
|
|
693
|
+
["Type", "Compiled", "Interpreted"],
|
|
694
|
+
["Typing", "Static", "Dynamic"],
|
|
695
|
+
["Main Use", "Enterprise", "Web, Full-stack"],
|
|
696
|
+
],
|
|
697
|
+
quoted,
|
|
698
|
+
{
|
|
699
|
+
headerText: "Comparison:",
|
|
700
|
+
footer: "Hope this helps!",
|
|
701
|
+
},
|
|
702
|
+
);
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
**List (without heading):**
|
|
706
|
+
|
|
707
|
+
```js
|
|
708
|
+
await sock.sendList(
|
|
709
|
+
jid,
|
|
710
|
+
"Bot Info",
|
|
711
|
+
[
|
|
712
|
+
["Name", "Delkira AI"],
|
|
713
|
+
["Version", "2.4.0"],
|
|
714
|
+
["Developer", "Zann"],
|
|
715
|
+
],
|
|
716
|
+
quoted,
|
|
717
|
+
{ footer: "Β© Delkira AI" },
|
|
718
|
+
);
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
**Code Block V1 (basic syntax highlighting):**
|
|
722
|
+
|
|
723
|
+
```js
|
|
724
|
+
await sock.sendCodeBlock(
|
|
725
|
+
jid,
|
|
726
|
+
`const greeting = "Hello World"
|
|
727
|
+
function sayHello(name) {
|
|
728
|
+
return greeting + " " + name
|
|
729
|
+
}
|
|
730
|
+
sayHello("Delkira")`,
|
|
731
|
+
quoted,
|
|
732
|
+
{
|
|
733
|
+
language: "javascript",
|
|
734
|
+
title: "Example Code",
|
|
735
|
+
footer: "Powered by Delkira",
|
|
736
|
+
},
|
|
737
|
+
);
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
**Supported V1 languages:** `javascript`, `typescript`, `python`
|
|
741
|
+
|
|
742
|
+
**Table V2 (Unified Response):**
|
|
743
|
+
|
|
744
|
+
The V2 table uses the **unified response** format with `GenATableUXPrimitive` typename and base64-encoded data, matching the Meta AI rich response protocol.
|
|
745
|
+
|
|
746
|
+
**Features over V1:**
|
|
747
|
+
|
|
748
|
+
- String-based table input with flexible delimiters (`|` or `,` for columns, `;;` for rows)
|
|
749
|
+
- Unified response sections with `GenATableUXPrimitive` / `GenAIMarkdownTextUXPrimitive` typenames
|
|
750
|
+
- Dual output: `rows` (for submessages) + `unified_rows` (for sections)
|
|
751
|
+
- Enhanced `contextInfo` with `botMessageSharingInfo`
|
|
752
|
+
|
|
753
|
+
```js
|
|
754
|
+
await sock.sendTableV2(
|
|
755
|
+
jid,
|
|
756
|
+
[
|
|
757
|
+
"Java vs JavaScript", // title
|
|
758
|
+
"Feature | Java | JavaScript", // header (pipe-delimited)
|
|
759
|
+
"Type | Compiled | Interpreted;;Typing | Static | Dynamic;;Main Use | Enterprise | Web, Full-stack", // rows (;; separated, | or , delimited)
|
|
760
|
+
],
|
|
761
|
+
quoted,
|
|
762
|
+
{
|
|
763
|
+
headerText: "Comparison:",
|
|
764
|
+
text: "Here is a comparison table:",
|
|
765
|
+
footer: "Hope this helps!",
|
|
766
|
+
},
|
|
767
|
+
);
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
**Input format:**
|
|
771
|
+
|
|
772
|
+
- `table[0]` β title string
|
|
773
|
+
- `table[1]` β header row (columns separated by `|` or `,`)
|
|
774
|
+
- `table[2+]` β data rows (rows separated by `;;`, columns by `|` or `,`)
|
|
775
|
+
|
|
776
|
+
**V2 Options:**
|
|
777
|
+
|
|
778
|
+
| Option | Type | Default | Description |
|
|
779
|
+
| ------------ | -------- | ------- | ---------------------------------------------------- |
|
|
780
|
+
| `title` | `string` | β | Title (used if `headerText` not set) |
|
|
781
|
+
| `headerText` | `string` | β | Text shown before the table |
|
|
782
|
+
| `text` | `string` | β | Markdown text section (GenAIMarkdownTextUXPrimitive) |
|
|
783
|
+
| `footer` | `string` | β | Text shown after the table |
|
|
784
|
+
|
|
785
|
+
---
|
|
786
|
+
|
|
787
|
+
### Code Block V2 (Unified Response)
|
|
788
|
+
|
|
789
|
+
The V2 code block uses the **unified response** format with `sections/view_model/primitive` structure and base64-encoded data, matching the Meta AI rich response protocol exactly.
|
|
790
|
+
|
|
791
|
+
**Features over V1:**
|
|
792
|
+
|
|
793
|
+
- 6 language families with keyword detection
|
|
794
|
+
- `/* */` block comment support
|
|
795
|
+
- `#` comment support for python/bash/lua
|
|
796
|
+
- Hex/binary/octal number literals
|
|
797
|
+
- Dual token output: numeric `codeBlock` + string-typed `unified_codeBlock`
|
|
798
|
+
- Unified response sections with `GenAICodeUXPrimitive` / `GenAIMarkdownTextUXPrimitive` typenames
|
|
799
|
+
- Enhanced `contextInfo` with `botMessageSharingInfo`
|
|
800
|
+
|
|
801
|
+
```js
|
|
802
|
+
await sock.sendCodeBlockV2(
|
|
803
|
+
jid,
|
|
804
|
+
`package main
|
|
805
|
+
|
|
806
|
+
import "fmt"
|
|
807
|
+
|
|
808
|
+
func main() {
|
|
809
|
+
fmt.Println("Hello, World!")
|
|
810
|
+
}`,
|
|
811
|
+
quoted,
|
|
812
|
+
{
|
|
813
|
+
language: "go",
|
|
814
|
+
title: "Go Example",
|
|
815
|
+
text: "Here is a Go code snippet:",
|
|
816
|
+
footer: "Powered by Delkira",
|
|
817
|
+
},
|
|
818
|
+
);
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
**Supported V2 languages:**
|
|
822
|
+
|
|
823
|
+
| Language Key | Aliases |
|
|
824
|
+
| ------------ | ------------------------ |
|
|
825
|
+
| `javascript` | `js`, `typescript`, `ts` |
|
|
826
|
+
| `python` | `py` |
|
|
827
|
+
| `go` | `golang` |
|
|
828
|
+
| `lua` | β |
|
|
829
|
+
| `bash` | `sh`, `shell` |
|
|
830
|
+
|
|
831
|
+
**V2 Options:**
|
|
832
|
+
|
|
833
|
+
| Option | Type | Default | Description |
|
|
834
|
+
| ---------- | -------- | -------------- | ---------------------------------------------------- |
|
|
835
|
+
| `language` | `string` | `'javascript'` | Programming language for syntax highlighting |
|
|
836
|
+
| `title` | `string` | β | Title text shown before the code block |
|
|
837
|
+
| `text` | `string` | β | Markdown text section (GenAIMarkdownTextUXPrimitive) |
|
|
838
|
+
| `footer` | `string` | β | Footer text shown after the code block |
|
|
839
|
+
|
|
840
|
+
**V2 Token Types:**
|
|
841
|
+
|
|
842
|
+
| Code | V1 Name | V2 Name | Description |
|
|
843
|
+
| ---- | --------- | --------- | -------------------------------------------------- |
|
|
844
|
+
| 0 | `DEFAULT` | `DEFAULT` | Normal text, whitespace, operators |
|
|
845
|
+
| 1 | `KEYWORD` | `KEYWORD` | Language keywords (`const`, `func`, `if`, etc.) |
|
|
846
|
+
| 2 | `METHOD` | `METHOD` | Function/method calls (identifier followed by `(`) |
|
|
847
|
+
| 3 | `STRING` | `STR` | String literals (`"..."`, `'...'`, `` `...` ``) |
|
|
848
|
+
| 4 | `NUMBER` | `NUMBER` | Numeric values (int, float, hex, binary, octal) |
|
|
849
|
+
| 5 | `COMMENT` | `COMMENT` | Comments (`//`, `/* */`, `#`) |
|
|
850
|
+
|
|
851
|
+
---
|
|
852
|
+
|
|
853
|
+
### Link Message (Inline Embeds)
|
|
854
|
+
|
|
855
|
+
Send rich text with inline clickable links using `{{IE_N}}display_text{{/IE_N}}` placeholders, with optional citation metadata and verification proofs.
|
|
856
|
+
|
|
857
|
+
```js
|
|
858
|
+
await sock.sendLink(
|
|
859
|
+
jid,
|
|
860
|
+
"Upload results:\nβ
Freeimage\nπ Klik: {{IE_0}}link disini{{/IE_0}}\nβ
Yardsansh\nπ Klik: {{IE_1}}link disini{{/IE_1}}",
|
|
861
|
+
["https://example.com/upload1", "https://example.com/upload2"],
|
|
862
|
+
quoted,
|
|
863
|
+
{
|
|
864
|
+
headerText: "π Media Uploader V3",
|
|
865
|
+
footer: "β¨ Selesai!",
|
|
866
|
+
botJid: "867051314767696@bot",
|
|
867
|
+
forwardingScore: 3,
|
|
868
|
+
citations: [
|
|
869
|
+
{
|
|
870
|
+
sourceTitle: "Freeimage",
|
|
871
|
+
citationNumber: 1,
|
|
872
|
+
faviconCdnUrl: "https://cdn.example.com/favicon.ico",
|
|
873
|
+
},
|
|
874
|
+
{ sourceTitle: "Yardsansh", citationNumber: 2 },
|
|
875
|
+
],
|
|
876
|
+
proofs: [
|
|
877
|
+
{
|
|
878
|
+
version: 1,
|
|
879
|
+
useCase: 1,
|
|
880
|
+
signature: "base64signature==",
|
|
881
|
+
certificateChain: ["base64cert1", "base64cert2"],
|
|
882
|
+
},
|
|
883
|
+
],
|
|
884
|
+
},
|
|
885
|
+
);
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
**Link Options:**
|
|
889
|
+
|
|
890
|
+
| Option | Type | Default | Description |
|
|
891
|
+
| ----------------- | ------------ | ----------------------- | ------------------------------------- |
|
|
892
|
+
| `headerText` | `string` | β | Text shown before the link content |
|
|
893
|
+
| `footer` | `string` | β | Text shown after the link content |
|
|
894
|
+
| `botJid` | `string` | `'867051314767696@bot'` | Bot JID for forwardedAiBotMessageInfo |
|
|
895
|
+
| `forwardingScore` | `number` | `3` | Forward score for context info |
|
|
896
|
+
| `citations` | `Citation[]` | `[]` | Citation metadata entries |
|
|
897
|
+
| `proofs` | `Proof[]` | `[]` | Verification proof entries |
|
|
898
|
+
|
|
899
|
+
**Citation object:**
|
|
900
|
+
|
|
901
|
+
| Field | Type | Description |
|
|
902
|
+
| ---------------- | -------- | -------------------------------------------- |
|
|
903
|
+
| `sourceQuery` | `string` | Source query text |
|
|
904
|
+
| `faviconCdnUrl` | `string` | CDN URL for favicon |
|
|
905
|
+
| `citationNumber` | `number` | Citation index (auto-incremented if omitted) |
|
|
906
|
+
| `sourceTitle` | `string` | Title of the source |
|
|
907
|
+
|
|
908
|
+
**Proof object:**
|
|
909
|
+
|
|
910
|
+
| Field | Type | Description |
|
|
911
|
+
| ------------------ | ---------- | ------------------------ |
|
|
912
|
+
| `version` | `number` | Proof version |
|
|
913
|
+
| `useCase` | `number` | Use case identifier |
|
|
914
|
+
| `signature` | `string` | Base64 signature |
|
|
915
|
+
| `certificateChain` | `string[]` | Base64 certificate chain |
|
|
916
|
+
|
|
917
|
+
**Link V2 (search-result style):**
|
|
918
|
+
|
|
919
|
+
```js
|
|
920
|
+
await sock.sendLinkV2(
|
|
921
|
+
jid,
|
|
922
|
+
"Search results:\n- {{IE_0}}Official docs{{/IE_0}}\n- {{IE_1}}GitHub repo{{/IE_1}}",
|
|
923
|
+
[
|
|
924
|
+
{
|
|
925
|
+
url: "https://www.npmjs.com/package/delkira-baileys",
|
|
926
|
+
displayName: "Official docs",
|
|
927
|
+
sourceDisplayName: "npm",
|
|
928
|
+
sourceSubtitle: "package registry",
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
url: "https://github.com/olivea777/delkira-baileys",
|
|
932
|
+
displayName: "GitHub repo",
|
|
933
|
+
sourceDisplayName: "github",
|
|
934
|
+
sourceSubtitle: "source hosting",
|
|
935
|
+
},
|
|
936
|
+
],
|
|
937
|
+
quoted,
|
|
938
|
+
{
|
|
939
|
+
headerText: "delkira-baileys",
|
|
940
|
+
footer: "Reference links",
|
|
941
|
+
searchEngine: "MAME",
|
|
942
|
+
},
|
|
943
|
+
);
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
### Other Message Types
|
|
949
|
+
|
|
950
|
+
**Payment Request:**
|
|
951
|
+
|
|
952
|
+
```js
|
|
953
|
+
await sock.sendMessage(jid, {
|
|
954
|
+
requestPaymentMessage: {
|
|
955
|
+
amount: 50000,
|
|
956
|
+
currency: "IDR",
|
|
957
|
+
note: "Payment for order #123",
|
|
958
|
+
from: "628xxx@s.whatsapp.net",
|
|
959
|
+
},
|
|
960
|
+
});
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
**Event:**
|
|
964
|
+
|
|
965
|
+
```js
|
|
966
|
+
await sock.sendMessage(jid, {
|
|
967
|
+
eventMessage: {
|
|
968
|
+
name: "Community Meetup",
|
|
969
|
+
description: "Join us for the monthly meetup!",
|
|
970
|
+
startTime: Date.now() + 86400000,
|
|
971
|
+
endTime: Date.now() + 90000000,
|
|
972
|
+
location: {
|
|
973
|
+
name: "Jakarta",
|
|
974
|
+
degreesLatitude: -6.2,
|
|
975
|
+
degreesLongitude: 106.8,
|
|
976
|
+
},
|
|
977
|
+
},
|
|
978
|
+
});
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
**Poll Result:**
|
|
982
|
+
|
|
983
|
+
```js
|
|
984
|
+
await sock.sendMessage(jid, {
|
|
985
|
+
pollResultMessage: {
|
|
986
|
+
name: "Favorite Color?",
|
|
987
|
+
pollVotes: [
|
|
988
|
+
{ optionName: "Red", optionVoteCount: 42 },
|
|
989
|
+
{ optionName: "Blue", optionVoteCount: 38 },
|
|
990
|
+
{ optionName: "Green", optionVoteCount: 25 },
|
|
991
|
+
],
|
|
992
|
+
},
|
|
993
|
+
});
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
**Status with Mentions:**
|
|
997
|
+
|
|
998
|
+
```js
|
|
999
|
+
await sock.sendStatusMention({ text: "Big update coming!" }, [
|
|
1000
|
+
"628xxx@s.whatsapp.net",
|
|
1001
|
+
"groupid@g.us",
|
|
1002
|
+
]);
|
|
1003
|
+
```
|
|
1004
|
+
|
|
1005
|
+
**Product Message:**
|
|
1006
|
+
|
|
1007
|
+
```js
|
|
1008
|
+
await sock.sendMessage(jid, {
|
|
1009
|
+
productMessage: {
|
|
1010
|
+
title: "Wireless Headphones",
|
|
1011
|
+
description: "High quality bluetooth headphones",
|
|
1012
|
+
productId: "WH-001",
|
|
1013
|
+
retailerId: "delkira-shop",
|
|
1014
|
+
url: "https://example.com/product",
|
|
1015
|
+
priceAmount1000: 299000,
|
|
1016
|
+
currencyCode: "IDR",
|
|
1017
|
+
thumbnail: { url: "https://example.com/product.jpg" },
|
|
1018
|
+
body: "Check out this product!",
|
|
1019
|
+
footer: "Delkira Shop",
|
|
1020
|
+
buttons: [
|
|
1021
|
+
{
|
|
1022
|
+
name: "quick_reply",
|
|
1023
|
+
buttonParamsJson: JSON.stringify({
|
|
1024
|
+
display_text: "Buy Now",
|
|
1025
|
+
id: "buy_wh001",
|
|
1026
|
+
}),
|
|
1027
|
+
},
|
|
1028
|
+
],
|
|
1029
|
+
},
|
|
1030
|
+
});
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
**Mixed Rich Message (custom submessages):**
|
|
1034
|
+
|
|
1035
|
+
```js
|
|
1036
|
+
await sock.sendRichMessage(
|
|
1037
|
+
jid,
|
|
1038
|
+
[
|
|
1039
|
+
{ messageType: 2, messageText: "Here is some info:" },
|
|
1040
|
+
{
|
|
1041
|
+
messageType: 4,
|
|
1042
|
+
tableMetadata: {
|
|
1043
|
+
title: "Stats",
|
|
1044
|
+
rows: [
|
|
1045
|
+
{ items: ["Metric", "Value"], isHeading: true },
|
|
1046
|
+
{ items: ["Users", "1000"] },
|
|
1047
|
+
{ items: ["Uptime", "99.9%"] },
|
|
1048
|
+
],
|
|
1049
|
+
},
|
|
1050
|
+
},
|
|
1051
|
+
{ messageType: 2, messageText: "And some code:" },
|
|
1052
|
+
{
|
|
1053
|
+
messageType: 5,
|
|
1054
|
+
codeMetadata: {
|
|
1055
|
+
codeLanguage: "javascript",
|
|
1056
|
+
codeBlocks: [{ highlightType: 0, codeContent: 'console.log("OK")' }],
|
|
1057
|
+
},
|
|
1058
|
+
},
|
|
1059
|
+
],
|
|
1060
|
+
quoted,
|
|
1061
|
+
);
|
|
1062
|
+
```
|
|
1063
|
+
|
|
1064
|
+
**SubMessage Types:**
|
|
1065
|
+
|
|
1066
|
+
| messageType | Name | Payload Field |
|
|
1067
|
+
| ----------- | ------------- | ---------------------- |
|
|
1068
|
+
| 0 | UNKNOWN | β |
|
|
1069
|
+
| 1 | GRID_IMAGE | `gridImageMetadata` |
|
|
1070
|
+
| 2 | TEXT | `messageText` |
|
|
1071
|
+
| 3 | INLINE_IMAGE | `imageMetadata` |
|
|
1072
|
+
| 4 | TABLE | `tableMetadata` |
|
|
1073
|
+
| 5 | CODE | `codeMetadata` |
|
|
1074
|
+
| 6 | DYNAMIC | `dynamicMetadata` |
|
|
1075
|
+
| 7 | MAP | `mapMetadata` |
|
|
1076
|
+
| 8 | LATEX | `latexMetadata` |
|
|
1077
|
+
| 9 | CONTENT_ITEMS | `contentItemsMetadata` |
|
|
1078
|
+
|
|
1079
|
+
---
|
|
1080
|
+
|
|
1081
|
+
### Newsletter Methods
|
|
1082
|
+
|
|
1083
|
+
```js
|
|
1084
|
+
// Resolve channel URL to metadata
|
|
1085
|
+
const info = await sock.cekIDSaluran("https://whatsapp.com/channel/xxxxx");
|
|
1086
|
+
console.log(info.name, info.subscribers);
|
|
1087
|
+
|
|
1088
|
+
// Bulk follow multiple channels
|
|
1089
|
+
await sock.newsletterMultipleFollow("id1@newsletter id2@newsletter");
|
|
1090
|
+
|
|
1091
|
+
// Fetch all subscribed channels
|
|
1092
|
+
const channels = await sock.newsletterFetchAllSubscribe();
|
|
1093
|
+
|
|
1094
|
+
// Generic action (follow/unfollow/mute/unmute)
|
|
1095
|
+
await sock.newsletterAction("id@newsletter", "follow");
|
|
1096
|
+
|
|
1097
|
+
// Create newsletter
|
|
1098
|
+
const nl = await sock.newsletterCreate("My Channel", "Description");
|
|
1099
|
+
|
|
1100
|
+
// Update newsletter
|
|
1101
|
+
await sock.newsletterUpdate("id@newsletter", { name: "New Name" });
|
|
1102
|
+
|
|
1103
|
+
// Get subscriber count
|
|
1104
|
+
const { subscribers } = await sock.newsletterSubscribers("id@newsletter");
|
|
1105
|
+
|
|
1106
|
+
// Get metadata
|
|
1107
|
+
const meta = await sock.newsletterMetadata("jid", "id@newsletter");
|
|
1108
|
+
|
|
1109
|
+
// Follow / Unfollow
|
|
1110
|
+
await sock.newsletterFollow("id@newsletter");
|
|
1111
|
+
await sock.newsletterUnfollow("id@newsletter");
|
|
1112
|
+
|
|
1113
|
+
// Mute / Unmute
|
|
1114
|
+
await sock.newsletterMute("id@newsletter");
|
|
1115
|
+
await sock.newsletterUnmute("id@newsletter");
|
|
1116
|
+
|
|
1117
|
+
// Update name / description / picture
|
|
1118
|
+
await sock.newsletterUpdateName("id@newsletter", "New Name");
|
|
1119
|
+
await sock.newsletterUpdateDescription("id@newsletter", "New Desc");
|
|
1120
|
+
await sock.newsletterUpdatePicture("id@newsletter", mediaUpload);
|
|
1121
|
+
await sock.newsletterRemovePicture("id@newsletter");
|
|
1122
|
+
|
|
1123
|
+
// React to message
|
|
1124
|
+
await sock.newsletterReactMessage("id@newsletter", serverId, "π");
|
|
1125
|
+
|
|
1126
|
+
// Fetch messages
|
|
1127
|
+
const msgs = await sock.newsletterFetchMessages("id@newsletter", 50, 0, 0);
|
|
1128
|
+
|
|
1129
|
+
// Admin operations
|
|
1130
|
+
const count = await sock.newsletterAdminCount("id@newsletter");
|
|
1131
|
+
await sock.newsletterChangeOwner("id@newsletter", newOwnerJid);
|
|
1132
|
+
await sock.newsletterDemote("id@newsletter", userJid);
|
|
1133
|
+
await sock.newsletterDelete("id@newsletter");
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
---
|
|
1137
|
+
|
|
1138
|
+
### Group Methods
|
|
1139
|
+
|
|
1140
|
+
```js
|
|
1141
|
+
// Fetch group metadata
|
|
1142
|
+
const meta = await sock.groupMetadata("id@g.us");
|
|
1143
|
+
|
|
1144
|
+
// Create group
|
|
1145
|
+
const group = await sock.groupCreate("My Group", ["628xxx@s.whatsapp.net"]);
|
|
1146
|
+
|
|
1147
|
+
// Leave group
|
|
1148
|
+
await sock.groupLeave("id@g.us");
|
|
1149
|
+
|
|
1150
|
+
// Update subject / description
|
|
1151
|
+
await sock.groupUpdateSubject("id@g.us", "New Subject");
|
|
1152
|
+
await sock.groupUpdateDescription("id@g.us", "New Description");
|
|
1153
|
+
|
|
1154
|
+
// Participant actions: add, remove, promote, demote
|
|
1155
|
+
const result = await sock.groupParticipantsUpdate(
|
|
1156
|
+
"id@g.us",
|
|
1157
|
+
["628xxx@s.whatsapp.net"],
|
|
1158
|
+
"add", // 'remove' | 'promote' | 'demote'
|
|
1159
|
+
);
|
|
1160
|
+
|
|
1161
|
+
// Handle join requests
|
|
1162
|
+
const requests = await sock.groupRequestParticipantsList("id@g.us");
|
|
1163
|
+
await sock.groupRequestParticipantsUpdate(
|
|
1164
|
+
"id@g.us",
|
|
1165
|
+
["628xxx@s.whatsapp.net"],
|
|
1166
|
+
"approve",
|
|
1167
|
+
);
|
|
1168
|
+
|
|
1169
|
+
// Invite code
|
|
1170
|
+
const code = await sock.groupInviteCode("id@g.us");
|
|
1171
|
+
await sock.groupRevokeInvite("id@g.us");
|
|
1172
|
+
await sock.groupAcceptInvite("ABCDE12345");
|
|
1173
|
+
const info = await sock.groupGetInviteInfo("ABCDE12345");
|
|
1174
|
+
|
|
1175
|
+
// Settings: announcement, not_announcement, locked, unlocked
|
|
1176
|
+
await sock.groupSettingUpdate("id@g.us", "announcement");
|
|
1177
|
+
await sock.groupSettingUpdate("id@g.us", "locked");
|
|
1178
|
+
|
|
1179
|
+
// Member add mode / Join approval
|
|
1180
|
+
await sock.groupMemberAddMode("id@g.us", "admin_add");
|
|
1181
|
+
await sock.groupJoinApprovalMode("id@g.us", "on");
|
|
1182
|
+
|
|
1183
|
+
// Toggle disappearing messages
|
|
1184
|
+
await sock.groupToggleEphemeral("id@g.us", 86400); // 24h
|
|
1185
|
+
|
|
1186
|
+
// Fetch all participating groups
|
|
1187
|
+
const groups = await sock.groupFetchAllParticipating();
|
|
1188
|
+
|
|
1189
|
+
// Update member label
|
|
1190
|
+
await sock.updateMemberLabel("id@g.us", "VIP");
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
---
|
|
1194
|
+
|
|
1195
|
+
### Community Methods
|
|
1196
|
+
|
|
1197
|
+
```js
|
|
1198
|
+
// Fetch community metadata
|
|
1199
|
+
const meta = await sock.communityMetadata("communityid@g.us");
|
|
1200
|
+
|
|
1201
|
+
// Create community
|
|
1202
|
+
const community = await sock.communityCreate(
|
|
1203
|
+
"Our Community",
|
|
1204
|
+
"Community description",
|
|
1205
|
+
);
|
|
1206
|
+
|
|
1207
|
+
// Create a subgroup under a community
|
|
1208
|
+
const subgroup = await sock.communityCreateGroup(
|
|
1209
|
+
"Announcements",
|
|
1210
|
+
["628xxx@s.whatsapp.net"],
|
|
1211
|
+
"communityid@g.us",
|
|
1212
|
+
);
|
|
1213
|
+
|
|
1214
|
+
// Link / unlink an existing group
|
|
1215
|
+
await sock.communityLinkGroup("groupid@g.us", "communityid@g.us");
|
|
1216
|
+
await sock.communityUnlinkGroup("groupid@g.us", "communityid@g.us");
|
|
1217
|
+
|
|
1218
|
+
// Fetch linked groups
|
|
1219
|
+
const linked = await sock.communityFetchLinkedGroups("communityid@g.us");
|
|
1220
|
+
|
|
1221
|
+
// Invite handling
|
|
1222
|
+
const code = await sock.communityInviteCode("communityid@g.us");
|
|
1223
|
+
await sock.communityRevokeInvite("communityid@g.us");
|
|
1224
|
+
await sock.communityAcceptInvite(code);
|
|
1225
|
+
const inviteInfo = await sock.communityGetInviteInfo(code);
|
|
1226
|
+
|
|
1227
|
+
// Requests / participants
|
|
1228
|
+
const requests =
|
|
1229
|
+
await sock.communityRequestParticipantsList("communityid@g.us");
|
|
1230
|
+
await sock.communityRequestParticipantsUpdate(
|
|
1231
|
+
"communityid@g.us",
|
|
1232
|
+
["628xxx@s.whatsapp.net"],
|
|
1233
|
+
"approve",
|
|
1234
|
+
);
|
|
1235
|
+
await sock.communityParticipantsUpdate(
|
|
1236
|
+
"communityid@g.us",
|
|
1237
|
+
["628xxx@s.whatsapp.net"],
|
|
1238
|
+
"add",
|
|
1239
|
+
);
|
|
1240
|
+
|
|
1241
|
+
// Settings
|
|
1242
|
+
await sock.communityUpdateSubject("communityid@g.us", "New Subject");
|
|
1243
|
+
await sock.communityUpdateDescription("communityid@g.us", "New Description");
|
|
1244
|
+
await sock.communityToggleEphemeral("communityid@g.us", 86400);
|
|
1245
|
+
await sock.communitySettingUpdate("communityid@g.us", "announcement");
|
|
1246
|
+
await sock.communityMemberAddMode("communityid@g.us", "admin_add");
|
|
1247
|
+
await sock.communityJoinApprovalMode("communityid@g.us", "on");
|
|
1248
|
+
|
|
1249
|
+
// Leave / list all
|
|
1250
|
+
await sock.communityLeave("communityid@g.us");
|
|
1251
|
+
const communities = await sock.communityFetchAllParticipating();
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
---
|
|
1255
|
+
|
|
1256
|
+
### Business Methods
|
|
1257
|
+
|
|
1258
|
+
```js
|
|
1259
|
+
// Catalog
|
|
1260
|
+
const { products, nextPageCursor } = await sock.getCatalog({
|
|
1261
|
+
jid: "628xxx@s.whatsapp.net",
|
|
1262
|
+
limit: 10,
|
|
1263
|
+
});
|
|
1264
|
+
|
|
1265
|
+
const { collections } = await sock.getCollections("628xxx@s.whatsapp.net", 10);
|
|
1266
|
+
|
|
1267
|
+
// Orders
|
|
1268
|
+
const order = await sock.getOrderDetails(orderId, tokenBase64);
|
|
1269
|
+
|
|
1270
|
+
// Product CRUD
|
|
1271
|
+
const product = await sock.productCreate({
|
|
1272
|
+
name: "Premium Package",
|
|
1273
|
+
description: "Official premium plan",
|
|
1274
|
+
price: 150000,
|
|
1275
|
+
currency: "IDR",
|
|
1276
|
+
originCountryCode: "ID",
|
|
1277
|
+
images: [mediaUpload],
|
|
1278
|
+
});
|
|
1279
|
+
|
|
1280
|
+
await sock.productUpdate(product.id, {
|
|
1281
|
+
name: "Premium Package Plus",
|
|
1282
|
+
description: "Official premium plan plus",
|
|
1283
|
+
price: 175000,
|
|
1284
|
+
currency: "IDR",
|
|
1285
|
+
images: [mediaUpload],
|
|
1286
|
+
});
|
|
1287
|
+
|
|
1288
|
+
await sock.productDelete([product.id]);
|
|
1289
|
+
|
|
1290
|
+
// Business profile
|
|
1291
|
+
await sock.updateBusinessProfile({
|
|
1292
|
+
address: "Jakarta, Indonesia",
|
|
1293
|
+
description: "Official store",
|
|
1294
|
+
websites: ["https://example.com"],
|
|
1295
|
+
email: "hello@example.com",
|
|
1296
|
+
hours: {
|
|
1297
|
+
timezone: "Asia/Jakarta",
|
|
1298
|
+
days: [{ day: "mon", mode: "open_24h" }],
|
|
1299
|
+
},
|
|
1300
|
+
});
|
|
1301
|
+
|
|
1302
|
+
// Legacy alias is still available for backward compatibility
|
|
1303
|
+
await sock.updateBussinesProfile({
|
|
1304
|
+
description: "Legacy alias still works",
|
|
1305
|
+
});
|
|
1306
|
+
|
|
1307
|
+
await sock.updateCoverPhoto(mediaUpload);
|
|
1308
|
+
await sock.removeCoverPhoto(coverId);
|
|
1309
|
+
|
|
1310
|
+
// Quick replies
|
|
1311
|
+
await sock.addOrEditQuickReply({
|
|
1312
|
+
shortcut: "hello",
|
|
1313
|
+
message: "Hello from business account",
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1316
|
+
await sock.removeQuickReply(timestamp);
|
|
1317
|
+
```
|
|
1318
|
+
|
|
1319
|
+
---
|
|
1320
|
+
|
|
1321
|
+
### Chat & Profile Methods
|
|
1322
|
+
|
|
1323
|
+
```js
|
|
1324
|
+
// Profile picture
|
|
1325
|
+
const url = await sock.profilePictureUrl(jid, "image");
|
|
1326
|
+
await sock.updateProfilePicture(jid, mediaUpload);
|
|
1327
|
+
await sock.removeProfilePicture(jid);
|
|
1328
|
+
|
|
1329
|
+
// Profile name / status
|
|
1330
|
+
await sock.updateProfileName("My Name");
|
|
1331
|
+
await sock.updateProfileStatus("Available");
|
|
1332
|
+
|
|
1333
|
+
// Presence
|
|
1334
|
+
await sock.sendPresenceUpdate("available", jid);
|
|
1335
|
+
await sock.presenceSubscribe(jid);
|
|
1336
|
+
|
|
1337
|
+
// Read receipts
|
|
1338
|
+
await sock.readMessages([msg.key]);
|
|
1339
|
+
await sock.sendReceipt(jid, participant, [msgId], "read");
|
|
1340
|
+
|
|
1341
|
+
// Block / Unblock
|
|
1342
|
+
await sock.updateBlockStatus(jid, "block");
|
|
1343
|
+
await sock.updateBlockStatus(jid, "unblock");
|
|
1344
|
+
|
|
1345
|
+
// Fetch blocklist
|
|
1346
|
+
const list = await sock.fetchBlocklist();
|
|
1347
|
+
|
|
1348
|
+
// Chat modifications
|
|
1349
|
+
await sock.chatModify(
|
|
1350
|
+
{
|
|
1351
|
+
archive: true,
|
|
1352
|
+
lastMessageOrig: msg,
|
|
1353
|
+
lastMessage: msg,
|
|
1354
|
+
},
|
|
1355
|
+
jid,
|
|
1356
|
+
);
|
|
1357
|
+
|
|
1358
|
+
// Star messages
|
|
1359
|
+
await sock.star(jid, [{ id: msgId, fromMe: true }], true);
|
|
1360
|
+
|
|
1361
|
+
// Contact management
|
|
1362
|
+
await sock.addOrEditContact(jid, { displayName: "Name" });
|
|
1363
|
+
await sock.removeContact(jid);
|
|
1364
|
+
|
|
1365
|
+
// Labels
|
|
1366
|
+
await sock.addChatLabel(jid, labelId);
|
|
1367
|
+
await sock.removeChatLabel(jid, labelId);
|
|
1368
|
+
await sock.addMessageLabel(jid, messageId, labelId);
|
|
1369
|
+
|
|
1370
|
+
// App state sync
|
|
1371
|
+
await sock.resyncAppState(["regular", "critical_block"], true);
|
|
1372
|
+
|
|
1373
|
+
// Business profile
|
|
1374
|
+
const biz = await sock.getBusinessProfile(jid);
|
|
1375
|
+
```
|
|
1376
|
+
|
|
1377
|
+
---
|
|
1378
|
+
|
|
1379
|
+
### Privacy Settings
|
|
1380
|
+
|
|
1381
|
+
```js
|
|
1382
|
+
await sock.updateLastSeenPrivacy("all"); // 'all' | 'contacts' | 'contact_blacklist' | 'nobody'
|
|
1383
|
+
await sock.updateOnlinePrivacy("all"); // 'all' | 'match_last_seen'
|
|
1384
|
+
await sock.updateProfilePicturePrivacy("contacts");
|
|
1385
|
+
await sock.updateStatusPrivacy("contacts");
|
|
1386
|
+
await sock.updateReadReceiptsPrivacy("all"); // 'all' | 'none'
|
|
1387
|
+
await sock.updateGroupsAddPrivacy("all"); // 'all' | 'contacts'
|
|
1388
|
+
await sock.updateMessagesPrivacy("all"); // 'all' | 'contacts' | 'nobody'
|
|
1389
|
+
await sock.updateCallPrivacy("everyone");
|
|
1390
|
+
await sock.updateDefaultDisappearingMode(86400);
|
|
1391
|
+
await sock.updateDisableLinkPreviewsPrivacy(true);
|
|
1392
|
+
```
|
|
1393
|
+
|
|
1394
|
+
---
|
|
1395
|
+
|
|
1396
|
+
## π‘ Event Reference
|
|
1397
|
+
|
|
1398
|
+
```js
|
|
1399
|
+
sock.ev.on('connection.update', ({ connection, lastDisconnect, qr, isNewLogin, receivedPendingNotifications, isOnline }) => {})
|
|
1400
|
+
sock.ev.on('creds.update', (update) => {})
|
|
1401
|
+
sock.ev.on('messaging-history.set', ({ chats, contacts, messages, isLatest }) => {})
|
|
1402
|
+
sock.ev.on('chats.upsert', (chats) => {})
|
|
1403
|
+
sock.ev.on('chats.update', (updates) => {})
|
|
1404
|
+
sock.ev.on('chats.delete', (jids) => {})
|
|
1405
|
+
sock.ev.on('contacts.upsert', (contacts) => {})
|
|
1406
|
+
sock.ev.on('contacts.update', (updates) => {})
|
|
1407
|
+
sock.ev.on('messages.upsert', ({ messages, type }) => {})
|
|
1408
|
+
sock.ev.on('messages.update', (updates) => {})
|
|
1409
|
+
sock.ev.on('messages.delete', (keys) => {})
|
|
1410
|
+
sock.ev.on('messages.reaction', (reactions) => {})
|
|
1411
|
+
sock.ev.on('message-receipt.update', (updates) => {})
|
|
1412
|
+
sock.ev.on('groups.update', (updates) => {})
|
|
1413
|
+
sock.ev.on('group-participants.update', (update) => {})
|
|
1414
|
+
sock.ev.on('group.join-request', (update) => {})
|
|
1415
|
+
sock.ev.on('call', (calls) => {})
|
|
1416
|
+
sock.ev.on('labels.edit', (label) => {})
|
|
1417
|
+
sock.ev.on('labels.associations', ({ associated, label, type }) => {})
|
|
1418
|
+
sock.ev.on('newsletter.update', (updates) => {})
|
|
1419
|
+
sock.ev.on('newsletter.follow', (jid) => {})
|
|
1420
|
+
sock.ev.on('newsletter.unfollow', (jid) => {})
|
|
1421
|
+
sock.ev.on('settings.update', ({ isAutoEmojiEnabled, isReadReceiptsEnabled, ... }) => {})
|
|
1422
|
+
```
|
|
1423
|
+
|
|
1424
|
+
---
|
|
1425
|
+
|
|
1426
|
+
## π§ Utility Exports
|
|
1427
|
+
|
|
1428
|
+
```js
|
|
1429
|
+
import {
|
|
1430
|
+
// Auth
|
|
1431
|
+
useMultiFileAuthState,
|
|
1432
|
+
makeCacheableSignalKeyStore,
|
|
1433
|
+
initAuthCreds,
|
|
1434
|
+
BufferJSON,
|
|
1435
|
+
fetchLatestBaileysVersion,
|
|
1436
|
+
|
|
1437
|
+
// Code tokenization
|
|
1438
|
+
tokenizeCode,
|
|
1439
|
+
tokenizeCodeV2,
|
|
1440
|
+
CodeHighlightType,
|
|
1441
|
+
RichSubMessageType,
|
|
1442
|
+
|
|
1443
|
+
// Rich message generators
|
|
1444
|
+
generateTableContent,
|
|
1445
|
+
generateTableContentV2,
|
|
1446
|
+
toTableMetadataV2,
|
|
1447
|
+
generateListContent,
|
|
1448
|
+
generateCodeBlockContent,
|
|
1449
|
+
generateCodeBlockContentV2,
|
|
1450
|
+
generateLinkContent,
|
|
1451
|
+
generateLinkContentV2,
|
|
1452
|
+
generateRichMessageContent,
|
|
1453
|
+
generateLatexContent,
|
|
1454
|
+
generateLatexImageContent,
|
|
1455
|
+
generateLatexInlineImageContent,
|
|
1456
|
+
generateUnifiedResponseContent,
|
|
1457
|
+
captureUnifiedResponse,
|
|
1458
|
+
|
|
1459
|
+
// Rich message builders
|
|
1460
|
+
buildRichContextInfo,
|
|
1461
|
+
buildBotForwardedMessage,
|
|
1462
|
+
|
|
1463
|
+
// Sticker pack helper
|
|
1464
|
+
makeStickerPack,
|
|
1465
|
+
|
|
1466
|
+
// Language keyword sets
|
|
1467
|
+
JS_KEYWORDS,
|
|
1468
|
+
PYTHON_KEYWORDS,
|
|
1469
|
+
GO_KEYWORDS,
|
|
1470
|
+
LUA_KEYWORDS,
|
|
1471
|
+
BASH_KEYWORDS,
|
|
1472
|
+
LANGUAGE_KEYWORDS,
|
|
1473
|
+
|
|
1474
|
+
// Crypto
|
|
1475
|
+
Curve,
|
|
1476
|
+
signedKeyPair,
|
|
1477
|
+
aesEncryptGCM,
|
|
1478
|
+
aesDecryptGCM,
|
|
1479
|
+
|
|
1480
|
+
// JID utilities
|
|
1481
|
+
jidEncode,
|
|
1482
|
+
jidDecode,
|
|
1483
|
+
jidNormalizedUser,
|
|
1484
|
+
areJidsSameUser,
|
|
1485
|
+
isJidGroup,
|
|
1486
|
+
isJidNewsletter,
|
|
1487
|
+
isLidUser,
|
|
1488
|
+
isPnUser,
|
|
1489
|
+
isJidBot,
|
|
1490
|
+
isJidMetaAI,
|
|
1491
|
+
isJidBroadcast,
|
|
1492
|
+
isJidStatusBroadcast,
|
|
1493
|
+
|
|
1494
|
+
// Connection
|
|
1495
|
+
DisconnectReason,
|
|
1496
|
+
Browsers,
|
|
1497
|
+
|
|
1498
|
+
// Dugong (advanced message types)
|
|
1499
|
+
Dugong,
|
|
1500
|
+
|
|
1501
|
+
// Types
|
|
1502
|
+
WASocket,
|
|
1503
|
+
} from "delkira-baileys";
|
|
1504
|
+
```
|
|
1505
|
+
|
|
1506
|
+
> [!NOTE]
|
|
1507
|
+
> In this build, some advanced helper typings may appear first in `lib/Socket/messages-send.d.ts` before they are reflected everywhere else in aggregated socket declarations. If your editor autocomplete lags behind runtime behavior, inspect `lib/Socket/messages-send.js` and `lib/Utils/rich-messages.d.ts` for the most complete helper surface.
|
|
1508
|
+
|
|
1509
|
+
---
|
|
1510
|
+
|
|
1511
|
+
## ποΈ Building This Package
|
|
1512
|
+
|
|
1513
|
+
This repository ships compiled files, but it still includes the build script used to emit/update `lib/`.
|
|
1514
|
+
|
|
1515
|
+
```bash
|
|
1516
|
+
npm install
|
|
1517
|
+
npm run build
|
|
1518
|
+
```
|
|
1519
|
+
|
|
1520
|
+
What the build does:
|
|
1521
|
+
|
|
1522
|
+
- runs TypeScript with `tsconfig.build.json`
|
|
1523
|
+
- emits JavaScript and declaration files into `lib/`
|
|
1524
|
+
- runs `tsc-esm-fix` so generated ESM imports resolve cleanly
|
|
1525
|
+
|
|
1526
|
+
Important build notes:
|
|
1527
|
+
|
|
1528
|
+
- `tsconfig.json` is authoring-oriented and uses `noEmit: true`
|
|
1529
|
+
- `tsconfig.build.json` flips emit back on and excludes test files
|
|
1530
|
+
- published package files are limited to `lib/**/*` and `WAProto/**/*`
|
|
1531
|
+
|
|
1532
|
+
---
|
|
1533
|
+
|
|
1534
|
+
## π Differences from Official Baileys
|
|
1535
|
+
|
|
1536
|
+
| Area | Official Baileys v7 | delkira-baileys |
|
|
1537
|
+
| -------------------- | ------------------- | ---------------------------------------- |
|
|
1538
|
+
| Interactive messages | No native support | Full support via Dugong |
|
|
1539
|
+
| Album messages | Not supported | Multi-media albums |
|
|
1540
|
+
| AI Rich Response | Not available | Table, code block, rich text |
|
|
1541
|
+
| Table V1 | Not available | Basic table with headers |
|
|
1542
|
+
| Table V2 | Not available | Unified response + GenATableUXPrimitive |
|
|
1543
|
+
| Code Block V1 | Not available | Syntax highlighting (JS/TS/Python) |
|
|
1544
|
+
| Code Block V2 | Not available | Unified response + 6 languages |
|
|
1545
|
+
| Link Message | Not available | Inline embeds + citations + verification |
|
|
1546
|
+
| Business nodes | Manual injection | Auto-inject on relay |
|
|
1547
|
+
| Newsletter extras | Basic only | Auto-follow, bulk follow, URL resolve |
|
|
1548
|
+
| Button detection | Not available | `getButtonType()` auto-detect |
|
|
1549
|
+
| Payment messages | Not supported | Full support |
|
|
1550
|
+
| Event messages | Basic | Enhanced all fields |
|
|
1551
|
+
| Status mentions | Not available | `sendStatusMention()` |
|
|
1552
|
+
| Product messages | Not supported | Catalog + buttons |
|
|
1553
|
+
| LID support | Basic | Full LIDβPN mapping + session migration |
|
|
1554
|
+
| Identity changes | No handling | Debounced session refresh |
|
|
1555
|
+
| Message retry | Basic | `MessageRetryManager` with cache |
|
|
1556
|
+
|
|
1557
|
+
---
|
|
1558
|
+
|
|
1559
|
+
## π€ Contributing
|
|
1560
|
+
|
|
1561
|
+
1. Fork this repo
|
|
1562
|
+
2. Create a branch (`git checkout -b feature/name`)
|
|
1563
|
+
3. Commit changes (`git commit -m 'feat: add feature'`)
|
|
1564
|
+
4. Push to branch (`git push origin feature/name`)
|
|
1565
|
+
5. Open a Pull Request
|
|
1566
|
+
|
|
1567
|
+
---
|
|
1568
|
+
|
|
1569
|
+
## π License
|
|
1570
|
+
|
|
1571
|
+
MIT Β© [olivea777](https://github.com/olivea777)
|
|
1572
|
+
|
|
1573
|
+
> [!CAUTION]
|
|
1574
|
+
> This library is for **educational purposes**. Ensure compliance with WhatsApp Terms of Service.
|
|
1575
|
+
|
|
1576
|
+
---
|
|
1577
|
+
|
|
1578
|
+
<div align="center">
|
|
1579
|
+
|
|
1580
|
+
**Made with π by Zann**
|
|
1581
|
+
|
|
1582
|
+
[β Star this repo](https://github.com/olivea777/delkira-baileys) Β· [π Report Bug](https://github.com/olivea777/delkira-baileys/issues) Β· [π‘ Request Feature](https://github.com/olivea777/delkira-baileys/issues)
|
|
1583
|
+
|
|
1584
|
+
</div>
|