whatsapp api to remote your whatsapp device. Support multi device, multi client. Still update to more feature. Please fork, star, donate and share.

Overview

Ndalu-wa-client

Wa.ndalu.id!

DEPENDENCIES : {
    "@adiwajshing/baileys": "^4.2.0",
    "@adiwajshing/keyed-db": "^0.2.4",
    "axios": "^0.27.2",
    "body-parser": "^1.20.0",
    "crypto-js": "^4.1.1",
    "dotenv": "^16.0.1",
    "express": "^4.18.1",
    "link-preview-js": "^2.1.19",
    "node-cron": "^3.0.1",
    "pino": "^8.1.0",
    "pino-pretty": "^8.1.0",
    "qrcode": "^1.5.0",
    "qrcode-terminal": "^0.12.0",
    "sharp": "^0.30.7",
    "socket.io": "^4.5.1",
    "uuid": "^8.3.2"
}

Whatsapp API based on baileys. Demo visit here wa.ndalu.id

TODO

- do update scheduler.json ✔️
- do reload cron every update scheduler ✔️
- do type and data post to add scheduler 🔥🔥🔥
- download media 🔥🔥🔥
- group API 🔥🔥🔥
- Should I share or create new FRONT END? 🔥🔥
- Optional using STORE or not. You can use your own data store (own database) 🔥🔥

UPDATE

Baileys nolonger using useSingeFileAuthState, now using useMultiFileAuthState. Script updated using last baileys documentation.

Credential and store will saved in the credentials file. Still not trying much, maybe have a bug. Not already checked for more details during my activity.

Scheduler messages using node-cron (User must know about cronjob to managing time scheduler) crontab

When node-cron have Error: Cannot find module 'uuid'

yarn add uuid

Emit message when request time out

EMIT LIST

// This app is emitting event:
event: 'connection-open'
data: {token, user, ppUrl}

event: 'message-upsert'
data: {token, key, message}

event: 'message'
data: {message}

event: 'qrcode'
data: {token, data}

event: 'message'
data: {message}

// Your client side use this on your js
socket.on('event', (data) => {
    // do something with this data
    console.log(data)
})

DOCUMENTATION

BEFORE INSTALLATION
Create folder named credentials

TO INSTALL
yarn install

TO START DEVELOPER MODE
WINDOWS: yarn win-dev
LINUX: yarn dev
VISIT: http://localhost:3000

TO START production MODE
WINDOWS: yarn win-start
LINUX: yarn start

If you deploy to VPS and your client side is different domain, make sure this rule:
1. API https Client http
2. API https Client https
3. API http Client http

ENV

ALWAYS CHECK YOUR .env FILE
PORT = 3000 // port for your nodejs api (http://localhost:3000)
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
ORIGIN = http://localhost // your client domain
WEBHOOK = http://localhost/webhook-catch-message-from-api

EXAMPLE

example page

run the app and open http://localhost:PORT
I just add example page using static html. Remove this if you done with your update

If you using PHP on client side you can check PHP folder.
Index.php is client interface and post.php is controller to handle post to API

WEBHOOK

READ file src/router/model/whatsapp.js
LINE 136

/** START WEBHOOK */
const url = process.env.WEBHOOK
axios.post(url, {
    key: key,
    message: message
})
.then(function (response) {
    console.log(response);
    io.emit('message-upsert', {token, key, message: message, info: 'Your webhook is configured', response: response})
})
.catch(function (error) {
    console.log(error);
    io.emit('message-upsert', {token, key, message: message, alert: 'This is because you not set your webhook to receive this action', error: error})
});
/** END WEBHOOK */

REPLACE the [url] value with your webhook url, this action will send all actifity to your webhook
It send 3 value, token, key, and message. Do something action with your webhook.

AUTOSTART INSTANCE

WHEN YOU SEEN ERROR MESSAGE LIKE THIS

