• Stars
    star
    376
  • Rank 113,810 (Top 3 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web

WPPConnect/WA-JS

npm version Downloads Average time to resolve an issue Percentage of issues still open

Build Status Build Status Lint Status release-it

WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination...

Our online channels

Discord Telegram Group WhatsApp Group YouTube

How does it work

This project extract some functions of WhatsApp sources, that uses webpack.

After build, this project generate a file dist/wppconnect-wa.js to be used for injection in WhatsApp Web. When injected, it will explose a global variable named WPP.

Some parts of WPP variable:

  • WPP.webpack - Scripts to exports WhatsApp functions.
  • WPP.whatsapp - Only exported WhatsApp functions.
  • WPP.chat - Chat functions and events.
  • ...

Exported WhatsApp modules

There are a convection name for some exported modules:

  • ...Model - Class for data structure (ClassModel, MsgModel)
  • ...Collection - Class for collection of models (ChatCollection, MsgCollection)
  • ...Store - Default and global instance of a collection (ChatStore, MsgStore)

Development

Steps to run locally:

# install the depencencies
npm install

# download whatsapp javascript and prettify (optional)
npm run wa-source

# build javascript files
npm run build:prd # or build:dev for development

# lauch a local browser with automatic injection
npm run launch:local

# or only run in VSCode

How to use this project

Basicaly, you need to inject the wppconnect-wa.js file into the browser after WhatsApp page load.

TamperMonkey or GreaseMonkey

// ==UserScript==
// @name         WA-JS Teste
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Simple example of WA-JS
// @author       You
// @match        https://web.whatsapp.com/*
// @icon         https://www.google.com/s2/favicons?domain=whatsapp.com
// @require      https://github.com/wppconnect-team/wa-js/releases/download/nightly/wppconnect-wa.js
// @grant        none
// ==/UserScript==

/* globals WPP */

(function () {
  'use strict';

  WPP.webpack.onReady(function () {
    alert('Ready to use WPPConnect WA-JS');
  });

  // Your code here...
})();

Playwright

import * as playwright from 'playwright-chromium';

async function start() {
  const browser = await playwright.chromium.launch();
  const page = browser.newPage();

  await page.goto('https://web.whatsapp.com/');

  await page.addScriptTag({
    path: require.resolve('@wppconnect/wa-js'),
  });

  // Wait WA-JS load
  await page.waitForFunction(() => window.WPP?.isReady);

  // Evaluating code: See https://playwright.dev/docs/evaluating/
  const isAuthenticated: string = await page.evaluate(() =>
    WPP.auth.isAuthenticated()
  );

  // Sending message: See https://playwright.dev/docs/evaluating/
  const sendResult: string = await page.evaluate(
    (to, message) => WPP.chat.sendTextMessage(to, message),
    to,
    message
  );
}

start();

License

Copyright 2021 WPPConnect Team

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

wppconnect

WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
TypeScript
1,857
star
2

wppconnect-server

Wppconnect Server is a ready-to-use API, just download, install, and start using, simple as that.
TypeScript
660
star
3

wppconnect-frontend

WPPConnect FrontEnd has been designed to demonstrate how multi-session works dynamically.
JavaScript
234
star
4

WPP4Delphi

WPP4Delphi is an open-source project with the aim of exporting functions from WhatsApp Web for Delphi, which can be used to support the creation of any interaction.
Pascal
204
star
5

wpp-docker

Crie facilmente imagens do Docker com diferentes versões/combinações de linguagens e dependências comuns, para uso no WPPConnect.
TypeScript
131
star
6

wa-version

HTML
124
star
7

wppconnect-php-client

Um simples cliente PHP que proporciona acesso fácil aos endpoints do WPPConnect Server.
PHP
47
star
8

whaticket

This is a fork of https://github.com/canove/whaticket: A very simple Ticket System based on WhatsApp messages, that allow multi-users in same WhatsApp account.
JavaScript
45
star
9

wppconnect-laravel-client

Uma API simples com empacotador Guzzle, fornecendo acesso fácil aos endpoints do WPPConnect Server.
PHP
37
star
10

server-cli

JavaScript
33
star
11

wppconnect-team.github.io

Simple page
JavaScript
27
star
12

wppconnect-loader

WPPConnectLoader is an open source project developed by the JavaScript community with the aim of exporting functions from Webpack modules
TypeScript
25
star
13

wppconnect-frontend-vue

Vue
24
star
14

mobile

WPPConnect/mobile is an open source project with the objective of automating whatsapp web using the android or ios mobile browser and being able to perform all the functions of our wa-js project, so it is possible to create a customer service, media sending, intelligence recognition based on artificial phrases and many other things, use your imagination to change and modify this project or collaborate on improvements...
TypeScript
22
star
15

wa-js-api-server

WPPConnect/WA-JS API SERVER is a small api server to provide url preview for @wppconnect/wa-js library
TypeScript
19
star
16

WPP4DotNet

C#
13
star
17

wppconnect-delphi-client

Pascal
11
star
18

wppconnect-csharp

C#
10
star
19

wppconnect-laravel-notification-channel

4
star
20

wa-proto

Protobuf files from WhatsApp WEB
JavaScript
4
star
21

wppconnect-manager

CSS
2
star