{"id":14987035,"url":"https://github.com/ndalu-id/baileys-api","last_synced_at":"2025-07-15T10:40:20.485Z","repository":{"id":44337311,"uuid":"512083238","full_name":"ndalu-id/baileys-api","owner":"ndalu-id","description":"whatsapp api to remote your whatsapp device. Support multi device, multi client. Still update to more feature. Please fork, star, donate and share.","archived":false,"fork":false,"pushed_at":"2024-07-24T16:23:50.000Z","size":11782,"stargazers_count":73,"open_issues_count":9,"forks_count":39,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-01-20T16:14:12.002Z","etag":null,"topics":["baileys","baileys-api","baileys-md","free","whatsapp","whatsapp-api","whatsapp-bot","whatsapp-web"],"latest_commit_sha":null,"homepage":"https://ndalu.id","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ndalu-id.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-09T03:26:17.000Z","updated_at":"2024-12-25T18:11:48.000Z","dependencies_parsed_at":"2024-09-19T20:11:22.311Z","dependency_job_id":null,"html_url":"https://github.com/ndalu-id/baileys-api","commit_stats":{"total_commits":63,"total_committers":4,"mean_commits":15.75,"dds":"0.33333333333333337","last_synced_commit":"e428e41553e50dec0f3400c75bb5ad9762c6ba2e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndalu-id%2Fbaileys-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndalu-id%2Fbaileys-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndalu-id%2Fbaileys-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndalu-id%2Fbaileys-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndalu-id","download_url":"https://codeload.github.com/ndalu-id/baileys-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236027205,"owners_count":19083396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["baileys","baileys-api","baileys-md","free","whatsapp","whatsapp-api","whatsapp-bot","whatsapp-web"],"created_at":"2024-09-24T14:13:59.534Z","updated_at":"2025-01-28T14:12:26.247Z","avatar_url":"https://github.com/ndalu-id.png","language":"JavaScript","funding_links":["https://paypal.me/tofiknuryanto","https://www.buymeacoffee.com/tofiknuryanto"],"categories":[],"sub_categories":[],"readme":"# Ndalu-wa-client\n\n![Wa.ndalu.id!](https://wa.ndalu.id/favicon.png \"Tofik Nuryanto\")\n\n    DEPENDENCIES : {\n        \"@adiwajshing/keyed-db\": \"^0.2.4\",\n        \"@hapi/boom\": \"^10.0.0\",\n        \"axios\": \"^0.27.2\",\n        \"body-parser\": \"^1.20.0\",\n        \"crypto-js\": \"^4.1.1\",\n        \"dotenv\": \"^16.0.1\",\n        \"express\": \"^4.18.1\",\n        \"futoin-hkdf\": \"^1.5.1\",\n        \"libsignal\": \"git+https://github.com/adiwajshing/libsignal-node\",\n        \"link-preview-js\": \"^2.1.19\",\n        \"music-metadata\": \"^8.0.1\",\n        \"mysql\": \"^2.18.1\",\n        \"node-cache\": \"^5.1.2\",\n        \"node-cron\": \"^3.0.1\",\n        \"pino\": \"^8.1.0\",\n        \"pino-pretty\": \"^8.1.0\",\n        \"protobufjs\": \"^7.0.0\",\n        \"qrcode\": \"^1.5.0\",\n        \"qrcode-terminal\": \"^0.12.0\",\n        \"sharp\": \"^0.30.7\",\n        \"socket.io\": \"^4.5.1\",\n        \"uuid\": \"^8.3.2\",\n        \"winston\": \"^3.8.1\",\n        \"winston-daily-rotate-file\": \"^4.7.1\",\n        \"ws\": \"^8.8.1\"\n    }\n\nWhatsapp API based on [baileys](https://github.com/adiwajshing/Baileys).\n\nDemo visit here [ndalu-wa.herokuapp.com](https://ndalu-wa.herokuapp.com/)\n\n# Update\n\n    Please share your log file if any error.\n    Don't share your creds !!!!! Or if you trust me contact me on instagram\n\n## HEROKU\n\n[![How to deploy this app at HEROKU](https://img.youtube.com/vi/EMV7-LRyec4/0.jpg)](https://www.youtube.com/watch?v=EMV7-LRyec4 \"How to deploy this app at HEROKU\")\n\n## TODO\n\n    - download media ✔️\n    - log to file every actifity (will input into database chat, will make app lighter) 🔥🔥🔥✔️✔️\n    - group API (after mysql done) 🔥🔥🔥\n\n## UPDATE\n\nIf imageMessage or videoMessage using gif webhook will receive imageBase64 for your media // feature by request Liu Bei. Thanks the donation btw.\n\nREMOVE baileys from node_moduless. Add baileys own build to src folder. Fix LIST, BUTTON message and TEMPLATE.\n\nAdding message type for scheduler\n\n    - type == 'sendText'\n    - type == 'sendMedia'\n    - type == 'sendButtonMessage'\n    - type == 'sendTemplateMessage'\n    - type == 'sendListMessage'\n    - type == 'sendListMessage'\n\nNow you can use number as array in scheduler.\n\nUpdate getMessage on retry sending message.\n\n## EMIT LIST\n\n    // This app is emitting event:\n    event: 'connection-open'\n    data: {token, user, ppUrl}\n\n    event: 'message-upsert'\n    data: {token, key, message}\n\n    event: 'message'\n    data: {message}\n\n    event: 'qrcode'\n    data: {token, data}\n\n    event: 'message'\n    data: {message}\n\n    // Your client side use this on your js\n    socket.on('event', (data) =\u003e {\n        // do something with this data\n        console.log(data)\n    })\n\n## DOCUMENTATION\n\n    BEFORE INSTALLATION\n    Create folder named credentials\n\n    TO CLEAR YARN CACHE\n    yarn clean cache\n\n    TO INSTALL\n    yarn install\n\n    TO START DEVELOPER MODE\n    WINDOWS: yarn win-dev\n    LINUX: yarn dev\n    VISIT: http://localhost:3000\n\n    TO START production MODE\n    WINDOWS: yarn win-start\n    LINUX: yarn start\n\n    If you deploy to VPS and your client side is different domain, make sure this rule:\n    1. API https Client http\n    2. API https Client https\n    3. API http Client http\n\n## ENV\n\n    ALWAYS CHECK YOUR .env FILE\n    PORT = 3000 // port for your nodejs api (http://localhost:3000)\n    AUTH = Ndalu-server-uUdkfgli783pkfnlaskogoighr // key to protect your api server from attacker, you can change but must change the headers auth. Try using postman to generate the auth\n    ORIGIN = http://localhost // your client domain\n    WEBHOOK = http://localhost/webhook-catch-message-from-api\n\n## EXAMPLE\n\n![example page](/src/public/sample-page.png)\n\n    run the app and open http://localhost:PORT\n    I just add example page using static html. Remove this if you done with your update\n\n    If you using PHP on client side you can check PHP folder.\n    Index.php is client interface and post.php is controller to handle post to API\n\n## WEBHOOK\n\n    READ file src/router/model/whatsapp.js\n    LINE 149\n\n    /** START WEBHOOK */\n    const url = process.env.WEBHOOK\n    axios.post(url, {\n        token: token,\n        key: key,\n        message: message\n    })\n    .then(function (response) {\n        console.log(response);\n        io.emit('message-upsert', {token, key, message: message, info: 'Your webhook is configured', response: response})\n    })\n    .catch(function (error) {\n        console.log(error);\n        io.emit('message-upsert', {token, key, message: message, alert: 'This is because you not set your webhook to receive this action', error: error})\n    });\n    /** END WEBHOOK */\n\n    REPLACE the [url] value with your webhook url, this action will send all actifity to your webhook\n    It send 3 value, token, key, and message. Do something action with your webhook.\n\n    // deprecated, enntity to large\n    If imageMessage or videoMessage using gif webhook will receive imageBase64 for your media // feature by request Liu Bei\n\n## AUTOSTART INSTANCE\n\n    WHEN YOU SEEN ERROR MESSAGE LIKE THIS\n\n    ERROR [2022-06-12 09:02:00.173 +0700]: Cannot read property 'emit' of undefined\n    err: {\n      \"type\": \"TypeError\",\n      \"message\": \"Cannot read property 'emit' of undefined\",\n      \"stack\":\n          TypeError: Cannot read property 'emit' of undefined\n              at EventEmitter.\u003canonymous\u003e (D:\\9. nDalu.id\\BLOG\\wa.ndalu.express\\NDALU-WA-CLIENT\\src\\router\\model\\whatsapp.js:112:20)\n              at processTicksAndRejections (internal/process/task_queues.js:95:5)\n    }\n\n    It cause auto start not emitting data to client. It's ok\n\n## CONNECTION\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/create-instance' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\"\n    }'\n\n## DELETE INSTANCE (VERY RECOMENDED TO CLOSE FROM WHATSAPP DEVICE)\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/delete-credential' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --header 'Content-Type: application/json' \\\n    --data-raw '{\n        \"token\": \"token\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {\n            \"status\": true,\n            \"message\": \"Deleting session and credential\"\n        }\n    }\n\n## SEND TEXT MESSAGE\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/send-text' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"text\": \"Some text\",\n        \"number\": \"000000@s.whatsapp.net\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"message\": {\n            \"key\": {\n                \"remoteJid\": \"000000@s.whatsapp.net\",\n                \"fromMe\": true,\n                \"id\": \"BAE5297A96E02462\"\n            },\n            \"message\": {\n                \"extendedTextMessage\": {\n                    \"text\": \"This is text\"\n                }\n            },\n            \"messageTimestamp\": \"1654779828\",\n            \"status\": \"PENDING\"\n        }\n    }\n\n## SEND MEDIA\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/send-media' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@s.whatsapp.net\",\n        \"type\": \"image\",\n        \"url\": \"https://www.accenture.com/t20200916T091441Z__w__/id-en/_acnmedia/Accenture/Redesign-Assets/DotCom/Images/Global/Hero/14/Accenture-Dutch-Flower-Group-Hero-768x432.jpg\",\n        \"fileName\": null,\n        \"caption\": \"Sample post image\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {\n            \"key\": {\n                \"remoteJid\": \"000000@s.whatsapp.net\",\n                \"fromMe\": true,\n                \"id\": \"BAE59EA5D8DAA724\"\n            },\n            \"message\": {\n                \"imageMessage\": {\n                    \"url\": \"https://mmg.whatsapp.net/d/f/Aj_8pgwA2F-051ramSmyaSQ2UxFkJUfWeHfdb64102u6.enc\",\n                    \"mimetype\": \"image/jpeg\",\n                    \"caption\": \"Sample post image\",\n                    \"fileSha256\": \"EAoHpByPmaXBROZdbDGFE0ny43akP1mtoOc0pVIVHZo=\",\n                    \"fileLength\": \"50273\",\n                    \"mediaKey\": \"kYMps2Okcz4hseS3Z0xYVi3GaHcRau+QM0yyFi1vMdM=\",\n                    \"fileEncSha256\": \"T12a3I0clU6YXrJhbul9FnIhZNkFkBgvyRvtiYKcx4Y=\",\n                    \"directPath\": \"/v/t62.7118-24/29985078_795739718081779_7756978664535743234_n.enc?ccb=11-4\u0026oh=01_AVxl5oG_J7XfVxfogP2b-DU5ADW3RTbsUTxGXwtYs360FQ\u0026oe=62C749F1\",\n                    \"mediaKeyTimestamp\": \"1654781441\",\n                    \"jpegThumbnail\": \"/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAASACADASIAAhEBAxEB/8QAGQAAAwEBAQAAAAAAAAAAAAAAAAUGBAED/8QAJxAAAgEDAgUEAwAAAAAAAAAAAQIDAAQREiEFEyJBYRQxUXEVkeH/xAAXAQEBAQEAAAAAAAAAAAAAAAADAgEE/8QAGhEAAgMBAQAAAAAAAAAAAAAAAAECETESE//aAAwDAQACEQMRAD8AuAayy8St4ndGJ1oRtj3+q9JpDHGWUZI7VPtfpFfOZWYIwORyiSue4+P1Wt0XBLWMfycz3GqIxGHcjU2M/wBphHdK8vLyC4GWAOcVIxM1zCY3tVKI7MsoGHI8jNd4ZdCC+aQS6mAwVHs/n7xQ+r6SoqT6pJUVprA6L65zpGeWN8eTRRTgMUX40XaFOk57bUquunjMgXYFckD5oooZ6dEMP//Z\"\n                }\n            },\n            \"messageTimestamp\": \"1654781441\",\n            \"status\": \"PENDING\"\n        }\n    }\n\n    TYPE LIST\n    MEDIA DEFAULT\n    type == 'image'\n    type == 'video'\n    type == 'audio'\n\n    DOCUMENT\n    type == 'pdf'\n    type == 'xls'\n    type == 'xlsx'\n    type == 'doc'\n    type == 'docx'\n    type == 'zip'\n    type == 'mp3'\n\n    src/router/model/whatsapp.js start from line 222\n    Update with your own mimetype if you need\n\n## SEND BUTTON MESSAGE\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/send-button-message' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@s.whatsapp.net\",\n        \"button\": [\n            {\"displayText\": \"First Button\"},\n            {\"displayText\": \"Second Button\"},\n            {\"displayText\": \"Third Button\"}\n        ],\n        \"message\": \"Message using buttons\",\n        \"footer\": \"Footer message\",\n        \"type\": \"url\",\n        \"image\": \"https://wa.ndalu.id/favicon.png\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {\n            \"key\": {\n                \"remoteJid\": \"000000@s.whatsapp.net\",\n                \"fromMe\": true,\n                \"id\": \"BAE58396D9FC00F6\"\n            },\n            \"message\": {\n                \"buttonsMessage\": {\n                    \"imageMessage\": {\n                        \"url\": \"https://mmg.whatsapp.net/d/f/Ajj14KBK6Td4y8sAhVMlH3BNcIyfArxxXiUf4LH8GQYH.enc\",\n                        \"mimetype\": \"image/jpeg\",\n                        \"caption\": \"Message using buttons\",\n                        \"fileSha256\": \"Gu2aCbfn2d+siwhE6oY5l6h1V2swt904x7aVp471uag=\",\n                        \"fileLength\": \"73382\",\n                        \"mediaKey\": \"eOZ8nyOPTvPqh+jOubKhCF3saK8SO6978ZZWabgUVYo=\",\n                        \"fileEncSha256\": \"iPYUnT/+c1GSA0Gwsr+rjhGOjid4VbCp8AjICNX88DY=\",\n                        \"directPath\": \"/v/t62.7118-24/33538136_3309741435925578_5503761464211122759_n.enc?ccb=11-4\u0026oh=01_AVzT742cWpk0CaKo0HjR0ruEfFVrO6aMJOCkh-ulv4gEsA\u0026oe=62C7C20F\",\n                        \"mediaKeyTimestamp\": \"1654782402\",\n                        \"jpegThumbnail\": \"/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAAgACADASIAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAABQYA/8QAJxAAAgEEAgAFBQEAAAAAAAAAAQIDAAQFESExEkFRYZEGIkJxwdH/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/xAAYEQEBAQEBAAAAAAAAAAAAAAABABECMf/aAAwDAQACEQMRAD8Av6k76XK5fOXNtZ3zWNpZEKzINs7kbqsoEtaRZi5tiwe4ZhchTwd68PG++h81npwqGsfiJ8njPqSPG31817DdRs6O/akb+Ojx+qrqAgaylz8ECMBcW6vMVUb5YaIJ8vWn6cukfbUR4obvJywywg/j9y6JAHY9RulZC6oSihm8hvW6l85hb7OSQywSLaspIckEH5HJPt1VaTFqYI8lJbrCEeKNdMB2D5D/AD2pKpjAYm8wiuLjV1K77Urs6Gtb2f7VMpJUEjR1yPShL//Z\"\n                    },\n                    \"contentText\": \"Message using buttons\",\n                    \"buttons\": [\n                        {\n                            \"buttonId\": \"0\",\n                            \"buttonText\": {\n                                \"displayText\": \"First Button\"\n                            },\n                            \"type\": \"RESPONSE\"\n                        },\n                        {\n                            \"buttonId\": \"1\",\n                            \"buttonText\": {\n                                \"displayText\": \"Second Button\"\n                            },\n                            \"type\": \"RESPONSE\"\n                        },\n                        {\n                            \"buttonId\": \"2\",\n                            \"buttonText\": {\n                                \"displayText\": \"Third Button\"\n                            },\n                            \"type\": \"RESPONSE\"\n                        }\n                    ],\n                    \"headerType\": \"IMAGE\"\n                }\n            },\n            \"messageTimestamp\": \"1654782402\",\n            \"status\": \"PENDING\"\n        }\n    }\n\n## SEND TEMPLATE MESSAGE\n\n    (If you message is sent back to your device, check your desktop whatsapp. Fix on desktop. Bug from baileys)\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/send-template-message' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@s.whatsapp.net\",\n        \"button\": [\n            {\"displayText\": \"Visit my website\", \"url\": \"https://wa.ndalu.id\"},\n            {\"displayText\": \"Call me\", \"phoneNumber\": \"000000\"},\n            {\"displayText\": \"Push to reply\", \"id\": \"id-like-buttons-message\"}\n        ],\n        \"text\": \"Message using buttons\",\n        \"footer\": \"Footer message\",\n        \"image\": \"https://wa.ndalu.id/favicon.png\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {\n            \"key\": {\n                \"remoteJid\": \"000000@s.whatsapp.net\",\n                \"fromMe\": true,\n                \"id\": \"BAE5DF8FA196F0DE\"\n            },\n            \"message\": {\n                \"templateMessage\": {\n                    \"hydratedTemplate\": {\n                        \"hydratedContentText\": \"Hi it's a template message\",\n                        \"hydratedFooterText\": \"Hello World\",\n                        \"hydratedButtons\": [\n                            {\n                                \"urlButton\": {\n                                    \"displayText\": \"⭐ Star Baileys on GitHub!\",\n                                    \"url\": \"https://github.com/adiwajshing/Baileys\"\n                                },\n                                \"index\": 1\n                            },\n                            {\n                                \"callButton\": {\n                                    \"displayText\": \"Call me!\",\n                                    \"phoneNumber\": \"+1 (234) 5678-901\"\n                                },\n                                \"index\": 2\n                            },\n                            {\n                                \"quickReplyButton\": {\n                                    \"displayText\": \"This is a reply, just like normal buttons!\",\n                                    \"id\": \"id-like-buttons-message\"\n                                },\n                                \"index\": 3\n                            }\n                        ]\n                    }\n                }\n            },\n            \"messageTimestamp\": \"1654783970\",\n            \"status\": \"PENDING\"\n        }\n    }\n\n    // Unfortunally, image is not displayed for now, let me monitoring from github bailyes issues\n\n## SEND LIST MESSAGE\n\n    (NO IMAGE SUPPORTED, read baileys. https://github.com/adiwajshing/Baileys)\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/send-list-message' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@s.whatsapp.net\",\n        \"list\": [\n            {\n                \"title\": \"Section 1\",\n                \"rows\": [\n                    {\"title\": \"Option 1\", \"rowId\": \"option1\"},\n                    {\"title\": \"Option 2\", \"rowId\": \"option2\", \"description\": \"This is a description\"}\n                ]\n            },\n            {\n                \"title\": \"Section 2\",\n                \"rows\": [\n                    {\"title\": \"Option 3\", \"rowId\": \"option3\", \"description\": \"This is a description\"},\n                    {\"title\": \"Option 4\", \"rowId\": \"option4\"}\n                ]\n            }\n        ],\n        \"text\": \"This is a text\",\n        \"footer\": \"And this is a footer\",\n        \"link\": \"https://wa.ndalu.id\",\n        \"title\": \"And this is TITLE\",\n        \"buttonText\": \"Required, text on the button to view the list\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {\n            \"key\": {\n                \"remoteJid\": \"000000@s.whatsapp.net\",\n                \"fromMe\": true,\n                \"id\": \"BAE56E515A609CD5\"\n            },\n            \"message\": {\n                \"listMessage\": {\n                    \"title\": \"And this is TITLE\",\n                    \"description\": \"This is a text\",\n                    \"buttonText\": \"Required, text on the button to view the list\",\n                    \"listType\": \"SINGLE_SELECT\",\n                    \"sections\": [\n                        {\n                            \"title\": \"Section 1\",\n                            \"rows\": [\n                                {\n                                    \"title\": \"Option 1\",\n                                    \"rowId\": \"0\"\n                                },\n                                {\n                                    \"title\": \"Option 2\",\n                                    \"description\": \"This is a description\",\n                                    \"rowId\": \"1\"\n                                }\n                            ]\n                        },\n                        {\n                            \"title\": \"Section 2\",\n                            \"rows\": [\n                                {\n                                    \"title\": \"Option 3\",\n                                    \"description\": \"This is a description\",\n                                    \"rowId\": \"0\"\n                                },\n                                {\n                                    \"title\": \"Option 4\",\n                                    \"rowId\": \"1\"\n                                }\n                            ]\n                        }\n                    ],\n                    \"footerText\": \"And this is a footer\"\n                }\n            },\n            \"messageTimestamp\": \"1654784580\",\n            \"status\": \"PENDING\"\n        }\n    }\n\n## SEND REACTION\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/send-reaction' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@s.whatsapp.net\",\n        \"text\": \"🦖\",\n        \"key\": {\n            \"remoteJid\": \"000000@s.whatsapp.net\",\n            \"fromMe\": true,\n            \"id\": \"BAE56E515A609CD5\"\n        }\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {\n            \"key\": {\n                \"remoteJid\": \"000000@s.whatsapp.net\",\n                \"fromMe\": true,\n                \"id\": \"BAE5D730190A2628\"\n            },\n            \"message\": {\n                \"reactionMessage\": {\n                    \"key\": {\n                        \"remoteJid\": \"000000@s.whatsapp.net\",\n                        \"fromMe\": true,\n                        \"id\": \"BAE56E515A609CD5\"\n                    },\n                    \"text\": \"🦖\"\n                }\n            },\n            \"messageTimestamp\": \"1654784998\",\n            \"status\": \"PENDING\"\n        }\n    }\n\n## IS EXISTS\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/is-exists' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@s.whatsapp.net\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {\n            \"exists\": true,\n            \"jid\": \"000000@s.whatsapp.net\"\n        }\n    }\n\n## GET PROFILE PICTURE URL\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/get-profile-picture' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@s.whatsapp.net\",\n        \"highrest\": true\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": \"https://pps.whatsapp.net/v/t61.24694-24/175575661_389612149492065_1766253441851505238_n.jpg?ccb=11-4\u0026oh=be11861a0046460383de6c9da800a184\u0026oe=62B101AD\"\n    }\n\n## DELETE FOR EVERYONE\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/delete-for-every-one' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@s.whatsapp.net\",\n        \"key\": {\n            \"remoteJid\": \"000000@s.whatsapp.net\",\n            \"fromMe\": true,\n            \"id\": \"134BB7213EB66BADD360D9A037F4FD19\"\n        }\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {...data}\n    }\n\n## GROUP METADATA\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/group-metadata' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"number\": \"000000@g.us\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": {\n            \"id\": \"000000@g.us\",\n            \"subject\": \"Wabot test\",\n            \"creation\": 1649779303,\n            \"owner\": \"000000@s.whatsapp.net\",\n            \"restrict\": false,\n            \"announce\": false,\n            \"participants\": [\n                {\n                    \"id\": \"000000@s.whatsapp.net\",\n                    \"admin\": \"superadmin\"\n                },\n                {\n                    \"id\": \"000000@s.whatsapp.net\",\n                    \"admin\": null\n                },\n                {\n                    \"id\": \"000000000000@s.whatsapp.net\",\n                    \"admin\": null\n                }\n            ]\n        }\n    }\n\n## STORE\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/store/chats' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"type\": \"messages\",\n        \"jid\": \"000000@s.whatsapp.net\" // optional for type messages only\n    }'\n    // type : \"chats\" || \"contacts\" || \"messages\"\n\n    RESPONSE \"chats\"\n    [\n        {\n            \"id\": \"000000@s.whatsapp.net\",\n            \"conversationTimestamp\": 1654788131,\n            \"unreadCount\": 11\n        },\n        {\n            \"id\": \"0000000000@g.us\",\n            \"conversationTimestamp\": 1654787697,\n            \"unreadCount\": 2\n        },\n        ...\n    }\n\n    RESPONSE \"contacts\"\n    {\n        \"0000000000@g.us\": {\n            \"id\": \"0000000000@g.us\",\n            \"name\": \"The name of group\"\n        },\n        \"000000@g.us\": {\n            \"id\": \"000000@s.whatsapp.net\",\n            \"name\": \"The name of contacts\"\n        },\n        ...\n    }\n\n    RESPONSE \"messages\"\n    {\n        \"status@broadcast\": [...{key, message, messageTimestamp, pushName}],\n        \"0000000@s.whatsapp.net\": [...{key, message, messageTimestamp, pushName}]\n    }\n\n    RESPONSE \"messages\" WITH \"jid\"\n    [\n        {\n            \"key\": {\n                \"remoteJid\": \"000000@s.whatsapp.net\",\n                \"fromMe\": true,\n                \"id\": \"BAE5D730190A2628\"\n            },\n            \"message\": {\n                \"reactionMessage\": {\n                    \"key\": {\n                        \"remoteJid\": \"000000@s.whatsapp.net\",\n                        \"fromMe\": true,\n                        \"id\": \"BAE56E515A609CD5\"\n                    },\n                    \"text\": \"🦖\"\n                }\n            },\n            \"messageTimestamp\": \"1654784998\",\n            \"status\": \"PENDING\"\n        },\n        {\n            \"key\": {\n                \"remoteJid\": \"000000@s.whatsapp.net\",\n                \"fromMe\": true,\n                \"id\": \"BAE5DA01C6BAC242\"\n            },\n            \"message\": {\n                \"reactionMessage\": {\n                    \"text\": \"[object Object]\"\n                }\n            },\n            \"messageTimestamp\": \"1654786716\",\n            \"status\": \"PENDING\"\n        }\n    ]\n\n## DOWNLOAD MEDIA\n\nAfter you have a data store (or you can build your own). You can get a message by getting message by jid.\n\nFor sample you ca get message from some jid using POST http://localhost:3000/api/whatsapp/store/chats (Read STORE docs). And you will get data like this\n\n![example get message](/src/public/sample-get-store.png)\n\nTo download videoMessage from this data is just copy the blocked json like sample up there.\n\n    curl --location --request POST http://localhost:3000/api/whatsapp/download-media \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\",\n        \"message\": {\n            \"key\": {...},\n            \"message\": {...}\n        }\n    }'\n\n![example download file](/src/public/result-download.png)\n\nfile only ready for 1 hour\n\n## IMPLEMENTING A DATA STORE\n\nAs mentioned earlier, Baileys does not come with a defacto storage for chats, contacts, messages. However, a simple in-memory implementation has been provided. The store listens for chat updates, new messages, message updates etc. to always have an up to date version of the data.\n\nThe store also provides some simple functions such as loadMessages that utilize the store to speed up data retrieval.\n\nNote: I highly recommend building your own data store especially for MD connections, as storing someone's entire chat history in memory is a terrible waste of RAM. Connecting, deleting credential, connecting again will make your MD store mess up and last store will gone.\n\n## GET SCHEDULER\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/scheduler' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"token\": \"sometoken\"\n    }'\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": [\n            {\n                \"type\": \"sendText\",\n                \"data\": {\n                    \"number\": \"6285640465672@s.whatsapp.net\",\n                    \"text\": \"scheduler text\"\n                },\n                \"time\": \"58 11 * * *\"\n            },\n            {\n                \"type\": \"sendText\",\n                \"data\": {\n                    \"number\": \"6285640465672@s.whatsapp.net\",\n                    \"text\": \"scheduler text\"\n                },\n                \"time\": \"58 11 * * *\"\n            }\n        ]\n    }\n\n## ADD SCHEDULER\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/scheduler/add-scheduler' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"id\": 1, // uniq id. Will be saved into scheduler.js. When system restarted this data will auto executed by node-cron\n        \"token\": \"test\",\n        \"type\": \"sendText\",\n        \"data\": {\n            \"number\": \"000000@s.whatsapp.net\",\n            \"text\": \"Pesan otomatis\"\n        },\n        \"time\": \"05 12 * * *\"\n    }'\n\n    type : ['on update']\n    data: ['on update']\n\n    RESPONSE\n    {\n        \"status\": true,\n        \"data\": [...data-cron]\n    }\n\n## STOP SCHEDULER\n\n    curl --location --request POST 'localhost:3000/api/whatsapp/scheduler/stop-scheduler' \\\n    --header 'Content-Type: application/json' \\\n    --header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \\\n    --data-raw '{\n        \"id\": 1, // this id will stopped and deleted from scheduler.js. When system restarted node-cron not run it again\n        \"token\": \"test\",\n    }'\n\n    RESPONSE\n    {\n        \"status\": true || false,\n        \"message\": [Message status success or failed]\n    }\n\n## SUPPORT\n\nPlease Fork\n\nStar :star:\n\nShare\n\n[Donation - Paypal](https://paypal.me/tofiknuryanto)\n\n[Donation - Buy me a coffee](https://www.buymeacoffee.com/tofiknuryanto)\n\n[Ask me on telegram ( Sometime slow response, sorry I'mm hungry )](https://t.me/ndaludotid)\n\nBank JAGO/Artos - 506443461704\n\nOther BANK by chat telegram\n\nStill updating every have a break time from my activity\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndalu-id%2Fbaileys-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndalu-id%2Fbaileys-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndalu-id%2Fbaileys-api/lists"}