ERROR [2022-06-12 09:02:00.173 +0700]: Cannot read property 'emit' of undefined
err: {
  "type": "TypeError",
  "message": "Cannot read property 'emit' of undefined",
  "stack":
      TypeError: Cannot read property 'emit' of undefined
          at EventEmitter.<anonymous> (D:\9. nDalu.id\BLOG\wa.ndalu.express\NDALU-WA-CLIENT\src\router\model\whatsapp.js:112:20)
          at processTicksAndRejections (internal/process/task_queues.js:95:5)
}

It cause auto start not emitting data to client. It's ok

CONNECTION

curl --location --request POST 'localhost:3000/api/whatsapp/create-instance' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken"
}'

DELETE INSTANCE (VERY RECOMENDED TO CLOSE FROM WHATSAPP DEVICE)

curl --location --request POST 'localhost:3000/api/whatsapp/delete-credential' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "token": "token"
}'

RESPONSE
{
    "status": true,
    "data": {
        "status": true,
        "message": "Deleting session and credential"
    }
}

SEND TEXT MESSAGE

curl --location --request POST 'localhost:3000/api/whatsapp/send-text' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "text": "Some text",
    "number": "[email protected]"
}'

RESPONSE
{
    "status": true,
    "message": {
        "key": {
            "remoteJid": "[email protected]",
            "fromMe": true,
            "id": "BAE5297A96E02462"
        },
        "message": {
            "extendedTextMessage": {
                "text": "This is text"
            }
        },
        "messageTimestamp": "1654779828",
        "status": "PENDING"
    }
}

SEND MEDIA

curl --location --request POST 'localhost:3000/api/whatsapp/send-media' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]",
    "type": "image",
    "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",
    "fileName": null,
    "caption": "Sample post image"
}'

RESPONSE
{
    "status": true,
    "data": {
        "key": {
            "remoteJid": "[email protected]",
            "fromMe": true,
            "id": "BAE59EA5D8DAA724"
        },
        "message": {
            "imageMessage": {
                "url": "https://mmg.whatsapp.net/d/f/Aj_8pgwA2F-051ramSmyaSQ2UxFkJUfWeHfdb64102u6.enc",
                "mimetype": "image/jpeg",
                "caption": "Sample post image",
                "fileSha256": "EAoHpByPmaXBROZdbDGFE0ny43akP1mtoOc0pVIVHZo=",
                "fileLength": "50273",
                "mediaKey": "kYMps2Okcz4hseS3Z0xYVi3GaHcRau+QM0yyFi1vMdM=",
                "fileEncSha256": "T12a3I0clU6YXrJhbul9FnIhZNkFkBgvyRvtiYKcx4Y=",
                "directPath": "/v/t62.7118-24/29985078_795739718081779_7756978664535743234_n.enc?ccb=11-4&oh=01_AVxl5oG_J7XfVxfogP2b-DU5ADW3RTbsUTxGXwtYs360FQ&oe=62C749F1",
                "mediaKeyTimestamp": "1654781441",
                "jpegThumbnail": "/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAASACADASIAAhEBAxEB/8QAGQAAAwEBAQAAAAAAAAAAAAAAAAUGBAED/8QAJxAAAgEDAgUEAwAAAAAAAAAAAQIDAAQREiEFEyJBYRQxUXEVkeH/xAAXAQEBAQEAAAAAAAAAAAAAAAADAgEE/8QAGhEAAgMBAQAAAAAAAAAAAAAAAAECETESE//aAAwDAQACEQMRAD8AuAayy8St4ndGJ1oRtj3+q9JpDHGWUZI7VPtfpFfOZWYIwORyiSue4+P1Wt0XBLWMfycz3GqIxGHcjU2M/wBphHdK8vLyC4GWAOcVIxM1zCY3tVKI7MsoGHI8jNd4ZdCC+aQS6mAwVHs/n7xQ+r6SoqT6pJUVprA6L65zpGeWN8eTRRTgMUX40XaFOk57bUquunjMgXYFckD5oooZ6dEMP//Z"
            }
        },
        "messageTimestamp": "1654781441",
        "status": "PENDING"
    }
}

