• Stars
    star
    660
  • Rank 68,297 (Top 2 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated about 1 month ago

Reviews

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

Repository Details

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

WPPConnect Team

WPPConnect Server

npm version Downloads Average time to resolve an issue Percentage of issues still open Build Status Build release-it

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

  • Javascript ES6
  • NodeJS
  • Restfull

Our online channels

Discord Telegram Group WhatsApp Group YouTube

Documentations

Access our documentation on postman

Access our documentation on Swagger

Or Swagger UI in your server. Acess router: "IP:PORT/api-docs"

Features

Multiple Sessions ✔
Send text, image, video and docs ✔
Get contacts list ✔
Receive messages ✔
Open/Close Session ✔
Change Profile/Username ✔
Create Group ✔
Join Group by Invite Code ✔
Webhook ✔

Libraries Used

  • WPPConnect
  • Axios
  • Bcrypt
  • Cors
  • Dotenv
  • Express
  • Nodemon
  • SocketIO

Installation

Install the dependencies and start the server.

yarn install
//or
npm install

Install puppeteer dependencies:

sudo apt-get install -y libxshmfence-dev libgbm-dev wget unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils

Install google chrome

wget -c https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

sudo apt-get update

sudo apt-get install libappindicator1

sudo dpkg -i google-chrome-stable_current_amd64.deb

Run Server

yarn dev

Build Server

yarn build

Configuration

This server use config.ts file to define some options, default values are:

{
  /* secret key to genereta access token */
  secretKey: 'THISISMYSECURETOKEN',
  host: 'http://localhost',
  port: '21465',
  // Device name for show on whatsapp device
  deviceName: 'WppConnect',
  poweredBy: 'WPPConnect-Server',
  // starts all sessions when starting the server.
  startAllSession: true,
  tokenStoreType: 'file',
  // sets the maximum global listeners. 0 = infinity.
  maxListeners: 15,
  // create userDataDir for each puppeteer instance for working with Multi Device
  customUserDataDir: './userDataDir/',
  webhook: {
    // set default webhook
    url: null,
    // automatically downloads files to upload to the webhook
    autoDownload: true,
    // enable upload to s3
    uploadS3: false,
    // set default bucket name on aws s3
    awsBucketName: null,
    //marks messages as read when the webhook returns ok
    readMessage: true,
    //sends all unread messages to the webhook when the server starts
    allUnreadOnStart: false,
    // send all events of message status (read, sended, etc)
    listenAcks: true,
    // send all events of contacts online or offline for webook and socket
    onPresenceChanged: true,
    // send all events of groups participants changed for webook and socket
    onParticipantsChanged: true,
    // send all events of reacted messages for webook and socket
    onReactionMessage: true,
    // send all events of poll messages for webook and socket
    onPollResponse: true,
    // send all events of revoked messages for webook and socket
    onRevokedMessage: true,
    // send all events of labels for webook and socket
    onLabelUpdated: true,
  },
  // send data to chatwoot
  chatwoot: {
    sendQrCode: true,
    sendStatus: true,
  },
  //functionality that archives conversations, runs when the server starts
  archive: {
    enable: false,
    //maximum interval between filings.
    waitTime: 10,
    daysToArchive: 45,
  },
  log: {
    level: 'silly', // Before open a issue, change level to silly and retry a action
    logger: ['console', 'file'],
  },
  // create options for using on wppconnect-lib
  createOptions: {
    browserArgs: [
      '--disable-web-security',
      '--no-sandbox',
      '--disable-web-security',
      '--aggressive-cache-discard',
      '--disable-cache',
      '--disable-application-cache',
      '--disable-offline-load-stale-cache',
      '--disk-cache-size=0',
      '--disable-background-networking',
      '--disable-default-apps',
      '--disable-extensions',
      '--disable-sync',
      '--disable-translate',
      '--hide-scrollbars',
      '--metrics-recording-only',
      '--mute-audio',
      '--no-first-run',
      '--safebrowsing-disable-auto-update',
      '--ignore-certificate-errors',
      '--ignore-ssl-errors',
      '--ignore-certificate-errors-spki-list',
      '--disable-features=LeakyPeeker' // Disable the browser's sleep mode when idle, preventing the browser from going into sleep mode, this is useful for WhatsApp not to be in economy mode in the background, avoiding possible crashes
    ],
  },
  mapper: {
    enable: false,
    prefix: 'tagone-',
  },
  // Configurations for connect with database
  db: {
    mongodbDatabase: 'tokens',
    mongodbCollection: '',
    mongodbUser: '',
    mongodbPassword: '',
    mongodbHost: '',
    mongoIsRemote: true,
    mongoURLRemote: '',
    mongodbPort: 27017,
    redisHost: 'localhost',
    redisPort: 6379,
    redisPassword: '',
    redisDb: 0,
    redisPrefix: 'docker',
  },
}

Secret Key

Your secretKey is inside the config.ts file. You must change the default value to one that only you know.

Generate Token

To generate an access token, you must use your SECRET_KEY.

Using the route:

  curl -X POST --location "http://localhost:21465/api/mySession/eUsouSeCreTo/generate-token"

Response:

{
  "status": "Success",
  "session": "mySession",
  "token": "$2b$10$duQ5YYV6fojn5qFiFv.aEuY32_SnHgcmxdfxohnjG4EHJ5_Z6QWhe",
  "full": "wppconnect:$2b$10$duQ5YYV6fojn5qFiFv.aEuY32_SnHgcmxdfxohnjG4EHJ5_Z6QWhe"
}

Using Token

Save the value of the "full" response. Then use this value to call the routes.

Examples

#Starting Session
# /api/:session/start-session

curl -X POST --location "http://localhost:21465/api/mySession/start-session" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer \$2b\$10\$JcHd97xHN6ErBuiLd7Yu4.r6McvOvEZZDQTQwev2MRK_zQObUZZ9C"
#Get QrCode
# /api/:session/start-session
# when the session is starting if the method is called again it will return the base64 qrCode

curl -X POST --location "http://localhost:21465/api/mySession/start-session" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer \$2b\$10\$JcHd97xHN6ErBuiLd7Yu4.r6McvOvEZZDQTQwev2MRK_zQObUZZ9C"
#Send Message
# /api/:session/send-message
curl -X POST --location "http://localhost:21465/api/mySession/send-message" \
    -H "Content-Type: application/json; charset=utf-8" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer \$2b\$10\$8aQFQxnWREtBEMZK_iHMe.u7NeoNkjL7s6NYai_83Pb31Ycss6Igm" \
    -d "{
          \"phone\": \"5511982743910\",
          \"message\": \"*Abner* Rodrigues\"
        }"

See the routes file for all the routes. here and HTTP file.

Swagger UI

Swagger ui can be found at /api-docs

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

wa-js

WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web
TypeScript
376
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