From c6930e83ecb6b82e210dd18859f2a5687df86117 Mon Sep 17 00:00:00 2001 From: Adhiraj Date: Tue, 31 Mar 2020 20:08:31 +0530 Subject: [PATCH] readme update --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7b0e121..4e16e3e 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,19 @@ Thank you to [Sigalor](https://github.com/sigalor/whatsapp-web-reveng) for writing the guide reverse engineering WhatsApp Web and to the go reimplementation written by [Rhymen](https://github.com/Rhymen/go-whatsapp/tree/484cfe758705761d76724e01839d6fc473dc10c4) Baileys is super easy to use: -0. Install from npm using +1. Install from npm using ``` npm install github:adiwajshing/Baileys ``` -1. Then import using +2. Then import using ``` javascript const WhatsAppWeb = require('Baileys') ``` -2. Create an instance of Baileys & connect using +3. Create an instance of Baileys & connect using ``` javascript let client = new WhatsAppWeb() client.connect() ``` If the connection is successful, you will see a QR code printed on your terminal screen, scan it with WhatsApp on your phone and you'll be logged in! -3. Implement the following event handlers in your code: +4. Implement the following event handlers in your code: ``` javascript client.handlers.onConnected = () => { /* when you're successfully authenticated with the WhatsApp Web servers */ } ``` @@ -29,17 +29,17 @@ Baileys is super easy to use: ``` javascript client.handlers.onDisconnect = () => { /* called when internet gets disconnected */ } ``` -4. Send a text message using +5. Send a text message using ``` javascript client.sendTextMessage(id, txtMessage) ``` The id is the phone number of the person the message is being sent to, it must be in the format '[country code][phone number]@s.whatsapp.net', for example '+19999999999@s.whatsapp.net' -5. Send a read reciept using +6. Send a read reciept using ``` javascript client.sendReadReceipt(id, messageID) ``` The id is in the same format as mentioned earlier. The message ID is the unique identifier of the message that you are marking as read -6. Tell someone what your status is right now by using +7. Tell someone what your status is right now by using ``` javascript client.updatePresence(id, presence) ``` @@ -53,12 +53,12 @@ Baileys is super easy to use: paused: "paused" // I have no clue } ``` -7. Once you want to close your session, you can get your authentication credentials using: +8. Once you want to close your session, you can get your authentication credentials using: ``` javascript const authJSON = client.base64EncodedAuthInfo() ``` and then save this JSON to a file -8. If you want to restore your session (i.e. log back in without having to scan the QR code), simply retreive your previously saved credentials and use +9. If you want to restore your session (i.e. log back in without having to scan the QR code), simply retreive your previously saved credentials and use ``` javascript const authJSON = JSON.parse( fs.readFileSync("auth_info.json") ) client.login( authJSON )