TYPE LIST
MEDIA DEFAULT
type == 'image'
type == 'video'
type == 'audio'

DOCUMENT
type == 'pdf'
type == 'xls'
type == 'xlsx'
type == 'doc'
type == 'docx'
type == 'zip'
type == 'mp3'

src/router/model/whatsapp.js start from line 222
Update with your own mimetype if you need

SEND BUTTON MESSAGE

curl --location --request POST 'localhost:3000/api/whatsapp/send-button-message' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]",
    "button": [
        {"displayText": "First Button"},
        {"displayText": "Second Button"},
        {"displayText": "Third Button"}
    ],
    "message": "Message using buttons",
    "footer": "Footer message",
    "type": "url",
    "image": "https://wa.ndalu.id/favicon.png"
}'

RESPONSE
{
    "status": true,
    "data": {
        "key": {
            "remoteJid": "[email protected]",
            "fromMe": true,
            "id": "BAE58396D9FC00F6"
        },
        "message": {
            "buttonsMessage": {
                "imageMessage": {
                    "url": "https://mmg.whatsapp.net/d/f/Ajj14KBK6Td4y8sAhVMlH3BNcIyfArxxXiUf4LH8GQYH.enc",
                    "mimetype": "image/jpeg",
                    "caption": "Message using buttons",
                    "fileSha256": "Gu2aCbfn2d+siwhE6oY5l6h1V2swt904x7aVp471uag=",
                    "fileLength": "73382",
                    "mediaKey": "eOZ8nyOPTvPqh+jOubKhCF3saK8SO6978ZZWabgUVYo=",
                    "fileEncSha256": "iPYUnT/+c1GSA0Gwsr+rjhGOjid4VbCp8AjICNX88DY=",
                    "directPath": "/v/t62.7118-24/33538136_3309741435925578_5503761464211122759_n.enc?ccb=11-4&oh=01_AVzT742cWpk0CaKo0HjR0ruEfFVrO6aMJOCkh-ulv4gEsA&oe=62C7C20F",
                    "mediaKeyTimestamp": "1654782402",
                    "jpegThumbnail": "/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAAgACADASIAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAABQYA/8QAJxAAAgEEAgAFBQEAAAAAAAAAAQIDAAQFESExEkFRYZEGIkJxwdH/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/xAAYEQEBAQEBAAAAAAAAAAAAAAABABECMf/aAAwDAQACEQMRAD8Av6k76XK5fOXNtZ3zWNpZEKzINs7kbqsoEtaRZi5tiwe4ZhchTwd68PG++h81npwqGsfiJ8njPqSPG31817DdRs6O/akb+Ojx+qrqAgaylz8ECMBcW6vMVUb5YaIJ8vWn6cukfbUR4obvJywywg/j9y6JAHY9RulZC6oSihm8hvW6l85hb7OSQywSLaspIckEH5HJPt1VaTFqYI8lJbrCEeKNdMB2D5D/AD2pKpjAYm8wiuLjV1K77Urs6Gtb2f7VMpJUEjR1yPShL//Z"
                },
                "contentText": "Message using buttons",
                "buttons": [
                    {
                        "buttonId": "0",
                        "buttonText": {
                            "displayText": "First Button"
                        },
                        "type": "RESPONSE"
                    },
                    {
                        "buttonId": "1",
                        "buttonText": {
                            "displayText": "Second Button"
                        },
                        "type": "RESPONSE"
                    },
                    {
                        "buttonId": "2",
                        "buttonText": {
                            "displayText": "Third Button"
                        },
                        "type": "RESPONSE"
                    }
                ],
                "headerType": "IMAGE"
            }
        },
        "messageTimestamp": "1654782402",
        "status": "PENDING"
    }
}

SEND TEMPLATE MESSAGE

(If you message is sent back to your device, check your desktop whatsapp. Fix on desktop. Bug from baileys)

