open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.14k stars 600 forks source link

How can I play a recovered audio in a whatsapp message #2740

Closed DaruinHerrera closed 2 years ago

DaruinHerrera commented 2 years ago

Are you using the latest version of the library?

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Personal account (normal)

Mode

My own code

Current Behavior

Retrieve all the messages of a chatId, among these there are audios, I would like to know how these audios can be played

Expected Behavior

Test

Steps To Reproduce

message retrieval

create() code OR full CLI command + CONFIG

{
            "id": "false_573235890164@c.us_578AE68F8DD0377836C5477E0BE0D29F",
            "rowId": 1000000225,
            "body": "",
            "type": "ptt",
            "t": 1654805678,
            "from": "573235890164@c.us",
            "to": "573174796864@c.us",
            "self": "in",
            "ack": 4,
            "invis": true,
            "star": false,
            "clientUrl": "https://mmg.whatsapp.net/d/f/AnQe0-gR6z7Ao0LsOt1wJis_cAxlWMmCOWwtCCDrjfDQ.enc",
            "deprecatedMms3Url": "https://mmg.whatsapp.net/d/f/AnQe0-gR6z7Ao0LsOt1wJis_cAxlWMmCOWwtCCDrjfDQ.enc",
            "directPath": "/v/t62.7117-24/35081707_3302152140073705_1565894774925160416_n.enc?ccb=11-4&oh=01_AVwW34E1ShuTqOfH0WGq7LXomBas01Qw6g4SWwP010DbMA&oe=62C7BD75",
            "mimetype": "audio/ogg; codecs=opus",
            "duration": "2",
            "filehash": "nLnBVD8WJADiokQETfJwmC2oEYby5MlEN5KM1Yq0nGk=",
            "encFilehash": "W1gwiyBjzZ+LU4yWaYjh03xo2IprqHmX9A8YBbX5FUc=",
            "size": 6281,
            "mediaKey": "Tj+WS5WB0VGrLEYmk0/HGjjlpFUtSy0GR7Ab+ADUuac=",
            "mediaKeyTimestamp": 1654805676,
            "waveform": {
                "0": 0,
                "1": 0,
                "2": 0,
                "3": 0,
                "4": 0,
                "5": 0,
                "6": 0,
                "7": 0,
                "8": 0,
                "9": 0,
                "10": 0,
                "11": 0,
                "12": 42,
                "13": 66,
                "14": 71,
                "15": 68,
                "16": 80,
                "17": 80,
                "18": 80,
                "19": 80,
                "20": 82,
                "21": 82,
                "22": 82,
                "23": 83,
                "24": 81,
                "25": 78,
                "26": 79,
                "27": 75,
                "28": 79,
                "29": 79,
                "30": 77,
                "31": 72,
                "32": 59,
                "33": 74,
                "34": 77,
                "35": 76,
                "36": 75,
                "37": 75,
                "38": 79,
                "39": 78,
                "40": 77,
                "41": 73,
                "42": 69,
                "43": 75,
                "44": 75,
                "45": 73,
                "46": 71,
                "47": 70,
                "48": 74,
                "49": 75,
                "50": 76,
                "51": 75,
                "52": 74,
                "53": 71,
                "54": 77,
                "55": 77,
                "56": 77,
                "57": 72,
                "58": 63,
                "59": 76,
                "60": 78,
                "61": 40,
                "62": 7,
                "63": 0
            },
            "isFromTemplate": false,
            "pollOptions": [],
            "broadcast": false,
            "quotedMsg": null,
            "mentionedJidList": [],
            "isVcardOverMmsDocument": false,
            "isForwarded": false,
            "labels": [],
            "hasReaction": false,
            "productHeaderImageRejected": false,
            "lastPlaybackProgress": 0,
            "isDynamicReplyButtonsMsg": false,
            "isMdHistoryMsg": false,
            "requiresDirectConnection": false,
            "pttForwardedFeaturesEnabled": true,
            "fromMe": false,
            "sender": {
                "id": "573235890164@c.us",
                "name": "Oscar",
                "shortName": "Oscar",
                "pushname": "Sdata",
                "type": "in",
                "verifiedName": "Sdata",
                "isBusiness": true,
                "isEnterprise": false,
                "verifiedLevel": 0,
                "privacyMode": null,
                "isContactSyncCompleted": 1,
                "formattedName": "Oscar",
                "isMe": false,
                "isMyContact": true,
                "isPSA": false,
                "isUser": true,
                "isWAContact": true,
                "profilePicThumbObj": {
                    "eurl": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?ccb=11-4&oh=3cafd0471d723cffb7d024741d2c8c6e&oe=62B3E6B2",
                    "id": "573235890164@c.us",
                    "img": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=d35a8df6dbc1050a7da2e0d412b1928c&oe=62B3E6B2",
                    "imgFull": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?ccb=11-4&oh=3cafd0471d723cffb7d024741d2c8c6e&oe=62B3E6B2",
                    "raw": null,
                    "tag": "1635532707"
                },
                "msgs": null
            },
            "timestamp": 1654805678,
            "isGroupMsg": false,
            "isMedia": false,
            "isNotification": false,
            "isPSA": false,
            "chat": {
                "id": "573235890164@c.us",
                "lastReceivedKey": {
                    "fromMe": false,
                    "remote": "573235890164@c.us",
                    "id": "578AE68F8DD0377836C5477E0BE0D29F",
                    "_serialized": "false_573235890164@c.us_578AE68F8DD0377836C5477E0BE0D29F"
                },
                "t": 1654805678,
                "unreadCount": 0,
                "muteExpiration": 0,
                "notSpam": true,
                "ephemeralDuration": 0,
                "disappearingModeInitiator": "chat",
                "unreadMentionsOfMe": [],
                "unreadMentionCount": 0,
                "hasUnreadMention": false,
                "archiveAtMentionViewedInDrawer": false,
                "hasChatBeenOpened": false,
                "tcToken": {},
                "tcTokenTimestamp": 1654778614,
                "tcTokenSenderTimestamp": 1654788006,
                "endOfHistoryTransferType": 1,
                "pendingInitialLoading": false,
                "msgs": null,
                "kind": "chat",
                "canSend": true,
                "isGroup": false,
                "formattedTitle": "Oscar",
                "contact": {
                    "id": "573235890164@c.us",
                    "name": "Oscar",
                    "shortName": "Oscar",
                    "pushname": "Sdata",
                    "type": "in",
                    "verifiedName": "Sdata",
                    "isBusiness": true,
                    "isEnterprise": false,
                    "verifiedLevel": 0,
                    "privacyMode": null,
                    "isContactSyncCompleted": 1,
                    "formattedName": "Oscar",
                    "isMe": false,
                    "isMyContact": true,
                    "isPSA": false,
                    "isUser": true,
                    "isWAContact": true,
                    "profilePicThumbObj": {
                        "eurl": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?ccb=11-4&oh=3cafd0471d723cffb7d024741d2c8c6e&oe=62B3E6B2",
                        "id": "573235890164@c.us",
                        "img": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=d35a8df6dbc1050a7da2e0d412b1928c&oe=62B3E6B2",
                        "imgFull": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?ccb=11-4&oh=3cafd0471d723cffb7d024741d2c8c6e&oe=62B3E6B2",
                        "raw": null,
                        "tag": "1635532707"
                    },
                    "msgs": null
                },
                "groupMetadata": null,
                "presence": {
                    "id": "573235890164@c.us",
                    "chatstates": []
                },
                "isOnline": false,
                "participantsCount": 1
            },
            "isOnline": false,
            "chatId": "573235890164@c.us",
            "quotedMsgObj": null,
            "mediaData": {
                "type": "ptt",
                "mediaStage": "INIT",
                "size": 6281,
                "filehash": "nLnBVD8WJADiokQETfJwmC2oEYby5MlEN5KM1Yq0nGk=",
                "mimetype": "audio/ogg; codecs=opus",
                "mediaBlob": null,
                "animationDuration": 0,
                "animatedAsNewMsg": false,
                "duration": "2",
                "_swStreamingSupported": false,
                "_listeningToSwSupport": false,
                "isVcardOverMmsDocument": false,
                "waveform": {
                    "0": 0,
                    "1": 0,
                    "2": 0,
                    "3": 0,
                    "4": 0,
                    "5": 0,
                    "6": 0,
                    "7": 0,
                    "8": 0,
                    "9": 0,
                    "10": 0,
                    "11": 0,
                    "12": 42,
                    "13": 66,
                    "14": 71,
                    "15": 68,
                    "16": 80,
                    "17": 80,
                    "18": 80,
                    "19": 80,
                    "20": 82,
                    "21": 82,
                    "22": 82,
                    "23": 83,
                    "24": 81,
                    "25": 78,
                    "26": 79,
                    "27": 75,
                    "28": 79,
                    "29": 79,
                    "30": 77,
                    "31": 72,
                    "32": 59,
                    "33": 74,
                    "34": 77,
                    "35": 76,
                    "36": 75,
                    "37": 75,
                    "38": 79,
                    "39": 78,
                    "40": 77,
                    "41": 73,
                    "42": 69,
                    "43": 75,
                    "44": 75,
                    "45": 73,
                    "46": 71,
                    "47": 70,
                    "48": 74,
                    "49": 75,
                    "50": 76,
                    "51": 75,
                    "52": 74,
                    "53": 71,
                    "54": 77,
                    "55": 77,
                    "56": 77,
                    "57": 72,
                    "58": 63,
                    "59": 76,
                    "60": 78,
                    "61": 40,
                    "62": 7,
                    "63": 0
                }
            },
            "text": ""
        }

