Giter Site home page Giter Site logo

dikaardnt / wajs Goto Github PK

View Code? Open in Web Editor NEW
15.0 1.0 5.0 625 KB

an open source to connect WhatsApp Web via playwright

Home Page: https://wajs.dikaardnt.com/

License: Apache License 2.0

JavaScript 99.19% Shell 0.81%
playwright playwright-javascript whatsapp-bot whatsapp-web whatsapp-webdriver

wajs's Introduction

Special Big Thanks To


Pedro S. Lopez

Author of whatsapp-web.js

Edgard Lorraine Messias

Author of wa-js

Info

This repo is the result of a recode from the pedroslopez/whatsapp-web.js repo and additions from wppconnect-team/wa-js

wajs

A WhatsApp API client that connects through the WhatsApp Web browser app

It uses Playwright to run a real instance of Whatsapp Web to avoid getting blocked.

NOTE: I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.

Quick Links

Installation

The module is now available on npm! npm i github:DikaArdnt/wajs

Please note that Node v12+ is required.

Example usage

const { Client } = require('@dikaardnt/wajs');

const client = new Client();

client.on('qr', (qr) => {
    // Generate and scan this code with your phone
    console.log('QR RECEIVED', qr);
});

client.on('ready', () => {
    console.log('Client is ready!');
});

client.on('message', msg => {
    if (msg.body == '!ping') {
        msg.reply('pong');
    }
});

client.initialize();

Take a look at example.js for another example with more use cases.

Supported features

Feature Status
Multi Device
Send messages
Receive messages
Send media (images/audio/documents)
Send media (video)
Send stickers
Receive media (images/audio/video/documents)
Send contact cards
Send location
Send status
Receive location
Message replies
Join groups by invite
Get invite for group
Modify group info (subject, description)
Modify group settings (send messages, edit info)
Add group participants
Kick group participants
Promote/demote group participants
Mention users
Mute/unmute chats
Block/unblock contacts
Get contact info
Get profile pictures
Set user status message
React to messages

Something missing? Make an issue and let us know!

Contributing

Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.

Supporting the project

You can support the maintainer of this project through the links below

Disclaimer

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

wajs's People

Contributors

dikaardnt avatar sambatpeople avatar

Stargazers

Victor Duarte avatar Excel Amadi avatar Bio-Reyxx09 avatar RiyanRis avatar Danilo Lopes avatar  avatar  avatar Wayne Murunga avatar mlutfi avatar RxDiag avatar Hideki_JS avatar  avatar  avatar Nicko avatar NeKosmic avatar

Watchers

 avatar

wajs's Issues

Chat Message by Name

Hi there, is there also the option to send a message to someone based on his name in the chats overview?

2 Error - Tidak Dapat Membuka Chat Window & Tidak Dapat Screenshot Page

Halo, ada beberapa error disini yaitu error tidak bisa menggunakan function conn.interface.openChatWindow
IMG_20240107_162635

Dan function conn.playPage.screenshot
IMG_20240107_162416

Connection Options yang saya gunakan:

const conn = new Client({
        playwright: {
            headless: true,
            args: ['--no-sandbox', '--disable-setuid-sandbox']
        }, 
        takeoverOnConflict: false, 
        takeoverTimeoutMs: 0,
        syncAllStatus: false,
        sessionName: 'session',
        qrMaxRetries: 3
    })

Apakah ada solusi?

Pair With Code - Kode Tidak Muncul

Saya mencoba pair pakai code tetapi code-nya tidak muncul? Apakah ada solusi?

Kode saya:

................
.......................................
const conn = new Client({
        playwright: {
            headless: true,
            args: ['--no-sandbox', '--disable-setuid-sandbox']
        }, 
        takeoverOnConflict: false, // If another whatsapp web session is detected (another browser), take over the session in the current browser
        takeoverTimeoutMs: 0,
        pairingNumber: "6283816xxxxxx",
        syncAllStatus: false,
        sessionName: 'session'
    })
    
    if (conn) { 
    	spins.add('spinner-1', { text: "Initializing browser..." })
        await sleep(10000) 
        spins.succeed('spinner-1', { text: `Using browser folder: '${__dirname}/session/session` })
        spins.add('spinner-2', { text: "Checking Authentication..." })
    }
    
    conn.initialize().catch((_) => console.log(_))
        conn.on("code", code => {
        	console.log(code)
            spins.update('spinner-2', { text: "Please insert this code.    " + code })
        })
 
...............................
....................

issue_pairing_code_wajs

page.evaluate: TypeError: r.findImpl is not a function

The error appears when there is no message at all

page.evaluate: TypeError: r.findImpl is not a function
at https://web.whatsapp.com/app.f0f8e0fdf62f2945906f.js:268:148519
at Generator.next ()
at t (https://web.whatsapp.com/vendor1~app.264a01b6133c4a120327.js:2:66487)
at s (https://web.whatsapp.com/vendor1~app.264a01b6133c4a120327.js:2:66698)
at https://web.whatsapp.com/vendor1~app.264a01b6133c4a120327.js:2:66757
at new Promise ()
at https://web.whatsapp.com/vendor1~app.264a01b6133c4a120327.js:2:66638
at g._serverQuery (https://web.whatsapp.com/app.f0f8e0fdf62f2945906f.js:268:148847)
at g._query (https://web.whatsapp.com/app.f0f8e0fdf62f2945906f.js:268:148130)
at g.find (https://web.whatsapp.com/app.f0f8e0fdf62f2945906f.js:268:146614)
at Client.sendMessage (C:\laragon\www\WAJS\node_modules\wajs\src\Client.js:582:48)
at C:\laragon\www\WAJS\app.js:265:39
at Layer.handle (C:\laragon\www\WAJS\node_modules\express\lib\router\layer.js:95:5)
at next (C:\laragon\www\WAJS\node_modules\express\lib\router\route.js:149:13)
at Route.dispatch (C:\laragon\www\WAJS\node_modules\express\lib\router\route.js:119:3)
at Layer.handle (C:\laragon\www\WAJS\node_modules\express\lib\router\layer.js:95:5)
at C:\laragon\www\WAJS\node_modules\express\lib\router\index.js:284:15
at Function.process_params (C:\laragon\www\WAJS\node_modules\express\lib\router\index.js:346:12)
at next (C:\laragon\www\WAJS\node_modules\express\lib\router\index.js:280:10)
at urlencodedParser (C:\laragon\www\WAJS\node_modules\body-parser\lib\types\urlencoded.js:82:7)
at Layer.handle (C:\laragon\www\WAJS\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (C:\laragon\www\WAJS\node_modules\express\lib\router\index.js:328:13)
at C:\laragon\www\WAJS\node_modules\express\lib\router\index.js:286:9
at Function.process_params (C:\laragon\www\WAJS\node_modules\express\lib\router\index.js:346:12)
at next (C:\laragon\www\WAJS\node_modules\express\lib\router\index.js:280:10)
at C:\laragon\www\WAJS\node_modules\body-parser\lib\read.js:137:5
at invokeCallback (C:\laragon\www\WAJS\node_modules\raw-body\index.js:238:16)
at done (C:\laragon\www\WAJS\node_modules\raw-body\index.js:227:7)
at IncomingMessage.onEnd (C:\laragon\www\WAJS\node_modules\raw-body\index.js:287:7)

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.