curl --location --request POST 'localhost:3000/api/whatsapp/send-template-message' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]",
    "button": [
        {"displayText": "Visit my website", "url": "https://wa.ndalu.id"},
        {"displayText": "Call me", "phoneNumber": "000000"},
        {"displayText": "Push to reply", "id": "id-like-buttons-message"}
    ],
    "text": "Message using buttons",
    "footer": "Footer message",
    "image": "https://wa.ndalu.id/favicon.png"
}'

RESPONSE
{
    "status": true,
    "data": {
        "key": {
            "remoteJid": "[email protected]",
            "fromMe": true,
            "id": "BAE5DF8FA196F0DE"
        },
        "message": {
            "templateMessage": {
                "hydratedTemplate": {
                    "hydratedContentText": "Hi it's a template message",
                    "hydratedFooterText": "Hello World",
                    "hydratedButtons": [
                        {
                            "urlButton": {
                                "displayText": "⭐ Star Baileys on GitHub!",
                                "url": "https://github.com/adiwajshing/Baileys"
                            },
                            "index": 1
                        },
                        {
                            "callButton": {
                                "displayText": "Call me!",
                                "phoneNumber": "+1 (234) 5678-901"
                            },
                            "index": 2
                        },
                        {
                            "quickReplyButton": {
                                "displayText": "This is a reply, just like normal buttons!",
                                "id": "id-like-buttons-message"
                            },
                            "index": 3
                        }
                    ]
                }
            }
        },
        "messageTimestamp": "1654783970",
        "status": "PENDING"
    }
}

// Unfortunally, image is not displayed for now, let me monitoring from github bailyes issues

SEND LIST MESSAGE

(NO IMAGE SUPPORTED, read baileys. https://github.com/adiwajshing/Baileys)

curl --location --request POST 'localhost:3000/api/whatsapp/send-list-message' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]",
    "list": [
        {
            "title": "Section 1",
            "rows": [
                {"title": "Option 1", "rowId": "option1"},
                {"title": "Option 2", "rowId": "option2", "description": "This is a description"}
            ]
        },
        {
            "title": "Section 2",
            "rows": [
                {"title": "Option 3", "rowId": "option3", "description": "This is a description"},
                {"title": "Option 4", "rowId": "option4"}
            ]
        }
    ],
    "text": "This is a text",
    "footer": "And this is a footer",
    "link": "https://wa.ndalu.id",
    "title": "And this is TITLE",
    "buttonText": "Required, text on the button to view the list"
}'

RESPONSE
{
    "status": true,
    "data": {
        "key": {
            "remoteJid": "[email protected]",
            "fromMe": true,
            "id": "BAE56E515A609CD5"
        },
        "message": {
            "listMessage": {
                "title": "And this is TITLE",
                "description": "This is a text",
                "buttonText": "Required, text on the button to view the list",
                "listType": "SINGLE_SELECT",
                "sections": [
                    {
                        "title": "Section 1",
                        "rows": [
                            {
                                "title": "Option 1",
                                "rowId": "0"
                            },
                            {
                                "title": "Option 2",
                                "description": "This is a description",
                                "rowId": "1"
                            }
                        ]
                    },
                    {
                        "title": "Section 2",
                        "rows": [
                            {
                                "title": "Option 3",
                                "description": "This is a description",
                                "rowId": "0"
                            },
                            {
                                "title": "Option 4",
                                "rowId": "1"
                            }
                        ]
                    }
                ],
                "footerText": "And this is a footer"
            }
        },
        "messageTimestamp": "1654784580",
        "status": "PENDING"
    }
}

SEND REACTION

curl --location --request POST 'localhost:3000/api/whatsapp/send-reaction' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]",
    "text": "🦖",
    "key": {
        "remoteJid": "[email protected]",
        "fromMe": true,
        "id": "BAE56E515A609CD5"
    }
}'

RESPONSE
{
    "status": true,
    "data": {
        "key": {
            "remoteJid": "[email protected]",
            "fromMe": true,
            "id": "BAE5D730190A2628"
        },
        "message": {
            "reactionMessage": {
                "key": {
                    "remoteJid": "[email protected]",
                    "fromMe": true,
                    "id": "BAE56E515A609CD5"
                },
                "text": "🦖"
            }
        },
        "messageTimestamp": "1654784998",
        "status": "PENDING"
    }
}