DEBUG INFO

- Debug info: {
  "WA_VERSION": "2.2220.8",
  "PAGE_UA": "WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
  "WA_AUTOMATE_VERSION": "4.37.5 UPDATE AVAILABLE: 4.38.1",
  "BROWSER_VERSION": "HeadlessChrome/101.0.4950.0",
  "OS": "Windows 10",
  "START_TS": 1654807602783,
  "RAM_INFO": "Total: 17.05 GB | Free: 8.59 GB",
  "PPTR_VERSION": "UNKNOWN"
}

Environment

- OS: windows
- Node: v16.15.1
- npm: 8.11.0

Screenshots/Logs

{
            "id": "false_573235890164@c.us_578AE68F8DD0377836C5477E0BE0D29F",
            "rowId": 1000000225,
            "body": "",
            "type": "ptt",
            "t": 1654805678,
            "from": "573235890164@c.us",
            "to": "573174796864@c.us",
            "self": "in",
            "ack": 4,
            "invis": true,
            "star": false,
            "clientUrl": "https://mmg.whatsapp.net/d/f/AnQe0-gR6z7Ao0LsOt1wJis_cAxlWMmCOWwtCCDrjfDQ.enc",
            "deprecatedMms3Url": "https://mmg.whatsapp.net/d/f/AnQe0-gR6z7Ao0LsOt1wJis_cAxlWMmCOWwtCCDrjfDQ.enc",
            "directPath": "/v/t62.7117-24/35081707_3302152140073705_1565894774925160416_n.enc?ccb=11-4&oh=01_AVwW34E1ShuTqOfH0WGq7LXomBas01Qw6g4SWwP010DbMA&oe=62C7BD75",
            "mimetype": "audio/ogg; codecs=opus",
            "duration": "2",
            "filehash": "nLnBVD8WJADiokQETfJwmC2oEYby5MlEN5KM1Yq0nGk=",
            "encFilehash": "W1gwiyBjzZ+LU4yWaYjh03xo2IprqHmX9A8YBbX5FUc=",
            "size": 6281,
            "mediaKey": "Tj+WS5WB0VGrLEYmk0/HGjjlpFUtSy0GR7Ab+ADUuac=",
            "mediaKeyTimestamp": 1654805676,
            "waveform": {
                "0": 0,
                "1": 0,
                "2": 0,
                "3": 0,
                "4": 0,
                "5": 0,
                "6": 0,
                "7": 0,
                "8": 0,
                "9": 0,
                "10": 0,
                "11": 0,
                "12": 42,
                "13": 66,
                "14": 71,
                "15": 68,
                "16": 80,
                "17": 80,
                "18": 80,
                "19": 80,
                "20": 82,
                "21": 82,
                "22": 82,
                "23": 83,
                "24": 81,
                "25": 78,
                "26": 79,
                "27": 75,
                "28": 79,
                "29": 79,
                "30": 77,
                "31": 72,
                "32": 59,
                "33": 74,
                "34": 77,
                "35": 76,
                "36": 75,
                "37": 75,
                "38": 79,
                "39": 78,
                "40": 77,
                "41": 73,
                "42": 69,
                "43": 75,
                "44": 75,
                "45": 73,
                "46": 71,
                "47": 70,
                "48": 74,
                "49": 75,
                "50": 76,
                "51": 75,
                "52": 74,
                "53": 71,
                "54": 77,
                "55": 77,
                "56": 77,
                "57": 72,
                "58": 63,
                "59": 76,
                "60": 78,
                "61": 40,
                "62": 7,
                "63": 0
            },
            "isFromTemplate": false,
            "pollOptions": [],
            "broadcast": false,
            "quotedMsg": null,
            "mentionedJidList": [],
            "isVcardOverMmsDocument": false,
            "isForwarded": false,
            "labels": [],
            "hasReaction": false,
            "productHeaderImageRejected": false,
            "lastPlaybackProgress": 0,
            "isDynamicReplyButtonsMsg": false,
            "isMdHistoryMsg": false,
            "requiresDirectConnection": false,
            "pttForwardedFeaturesEnabled": true,
            "fromMe": false,
            "sender": {
                "id": "573235890164@c.us",
                "name": "Oscar",
                "shortName": "Oscar",
                "pushname": "Sdata",
                "type": "in",
                "verifiedName": "Sdata",
                "isBusiness": true,
                "isEnterprise": false,
                "verifiedLevel": 0,
                "privacyMode": null,
                "isContactSyncCompleted": 1,
                "formattedName": "Oscar",
                "isMe": false,
                "isMyContact": true,
                "isPSA": false,
                "isUser": true,
                "isWAContact": true,
                "profilePicThumbObj": {
                    "eurl": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?ccb=11-4&oh=3cafd0471d723cffb7d024741d2c8c6e&oe=62B3E6B2",
                    "id": "573235890164@c.us",
                    "img": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=d35a8df6dbc1050a7da2e0d412b1928c&oe=62B3E6B2",
                    "imgFull": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?ccb=11-4&oh=3cafd0471d723cffb7d024741d2c8c6e&oe=62B3E6B2",
                    "raw": null,
                    "tag": "1635532707"
                },
                "msgs": null
            },
            "timestamp": 1654805678,
            "isGroupMsg": false,
            "isMedia": false,
            "isNotification": false,
            "isPSA": false,
            "chat": {
                "id": "573235890164@c.us",
                "lastReceivedKey": {
                    "fromMe": false,
                    "remote": "573235890164@c.us",
                    "id": "578AE68F8DD0377836C5477E0BE0D29F",
                    "_serialized": "false_573235890164@c.us_578AE68F8DD0377836C5477E0BE0D29F"
                },
                "t": 1654805678,
                "unreadCount": 0,
                "muteExpiration": 0,
                "notSpam": true,
                "ephemeralDuration": 0,
                "disappearingModeInitiator": "chat",
                "unreadMentionsOfMe": [],
                "unreadMentionCount": 0,
                "hasUnreadMention": false,
                "archiveAtMentionViewedInDrawer": false,
                "hasChatBeenOpened": false,
                "tcToken": {},
                "tcTokenTimestamp": 1654778614,
                "tcTokenSenderTimestamp": 1654788006,
                "endOfHistoryTransferType": 1,
                "pendingInitialLoading": false,
                "msgs": null,
                "kind": "chat",
                "canSend": true,
                "isGroup": false,
                "formattedTitle": "Oscar",
                "contact": {
                    "id": "573235890164@c.us",
                    "name": "Oscar",
                    "shortName": "Oscar",
                    "pushname": "Sdata",
                    "type": "in",
                    "verifiedName": "Sdata",
                    "isBusiness": true,
                    "isEnterprise": false,
                    "verifiedLevel": 0,
                    "privacyMode": null,
                    "isContactSyncCompleted": 1,
                    "formattedName": "Oscar",
                    "isMe": false,
                    "isMyContact": true,
                    "isPSA": false,
                    "isUser": true,
                    "isWAContact": true,
                    "profilePicThumbObj": {
                        "eurl": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?ccb=11-4&oh=3cafd0471d723cffb7d024741d2c8c6e&oe=62B3E6B2",
                        "id": "573235890164@c.us",
                        "img": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=d35a8df6dbc1050a7da2e0d412b1928c&oe=62B3E6B2",
                        "imgFull": "https://pps.whatsapp.net/v/t61.24694-24/169369295_259694239428663_6245990819879393295_n.jpg?ccb=11-4&oh=3cafd0471d723cffb7d024741d2c8c6e&oe=62B3E6B2",
                        "raw": null,
                        "tag": "1635532707"
                    },
                    "msgs": null
                },
                "groupMetadata": null,
                "presence": {
                    "id": "573235890164@c.us",
                    "chatstates": []
                },
                "isOnline": false,
                "participantsCount": 1
            },
            "isOnline": false,
            "chatId": "573235890164@c.us",
            "quotedMsgObj": null,
            "mediaData": {
                "type": "ptt",
                "mediaStage": "INIT",
                "size": 6281,
                "filehash": "nLnBVD8WJADiokQETfJwmC2oEYby5MlEN5KM1Yq0nGk=",
                "mimetype": "audio/ogg; codecs=opus",
                "mediaBlob": null,
                "animationDuration": 0,
                "animatedAsNewMsg": false,
                "duration": "2",
                "_swStreamingSupported": false,
                "_listeningToSwSupport": false,
                "isVcardOverMmsDocument": false,
                "waveform": {
                    "0": 0,
                    "1": 0,
                    "2": 0,
                    "3": 0,
                    "4": 0,
                    "5": 0,
                    "6": 0,
                    "7": 0,
                    "8": 0,
                    "9": 0,
                    "10": 0,
                    "11": 0,
                    "12": 42,
                    "13": 66,
                    "14": 71,
                    "15": 68,
                    "16": 80,
                    "17": 80,
                    "18": 80,
                    "19": 80,
                    "20": 82,
                    "21": 82,
                    "22": 82,
                    "23": 83,
                    "24": 81,
                    "25": 78,
                    "26": 79,
                    "27": 75,
                    "28": 79,
                    "29": 79,
                    "30": 77,
                    "31": 72,
                    "32": 59,
                    "33": 74,
                    "34": 77,
                    "35": 76,
                    "36": 75,
                    "37": 75,
                    "38": 79,
                    "39": 78,
                    "40": 77,
                    "41": 73,
                    "42": 69,
                    "43": 75,
                    "44": 75,
                    "45": 73,
                    "46": 71,
                    "47": 70,
                    "48": 74,
                    "49": 75,
                    "50": 76,
                    "51": 75,
                    "52": 74,
                    "53": 71,
                    "54": 77,
                    "55": 77,
                    "56": 77,
                    "57": 72,
                    "58": 63,
                    "59": 76,
                    "60": 78,
                    "61": 40,
                    "62": 7,
                    "63": 0
                }
            },
            "text": ""
        }

Anything else?

No response

smashah commented 2 years ago

@DaruinHerrera you can decrypt these files.

https://docs.openwa.dev/pages/How%20to/decrypt-media.html

This is not an issue so moving to discussion.