IS EXISTS

curl --location --request POST 'localhost:3000/api/whatsapp/is-exists' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]"
}'

RESPONSE
{
    "status": true,
    "data": {
        "exists": true,
        "jid": "[email protected]"
    }
}

GET PROFILE PICTURE URL

curl --location --request POST 'localhost:3000/api/whatsapp/get-profile-picture' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]",
    "highrest": true
}'

RESPONSE
{
    "status": true,
    "data": "https://pps.whatsapp.net/v/t61.24694-24/175575661_389612149492065_1766253441851505238_n.jpg?ccb=11-4&oh=be11861a0046460383de6c9da800a184&oe=62B101AD"
}

DELETE FOR EVERYONE

curl --location --request POST 'localhost:3000/api/whatsapp/delete-for-every-one' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]",
    "key": {
        "remoteJid": "[email protected]",
        "fromMe": true,
        "id": "134BB7213EB66BADD360D9A037F4FD19"
    }
}'

RESPONSE
{
    "status": true,
    "data": {...data}
}

GROUP METADATA

curl --location --request POST 'localhost:3000/api/whatsapp/group-metadata' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "number": "[email protected]"
}'

RESPONSE
{
    "status": true,
    "data": {
        "id": "[email protected]",
        "subject": "Wabot test",
        "creation": 1649779303,
        "owner": "[email protected]",
        "restrict": false,
        "announce": false,
        "participants": [
            {
                "id": "[email protected]",
                "admin": "superadmin"
            },
            {
                "id": "[email protected]",
                "admin": null
            },
            {
                "id": "[email protected]",
                "admin": null
            }
        ]
    }
}

STORE

curl --location --request POST 'localhost:3000/api/whatsapp/store/chats' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken",
    "type": "messages",
    "jid": "[email protected]" // optional for type messages only
}'
// type : "chats" || "contacts" || "messages"

RESPONSE "chats"
[
    {
        "id": "[email protected]",
        "conversationTimestamp": 1654788131,
        "unreadCount": 11
    },
    {
        "id": "[email protected]",
        "conversationTimestamp": 1654787697,
        "unreadCount": 2
    },
    ...
}

RESPONSE "contacts"
{
    "[email protected]": {
        "id": "[email protected]",
        "name": "The name of group"
    },
    "[email protected]": {
        "id": "[email protected]",
        "name": "The name of contacts"
    },
    ...
}

RESPONSE "messages"
{
    "status@broadcast": [...{key, message, messageTimestamp, pushName}],
    "[email protected]": [...{key, message, messageTimestamp, pushName}]
}

RESPONSE "messages" WITH "jid"
[
    {
        "key": {
            "remoteJid": "[email protected]",
            "fromMe": true,
            "id": "BAE5D730190A2628"
        },
        "message": {
            "reactionMessage": {
                "key": {
                    "remoteJid": "[email protected]",
                    "fromMe": true,
                    "id": "BAE56E515A609CD5"
                },
                "text": "🦖"
            }
        },
        "messageTimestamp": "1654784998",
        "status": "PENDING"
    },
    {
        "key": {
            "remoteJid": "[email protected]",
            "fromMe": true,
            "id": "BAE5DA01C6BAC242"
        },
        "message": {
            "reactionMessage": {
                "text": "[object Object]"
            }
        },
        "messageTimestamp": "1654786716",
        "status": "PENDING"
    }
]

IMPLEMENTING A DATA STORE

As 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.

The store also provides some simple functions such as loadMessages that utilize the store to speed up data retrieval.

Note: 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.

GET SCHEDULER

curl --location --request POST 'localhost:3000/api/whatsapp/scheduler' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "token": "sometoken"
}'

RESPONSE
{
    "status": true,
    "data": [
        {
            "type": "sendText",
            "data": {
                "number": "[email protected]",
                "text": "scheduler text"
            },
            "time": "58 11 * * *"
        },
        {
            "type": "sendText",
            "data": {
                "number": "[email protected]",
                "text": "scheduler text"
            },
            "time": "58 11 * * *"
        }
    ]
}

ADD SCHEDULER

curl --location --request POST 'localhost:3000/api/whatsapp/scheduler/add-scheduler' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "id": 1, // uniq id. Will be saved into scheduler.js. When system restarted this data will auto executed by node-cron
    "token": "test",
    "type": "sendText",
    "data": {
        "number": "[email protected]",
        "text": "Pesan otomatis"
    },
    "time": "05 12 * * *"
}'

type : ['on update']
data: ['on update']

RESPONSE
{
    "status": true,
    "data": [...data-cron]
}

STOP SCHEDULER

curl --location --request POST 'localhost:3000/api/whatsapp/scheduler/stop-scheduler' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic TmRhbHUtc2VydmVyLXVVZGtmZ2xpNzgzcGtmbmxhc2tvZ29pZ2hyOg==' \
--data-raw '{
    "id": 1, // this id will stopped and deleted from scheduler.js. When system restarted node-cron not run it again
    "token": "test",
}'

RESPONSE
{
    "status": true || false,
    "message": [Message status success or failed]
}

SUPPORT

Please Fork

Star

Share

Donation

Ask me on telegram (if not busy)

Still updating every have a break time from my activity

Comments
  • ForceClose On Windows

    ForceClose On Windows

    sepertinya berjalan dengan baik. namun secara iseng saya menemukan beberapa bug pada proses initiate jika saya jalankan di Windows node server tiba-tiba force close harus perintah start lagi. sepertinya ada di bagian delete token

    opened by najiha 6
  • Automatically Closed Session after few hours or Request time out

    Automatically Closed Session after few hours or Request time out

    Automatically Close and Session Time Out Get Logged out even There's no WhatsApp error Give me your number I will share my modified code for Template buttons

    WhatsApp me @ +91 60029 27107

    opened by zymaxaservices 1
  • Message audio send but in whatsapp dont play

    Message audio send but in whatsapp dont play

    The audio messages sent are not play in wpp, I couldn't find a way to fix it due to me being terrible at TS,

    but it appears that it was sent, with time it will reproduce.., I even tested it with ogg, oga, mp3

    opened by aspiretony 1
  • Error SCAN QR

    Error SCAN QR

    Halo mas , di update yg sekarang saat melakukan SCAN QR terjadi error.

    `INFO [2022-08-03 13:48:18.493 +0700]: pairing configured successfully, expect to restart the connection... me: { "id": "628988129401:[email protected]" } platform: "android" ERROR [2022-08-03 13:48:18.768 +0700]: stream errored out node: { "tag": "stream:error", "attrs": { "code": "515" } } INFO [2022-08-03 13:48:18.768 +0700]: connection errored trace: "Error: Stream Errored (restart required)\n at WebSocket. (/Users/ardesign/Downloads/baileys-api-main/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:414:13)\n at WebSocket.emit (node:events:394:28)\n at /Users/ardesign/Downloads/baileys-api-main/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:220:35\n at Object.decodeFrame (/Users/ardesign/Downloads/baileys-api-main/node_modules/@adiwajshing/baileys/lib/Utils/noise-handler.js:131:17)\n at WebSocket.onMessageRecieved (/Users/ardesign/Downloads/baileys-api-main/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:196:15)\n at WebSocket.emit (node:events:394:28)\n at Receiver.receiverOnMessage (/Users/ardesign/Downloads/baileys-api-main/node_modules/ws/lib/websocket.js:1178:20)\n at Receiver.emit (node:events:394:28)\n at Receiver.dataMessage (/Users/ardesign/Downloads/baileys-api-main/node_modules/ws/lib/receiver.js:513:14)\n at Receiver.getData (/Users/ardesign/Downloads/baileys-api-main/node_modules/ws/lib/receiver.js:446:17)"

    QRCODE v094p8hgtr1l IS READY Interval check connection`

    opened by CodingDisini 1
  • the server is closing, because the router dowload-media is broken the server

    the server is closing, because the router dowload-media is broken the server

    /api/whatsapp/download-media broken server the error:

    Error: item-not-found at assertNodeErrorFree (/www/wwwroot/zapi/src/baileys/lib/WABinary/generic-utils.js:56:15) at query (/www/wwwroot/zapi/src/baileys/lib/Socket/socket.js:128:48) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.profilePictureUrl (/www/wwwroot/zapi/src/baileys/lib/Socket/chats.js:370:24) at async getPpUrl (/www/wwwroot/zapi/src/router/model/whatsapp.js:632:15) at async /www/wwwroot/zapi/src/router/model/whatsapp.js:181:25 { data: 404, isBoom: true, isServer: true, output: { statusCode: 500, payload: { statusCode: 500, error: 'Internal Server Error', message: 'An internal server error occurred' }, headers: {} } }

    tested with json "token .... message.... and without json, and random json

    all request broken server.

    How could I send everything via base64? (imageMessage, audio....)

    opened by aspiretony 3
  • Fix Yarn Install, yarn win-dev start and added option to enable or disable sending via base64

    Fix Yarn Install, yarn win-dev start and added option to enable or disable sending via base64

    Fix Yarn Install on Windows/Linux e yarn win-dev/start on Windows and Fix Auth, auth working now

    added option to enable or disable sending via base64 just editing the .env file base64 information is only generated if enabled the same

    opened by aspiretony 0
  • Problem in Yarn install And start on Windows and AUTH Basic...

    Problem in Yarn install And start on Windows and AUTH Basic...

    I Have updated your repo but on Windows, Yarn dont working

    Error: Cannot find module 'C:\baileys-api\.yarn\releases\yarn-sources.cjs' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] and dont start..

    In Linux Working with NPM INSTALL, but the "AUTH" Dont Working Unauthorized i used default values for tests

    Solution for install windows/linux: i deleted the files ".yarnrc.yml","yarn.lock" and folder .git, Working fine now include AUTH.. LoL

    opened by aspiretony 0
Bot WhatsApp multi device / multi perangkat menggunakan lib / api baileys-md. Give star ⭐

Requirements • Installation • Thanks to • Official Group Bot • Donate Information Chika-Md adalah bot yang awalnya memakai base dari Hisoka-Morou. Chi

Riy 57 Dec 25, 2022
Whatsapp Bot with multi-device support Your Personal Assistance on Whatsapp

BotsApp-MD Whatsapp Bot with multi-device support Your Personal Assisstant, on WhatsApp! Deployment Easiest Way Head over to botsapp-md to deploy. Tak

Peter Dorglo 14 Jan 1, 2023
A Fully Oriented Whatsapp Bot Based on Chitoge Don't forget to give a star to the repo before fork

NEZUKO : ANIME THEMED WHATSAPP BOT WITH RICH FEATURES A Fully Modular and Efficient Bot Button : If you are deploying normally Button : If you are dep

Toshiro 5 Dec 3, 2022
WhatsApp Bot With Baileys, Dont forget star & fork

Rhapsody-Bot > pkg update && pkg upgrade > pkg install nodejs yarn ffmpeg imagemagick libwebp sox > git clone https://github.com/DEFF-Y/Rhapsody-Bot

Daffa Yudhistira 6 Nov 15, 2022
Simple WhatsApp Bot Script using WhatsApp Web Multi-Device API

Shiina Mashiro MD Shiina Multi Device Using NodeJS Framework & Baileys WhatsApp Web API Information WhatsApp Bot using WhatsApp Web API. If you find a

Hafidz Al-Ghifari 3 Feb 4, 2022
Özel olarak kodladığım pm2 ve v13 kullanılarak yapılmış botlarımı açık kaynak olarak paylaşıyorum. Bildiğiniz üzere v12 botlar 30 Nisan 2022 tarihinden sonra kullanılamayacak. Bu bot için +100 Star ve 20 fork istiyorum :)

Bot içerisinde hangi sistemler mevcut? • Kayıt sistemi. • Koruma sistemi. • Backup ve rol dağıtım sistemi. • Cezalandırma sistemi. • Sesli hoş geldin

Midwêst 26 Jul 26, 2022
Vio-MD is multi-device whatsapp bot using library @adiwajshing/baileys and example bot of Violetics API

Vio Multi Device WhatsApp Bot Use at your own risk! Build with Baileys and JavaScript's native Map class ( as a command handler ), using https://viole

Violetics 4 May 31, 2022
A simple and easy-to-use WhatsApp bot project based on Multi-Device Baileys and written in JavaScript

MIZUHARA ANIME THEMED FULL FLEDGED MULTI DEVICE WHATSAPP BOT WITH COOL FEATURES A Full Fledged MD Bot For Bot Lovers REQUIREMENTS • HOW TO INSTALL? •

Arus~Bots 18 Oct 25, 2022
Whatsapp bot using Bailey multi device module, using nodejs and open source, I accept ideas from public

Allen Bot-Wa Keep copyright, Created by lolhuman | Please read carefully Content Description Example Highlights TODO Installation FAQ Contributing Con

Pais 35 Dec 3, 2022
Multi Device WhatsApp bot built with Baileys with Script and Template provided for devs.

Miku Nakano (Beta) Konochiwa Senpai, I am "Miku Nakano" a WhatsApp bot made by Fantox to do everything that is possible on WhatsApp based on WhatsApp

Fantox 106 Jan 2, 2023
nganu bot, multi device based simple whatsapp-bot with social media downloader

nganu A Simple Multi-Device WhatsApp Bot simple whatsapp-bot using baileys-md to download social media post and many features Install set instagram se

Muhamad Ristiyanto 28 Nov 20, 2022
Bot Whatsapp Multi-Device Using Javascript

Rzky Multi Device Gunakan dengan risiko Anda sendiri! Dibuat dengan Baileys dan Map() ( sebagai command handler ) Options Options pada command, yang a

null 85 Dec 20, 2022
WhatsApp Bot Multi Device "Roother md"

Roother-md Script WhatsApp Bot Multi Device NOTE This Script is for everyone, not for Sale. Jika dijual neraka menunggumu brother ! Roother-md This is

Shouko Sagiri 5 Aug 10, 2022
Hisoka-waweb.js: Script WhatsaApp Bot Multi Device Using Lib whatsapp-web.js

Rules read the rules at term-of-service hisoka-waweb.js Script Bot WhatsApp Multi Device dengan menggunakan Library whatsapp-web.js Config Isi semua y

Hisoka 13 Dec 24, 2022
Free Whatsapp-Bot multi-device

Information This script is open to anyone! Buying and selling scripts is prohibited! Note Problem born by the user Change The Information Here Donate

Ichizza Maulitha Putri 11 Nov 15, 2022
Dylux-fg WhatsApp Bot Multi Device

Dylux-fg WhatsApp Bot Multi Device

FG98 16 Jan 6, 2023
Base Bot WhatsApp With Baileys Multi Device, Working Heroku No Suspend ☑️, Working Okteto No Suspend ☑️

Base Bot WhatsApp Multi Device With Baileys Multi Device Note Base Ini Free Untuk Semua, Tidak Untuk Diperjualbelikan Kecuali Lu Udah Tambahin Fitur L

Nazril Afandi 36 Dec 25, 2022
World best multi device whatsapp bot🖤

BLACK-PANTHER-MD-V2 World best multi device whatsapp bot ?? WhatsApp MD user bot Setup Click SCAN) and scan QR through Whatsapp Linked Devices Option

null 20 Dec 27, 2022
Hisl Unlimited whatsapp bot (Multi-device)

@The Hackers In Sri Lanka Offcial Scan Qr Code Deploy Now ♨️ ??‍?? Developers & Contributors ??‍?? Developers Hacker Pancha Mr.White Shadow MR.SDK Whi

White Shadow Ofc 19 Nov 8, 2022