├── .babelrc ├── .commitlintrc.json ├── .dockerignore ├── .eslintrc.json ├── .github ├── FUNDING.yml ├── renovate.json └── workflows │ ├── build.yml │ ├── docker.yml │ ├── publish.yml │ ├── release.yml │ └── update-lock.yml ├── .gitignore ├── .husky ├── .gitignore ├── commit-msg └── pre-commit ├── .npmignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .release-it.yml ├── CHANGELOG.md ├── Dockerfile ├── LICENSE ├── LICENSE.header ├── README.md ├── bin └── wppserver.js ├── license-checker-config.json ├── nodemon.json ├── package.json ├── src ├── index.js └── program.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | [ 4 | "@babel/plugin-transform-runtime", 5 | { 6 | "regenerator": true 7 | } 8 | ] 9 | ], 10 | "presets": [ 11 | [ 12 | "@babel/preset-env", 13 | { 14 | "targets": { 15 | "node": "current" 16 | } 17 | } 18 | ] 19 | ], 20 | "env": { 21 | "development": { 22 | "sourceMaps": "inline", 23 | "retainLines": true 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/commitlintrc.json", 3 | "extends": ["@commitlint/config-conventional"], 4 | "rules": { 5 | "body-max-line-length": [0, "always", 100], 6 | "header-max-length": [2, "always", 120], 7 | "subject-case": [1, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .github 3 | .hust 4 | *.tgz 5 | dist 6 | log 7 | node_modules 8 | npm-debug.log 9 | tokens 10 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "env": { 4 | "es6": true, 5 | "node": true 6 | }, 7 | "parser": "@babel/eslint-parser", 8 | "plugins": ["@babel"], 9 | "extends": ["eslint:recommended", "plugin:prettier/recommended"], 10 | "rules": { 11 | "no-empty": ["error", { "allowEmptyCatch": true }], 12 | "no-unused-vars": "warn" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | open_collective: wppconnect 2 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base", 5 | ":prHourlyLimitNone", 6 | ":prNotPending", 7 | ":semanticCommits" 8 | ], 9 | "prConcurrentLimit": 3, 10 | "lockFileMaintenance": { 11 | "enabled": true, 12 | "automerge": true 13 | }, 14 | "packageRules": [ 15 | { 16 | "description": "Use bump strategy", 17 | "matchPackagePatterns": ["*"], 18 | "rangeStrategy": "bump", 19 | "semanticCommitType": "build", 20 | "labels": ["dependencies"] 21 | }, 22 | { 23 | "matchManagers": ["github-actions"], 24 | "semanticCommitType": "ci", 25 | "addLabels": ["github_actions"] 26 | }, 27 | { 28 | "matchManagers": ["npm"], 29 | "addLabels": ["javascript"] 30 | }, 31 | { 32 | "matchDepTypes": ["devDependencies"], 33 | "semanticCommitScope": "deps-dev" 34 | }, 35 | { 36 | "description": "Show in changelog package updates", 37 | "matchPackagePatterns": ["^@wppconnect/", "^@wppconnect-team/"], 38 | "semanticCommitType": "fix" 39 | }, 40 | { 41 | "description": "Automatically merge minor and patch-level updates", 42 | "matchUpdateTypes": ["minor", "patch", "pin", "digest"], 43 | "automerge": true, 44 | "automergeStrategy": "squash", 45 | "automergeType": "pr" 46 | }, 47 | { 48 | "description": "Ignore major version", 49 | "matchPackageNames": ["node"], 50 | "allowedVersions": "<17" 51 | } 52 | ] 53 | } 54 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | pull_request: 8 | branches: 9 | - '*' 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | 18 | - name: Setup Node 19 | uses: actions/setup-node@v4 20 | with: 21 | node-version: 18.20.8 22 | 23 | - name: Get yarn cache directory 24 | id: yarn-cache 25 | run: | 26 | echo "::set-output name=dir::$(yarn cache dir)" 27 | 28 | - name: Setup yarn cache 29 | uses: actions/cache@v4 30 | with: 31 | path: ${{ steps.yarn-cache.outputs.dir }} 32 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 33 | restore-keys: | 34 | ${{ runner.os }}-yarn- 35 | 36 | - name: Install Dependencies 37 | run: yarn install 38 | 39 | - name: Build source 40 | run: yarn build 41 | 42 | lint: 43 | runs-on: ubuntu-latest 44 | steps: 45 | - name: Checkout 46 | uses: actions/checkout@v4 47 | 48 | - name: Setup Node 49 | uses: actions/setup-node@v4 50 | with: 51 | node-version: 18.20.8 52 | 53 | - name: Get yarn cache directory 54 | id: yarn-cache 55 | run: | 56 | echo "::set-output name=dir::$(yarn cache dir)" 57 | 58 | - name: Setup yarn cache 59 | uses: actions/cache@v4 60 | with: 61 | path: ${{ steps.yarn-cache.outputs.dir }} 62 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 63 | restore-keys: | 64 | ${{ runner.os }}-yarn- 65 | 66 | - name: Install Dependencies 67 | run: yarn install 68 | 69 | - name: Lint source 70 | run: yarn lint 71 | -------------------------------------------------------------------------------- /.github/workflows/docker.yml: -------------------------------------------------------------------------------- 1 | name: docker 2 | 3 | on: 4 | schedule: 5 | - cron: '0 10 * * *' # everyday at 10am 6 | push: 7 | branches: 8 | - 'main' 9 | tags: 10 | - 'v*' 11 | 12 | jobs: 13 | docker: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | 19 | - name: Docker meta 20 | id: meta 21 | uses: docker/metadata-action@v5 22 | with: 23 | # list of Docker images to use as base name for tags 24 | images: | 25 | wppconnect/server-cli 26 | # generate Docker tags based on the following events/attributes 27 | tags: | 28 | type=schedule 29 | type=ref,event=branch 30 | type=ref,event=pr 31 | type=semver,pattern={{version}} 32 | type=semver,pattern={{major}}.{{minor}} 33 | type=semver,pattern={{major}} 34 | 35 | - name: Set up QEMU 36 | uses: docker/setup-qemu-action@v3 37 | 38 | - name: Set up Docker Buildx 39 | uses: docker/setup-buildx-action@v3 40 | 41 | - name: Login to DockerHub 42 | if: github.event_name != 'pull_request' 43 | uses: docker/login-action@v3 44 | with: 45 | username: ${{ secrets.DOCKERHUB_USERNAME }} 46 | password: ${{ secrets.DOCKERHUB_TOKEN }} 47 | 48 | - name: Build and push 49 | id: docker_build 50 | uses: docker/build-push-action@v6 51 | with: 52 | push: ${{ github.event_name != 'pull_request' }} 53 | tags: | 54 | ${{ steps.meta.outputs.tags }} 55 | wppconnect/server-cli:latest 56 | labels: ${{ steps.meta.outputs.labels }} 57 | 58 | - name: Image digest 59 | run: echo ${{ steps.docker_build.outputs.digest }} 60 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v4 14 | with: 15 | fetch-depth: 0 16 | 17 | - name: Fetching tags 18 | run: git fetch --tags -f || true 19 | 20 | - name: Setup Node 21 | uses: actions/setup-node@v4 22 | with: 23 | node-version: 18.20.8 24 | registry-url: 'https://registry.npmjs.org' 25 | env: 26 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 27 | 28 | - name: Get yarn cache directory 29 | id: yarn-cache 30 | run: | 31 | echo "::set-output name=dir::$(yarn cache dir)" 32 | 33 | - name: Setup yarn cache 34 | uses: actions/cache@v4 35 | with: 36 | path: ${{ steps.yarn-cache.outputs.dir }} 37 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 38 | restore-keys: | 39 | ${{ runner.os }}-yarn- 40 | 41 | - name: Install Dependencies 42 | run: yarn install 43 | env: 44 | PUPPETEER_SKIP_DOWNLOAD: true 45 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 46 | 47 | - name: Build 48 | run: yarn build 49 | 50 | - name: Publish in NPM 51 | run: yarn publish --access public 52 | env: 53 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 54 | 55 | - name: Generate Changelog 56 | id: generate_changelog 57 | run: | 58 | changelog=$(npm run changelog:last --silent) 59 | changelog="${changelog//$'\n'/'%0A'}" 60 | changelog="${changelog//$'\r'/'%0D'}" 61 | echo -e "set-output name=changelog::${changelog-}\n" 62 | echo -e "::set-output name=changelog::${changelog}\n" 63 | 64 | - name: Create Release 65 | id: create_release 66 | uses: actions/create-release@v1 67 | env: 68 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 69 | with: 70 | tag_name: ${{ github.ref }} 71 | release_name: ${{ github.ref }} 72 | body: ${{ steps.generate_changelog.outputs.changelog }} 73 | draft: false 74 | prerelease: false 75 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | increment: 7 | description: 'Tipo de incremento: patch, minor, major ou pre*' 8 | required: true 9 | default: 'patch' 10 | 11 | jobs: 12 | release: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | with: 18 | token: ${{ secrets.PERSONAL_TOKEN }} 19 | 20 | - name: Setup GIT 21 | run: | 22 | git config --global user.name "github-actions[bot]" 23 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 24 | 25 | - name: Setup Node 26 | uses: actions/setup-node@v4 27 | with: 28 | node-version: 18.20.8 29 | 30 | - name: Get yarn cache directory 31 | id: yarn-cache 32 | run: | 33 | echo "::set-output name=dir::$(yarn cache dir)" 34 | 35 | - name: Setup yarn cache 36 | uses: actions/cache@v4 37 | with: 38 | path: ${{ steps.yarn-cache.outputs.dir }} 39 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 40 | restore-keys: | 41 | ${{ runner.os }}-yarn- 42 | 43 | - name: Install Dependencies 44 | run: yarn install 45 | 46 | - name: Release 47 | run: 'npx release-it --increment ${{ github.event.inputs.increment }}' 48 | -------------------------------------------------------------------------------- /.github/workflows/update-lock.yml: -------------------------------------------------------------------------------- 1 | name: update-lock 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main' 7 | 8 | jobs: 9 | update-lock: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v4 14 | 15 | - name: Setup Node 16 | uses: actions/setup-node@v4 17 | with: 18 | node-version: 18.20.8 19 | 20 | - name: Get yarn cache directory 21 | id: yarn-cache 22 | run: | 23 | echo "::set-output name=dir::$(yarn cache dir)" 24 | 25 | - name: Setup yarn cache 26 | uses: actions/cache@v4 27 | with: 28 | path: ${{ steps.yarn-cache.outputs.dir }} 29 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 30 | restore-keys: | 31 | ${{ runner.os }}-yarn- 32 | 33 | - name: Install Dependencies 34 | run: yarn install 35 | 36 | - uses: stefanzweifel/git-auto-commit-action@v5 37 | with: 38 | commit_message: 'chore: Updated yarn.lock' 39 | file_pattern: yarn.lock 40 | commit_user_name: github-actions[bot] 41 | commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.env 2 | /dist 3 | /node_modules 4 | /swagger-docs 5 | /.vs 6 | /bin 7 | /log 8 | /obj/Debug 9 | /tokens 10 | /uploads 11 | /WhatsAppImages 12 | /wppconnect-server.njsproj 13 | /wppconnect-server.njsproj.user 14 | *.sln 15 | /package-lock.json 16 | *.png 17 | *.tgz -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit $1 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install pretty-quick --staged 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.tgz 3 | *.zip 4 | /*.png 5 | /log 6 | /src 7 | /tokens 8 | /WhatsAppImages 9 | license-checker-config.json 10 | LICENSE.header 11 | nodemon.json 12 | requests.http 13 | yarn.lock -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | legacy-peer-deps=true -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | docs 2 | dist -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /.release-it.yml: -------------------------------------------------------------------------------- 1 | git: 2 | commitMessage: 'chore(release): v${version}' 3 | tagAnnotation: 'chore(release): v${version}' 4 | tagName: 'v${version}' 5 | 6 | hooks: 7 | after:bump: 8 | - 'npm run changelog:update' 9 | 10 | # automatic publish from github workflow 11 | npm: 12 | publish: false 13 | private: true 14 | registry: 'OMITTED' 15 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.3.11 (2024-03-23) 2 | 3 | 4 | 5 | ## 1.3.10 (2024-01-26) 6 | 7 | 8 | ### Bug Fixes 9 | 10 | * **deps:** update dependency @wppconnect/server to ^2.4.0 ([#572](https://github.com/wppconnect-team/server-cli/issues/572)) ([584e084](https://github.com/wppconnect-team/server-cli/commit/584e0846c2fb13782647afa057a196f3752de366)) 11 | 12 | 13 | 14 | ## 1.3.9 (2024-01-26) 15 | 16 | 17 | 18 | ## 1.3.8 (2023-09-03) 19 | 20 | 21 | 22 | ## 1.3.7 (2023-03-17) 23 | 24 | 25 | ### Bug Fixes 26 | 27 | * Fixed config file argument (fix [#105](https://github.com/wppconnect-team/server-cli/issues/105)) ([64b2ffd](https://github.com/wppconnect-team/server-cli/commit/64b2ffdbc52bb193a3ded633c273c8bcc2d9efc0)) 28 | 29 | 30 | 31 | ## 1.3.6 (2023-03-13) 32 | 33 | 34 | ### Bug Fixes 35 | 36 | * **deps:** update dependency @wppconnect/server to ^1.8.5 ([#392](https://github.com/wppconnect-team/server-cli/issues/392)) ([7c8a043](https://github.com/wppconnect-team/server-cli/commit/7c8a043e66816042f3fde8eeec3b5d23cfd8c235)) 37 | 38 | 39 | 40 | ## 1.3.5 (2022-11-18) 41 | 42 | 43 | ### Bug Fixes 44 | 45 | * **deps:** update dependency @wppconnect/server to ^1.7.2 ([#342](https://github.com/wppconnect-team/server-cli/issues/342)) ([ac82cce](https://github.com/wppconnect-team/server-cli/commit/ac82cce8675ae87f1bcff63fba095f97dc5c1264)) 46 | 47 | 48 | 49 | ## 1.3.4 (2022-11-03) 50 | 51 | 52 | 53 | ## 1.3.3 (2022-08-09) 54 | 55 | 56 | ### Bug Fixes 57 | 58 | * **deps:** update dependency @wppconnect/server to ^1.6.2 ([#310](https://github.com/wppconnect-team/server-cli/issues/310)) ([d2c40c5](https://github.com/wppconnect-team/server-cli/commit/d2c40c537b1795ef4e6e5ff4c1be2ecb58b6a161)) 59 | 60 | 61 | 62 | ## 1.3.2 (2022-08-05) 63 | 64 | 65 | ### Bug Fixes 66 | 67 | * **deps:** update dependency @wppconnect/server to ^1.6.1 ([#309](https://github.com/wppconnect-team/server-cli/issues/309)) ([3fc41bb](https://github.com/wppconnect-team/server-cli/commit/3fc41bba0341a0eb38368472bf7c8fc404182586)) 68 | 69 | 70 | 71 | ## 1.3.1 (2022-05-10) 72 | 73 | 74 | 75 | # 1.3.0 (2022-05-10) 76 | 77 | 78 | 79 | # 1.2.0 (2022-04-25) 80 | 81 | 82 | 83 | ## 1.1.4 (2022-01-21) 84 | 85 | 86 | 87 | ## 1.1.3 (2021-07-15) 88 | 89 | 90 | ### Bug Fixes 91 | 92 | * adicionado novas opções do webhook ([#26](https://github.com/wppconnect-team/server-cli/issues/26)) ([d08093f](https://github.com/wppconnect-team/server-cli/commit/d08093ffa98adc8620777184542747b764a36f78)) 93 | 94 | 95 | 96 | # Changelog 97 | 98 | ### [1.1.2](https://www.github.com/wppconnect-team/server-cli/compare/v1.1.1...v1.1.2) (2021-07-07) 99 | 100 | 101 | ### Bug Fixes 102 | 103 | * Corrigido impressão no console quando o frontend está ativo ([3143253](https://www.github.com/wppconnect-team/server-cli/commit/3143253f9bdb140ab23d4d94b02aaa8dfcd0aa73)) 104 | 105 | ## [1.1.1](https://github.com/wppconnect-team/server-cli/compare/v1.1.0...v1.1.1) (2021-06-21) 106 | 107 | ### Bug Fixes 108 | 109 | - Corrigido dependência de biblioteca na instalação ([87e9ec3](https://github.com/wppconnect-team/server-cli/commit/87e9ec38c993c6dce0327ab1c14c3b953bd94cc7)) 110 | 111 | # [1.1.0](https://github.com/wppconnect-team/server-cli/compare/v1.0.0...v1.1.0) (2021-06-19) 112 | 113 | ### Features 114 | 115 | - Adicionado opção de instalar separadamente o frontend ([ce1950e](https://github.com/wppconnect-team/server-cli/commit/ce1950e8df87ba5b1a9f1b9ef58ba24ddc9f5bb6)) 116 | 117 | # 1.0.0 (2021-06-14) 118 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-alpine3.19 as base 2 | WORKDIR /usr/src/wpp-server 3 | ENV NODE_ENV=production PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true 4 | COPY package.json ./ 5 | RUN apk update && \ 6 | apk add --no-cache \ 7 | vips-dev \ 8 | fftw-dev \ 9 | gcc \ 10 | g++ \ 11 | make \ 12 | libc6-compat \ 13 | && rm -rf /var/cache/apk/* 14 | RUN yarn install --production --pure-lockfile && \ 15 | yarn add sharp --ignore-engines && \ 16 | yarn cache clean 17 | 18 | FROM base as build 19 | WORKDIR /usr/src/wpp-server 20 | ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true 21 | COPY package.json ./ 22 | RUN yarn install --production=false --pure-lockfile && \ 23 | yarn cache clean 24 | COPY . . 25 | RUN yarn build 26 | 27 | 28 | FROM base 29 | WORKDIR /usr/src/wpp-server/ 30 | RUN apk add --no-cache chromium 31 | RUN yarn cache clean 32 | COPY . . 33 | COPY --from=build /usr/src/wpp-server/ /usr/src/wpp-server/ 34 | EXPOSE 21465 35 | ENTRYPOINT ["node", "bin/wppserver.js"] 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2021 WPPConnect Team 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. -------------------------------------------------------------------------------- /LICENSE.header: -------------------------------------------------------------------------------- 1 | Copyright 2021 WPPConnect Team 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WPPConnect Team 2 | 3 | ## _WPPConnect Server Cli_ 4 | 5 | [![Build](https://github.com/wppconnect-team/server-cli/actions/workflows/build.yml/badge.svg)](https://github.com/wppconnect-team/server-cli/actions/workflows/build.yml) 6 | 7 | Esse pacote facilita a utilização do servidor WPPConnect-server através de uma linha de comando 8 | 9 | ## Nossos canais online 10 | 11 | [![Discord](https://img.shields.io/discord/844351092758413353?color=blueviolet&label=Discord&logo=discord&style=flat)](https://discord.gg/JU5JGGKGNG) 12 | [![Telegram Group](https://img.shields.io/badge/Telegram-Group-32AFED?logo=telegram)](https://t.me/wppconnect) 13 | [![WhatsApp Group](https://img.shields.io/badge/WhatsApp-Group-25D366?logo=whatsapp)](https://chat.whatsapp.com/LJaQu6ZyNvnBPNAVRbX00K) 14 | [![YouTube](https://img.shields.io/youtube/channel/subscribers/UCD7J9LG08PmGQrF5IS7Yv9A?label=YouTube)](https://www.youtube.com/c/wppconnect) 15 | 16 | ## Instalação 17 | 18 | Para instalar, basta executar. 19 | 20 | ```sh 21 | yarn global add @wppconnect/server-cli 22 | //ou 23 | npm install -g @wppconnect/server-cli 24 | ``` 25 | 26 | ## E para executar 27 | 28 | ```sh 29 | wppserver 30 | //ou 31 | wppserver --port 8000 32 | ``` 33 | 34 | ## Para mais opções 35 | 36 | ```sh 37 | wppserver --help 38 | ``` 39 | 40 | ## Frontend 41 | 42 | Para adicionar o frontend automaticamente, basta instalar 43 | 44 | ```sh 45 | yarn global add @wppconnect/frontend 46 | //ou 47 | npm install -g @wppconnect/frontend 48 | ``` 49 | 50 | E executar 51 | 52 | ```sh 53 | wppserver --frontend 54 | //ou 55 | wppserver --frontend-path 56 | ``` 57 | 58 | ## Tutorial - Youtube 59 | - Veja o tutorial de uso no [Canal WPPConnect](https://www.youtube.com/watch?v=zBmCnPS3JOQ). 60 | 61 | -------------------------------------------------------------------------------- /bin/wppserver.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /* 3 | * Copyright 2021 WPPConnect Team 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | const server = require('..'); 19 | 20 | server.run(); 21 | -------------------------------------------------------------------------------- /license-checker-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignore": [ 3 | ".github", 4 | ".husky", 5 | "**/.*", 6 | "**/*.http", 7 | "**/*.lock", 8 | "**/*.md", 9 | "api-docs", 10 | "log", 11 | "tokens", 12 | "WhatsAppImages" 13 | ], 14 | "license": "LICENSE.header", 15 | "licenseFormats": { 16 | "js|ts": { 17 | "prepend": "/*", 18 | "append": " */", 19 | "eachLine": { 20 | "prepend": " * " 21 | } 22 | }, 23 | "dotfile": { 24 | "eachLine": { 25 | "prepend": "# " 26 | } 27 | } 28 | }, 29 | "trailingWhitespace": "TRIM" 30 | } 31 | -------------------------------------------------------------------------------- /nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "restartable": "rs", 3 | "ignore": [ 4 | ".git", 5 | "node_modules/", 6 | "tokens" 7 | ] 8 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@wppconnect/server-cli", 3 | "version": "1.3.11", 4 | "description": "Servidor de WPPConnect com frontend para ser executado a partir de uma linha de comando", 5 | "bin": { 6 | "wppserver": "./bin/wppserver.js" 7 | }, 8 | "main": "dist/index.js", 9 | "author": "edgardmessias", 10 | "license": "Apache-2.0", 11 | "scripts": { 12 | "build": "rimraf dist && babel src -s -D -d dist", 13 | "changelog:last": "conventional-changelog -p angular -r 2", 14 | "changelog:preview": "conventional-changelog -p angular -u", 15 | "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s", 16 | "commit": "git-cz", 17 | "license:add": "license-check-and-add add", 18 | "license:check": "license-check-and-add check", 19 | "lint": "eslint --ext .js src", 20 | "prepare": "husky install", 21 | "release": "release-it", 22 | "start": "cross-env RUN_SERVER=1 babel-node src", 23 | "watch": "nodemon -w src --exec \"babel-node src\"" 24 | }, 25 | "config": { 26 | "commitizen": { 27 | "path": "@commitlint/cz-commitlint" 28 | } 29 | }, 30 | "dependencies": { 31 | "@babel/runtime": "^7.27.0", 32 | "@wppconnect/server": "^2.8.6", 33 | "commander": "^13.1.0", 34 | "merge-deep": "^3.0.3", 35 | "prom-client": "^15.1.3" 36 | }, 37 | "devDependencies": { 38 | "@aws-sdk/client-s3": "^3.797.0", 39 | "@babel/cli": "^7.27.0", 40 | "@babel/core": "^7.26.10", 41 | "@babel/eslint-parser": "^7.27.0", 42 | "@babel/eslint-plugin": "^7.27.0", 43 | "@babel/node": "^7.26.0", 44 | "@babel/plugin-transform-runtime": "^7.26.10", 45 | "@babel/preset-env": "^7.26.9", 46 | "@commitlint/cli": "^19.8.0", 47 | "@commitlint/config-conventional": "^19.8.0", 48 | "@commitlint/cz-commitlint": "^19.8.0", 49 | "@wppconnect/frontend": "^1.0.3", 50 | "commitizen": "^4.3.1", 51 | "conventional-changelog-cli": "^5.0.0", 52 | "cross-env": "^7.0.3", 53 | "crypto-js": "^4.2.0", 54 | "eslint": "^8.57.1", 55 | "eslint-config-prettier": "^9.1.0", 56 | "eslint-plugin-prettier": "^4.2.1", 57 | "husky": "^9.1.7", 58 | "license-check-and-add": "^4.0.5", 59 | "mongoose": "^8.14.0", 60 | "nodemon": "^3.1.10", 61 | "prettier": "^2.8.8", 62 | "pretty-quick": "^3.3.1", 63 | "redis": "^4.7.0", 64 | "release-it": "^17.11.0", 65 | "rimraf": "^5.0.10" 66 | }, 67 | "peerDependencies": { 68 | "aws-sdk": "^2.1692.0", 69 | "crypto-js": "^4.2.0", 70 | "mongoose": "^8.14.0", 71 | "redis": "^4.7.0" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { initServer } from '@wppconnect/server'; 17 | import * as express from 'express'; 18 | import * as fs from 'fs'; 19 | import * as path from 'path'; 20 | import mergeDeep from 'merge-deep'; 21 | import { program } from './program'; 22 | 23 | export function run() { 24 | let serverOptions = {}; 25 | 26 | program.parse(); 27 | const commandOptions = program.opts(); 28 | 29 | if (commandOptions.config) { 30 | try { 31 | const json = fs.readFileSync(commandOptions.config, { encoding: 'utf8' }); 32 | const configOptions = JSON.parse(json); 33 | 34 | serverOptions = mergeDeep({}, serverOptions, configOptions); 35 | } catch (error) { 36 | console.log(error); 37 | process.exit(1); 38 | } 39 | 40 | delete commandOptions.config; 41 | } 42 | 43 | const subOptions = ['webhook', 'archive', 'log', 'createOptions']; 44 | 45 | for (const key in commandOptions) { 46 | const opt = subOptions.find((opt) => key.startsWith(opt)); 47 | 48 | if (opt) { 49 | commandOptions[opt] = commandOptions[opt] || {}; 50 | 51 | const name = key.substr(opt.length); 52 | const newName = name[0].toLowerCase() + name.slice(1); 53 | 54 | commandOptions[opt][newName] = commandOptions[key]; 55 | delete commandOptions[key]; 56 | } 57 | } 58 | 59 | serverOptions = mergeDeep({}, serverOptions, commandOptions); 60 | 61 | const { app } = initServer(serverOptions); 62 | 63 | if (commandOptions.frontend) { 64 | let frontendPath = commandOptions.frontendPath; 65 | 66 | if (!frontendPath) { 67 | try { 68 | const frontendPackage = require.resolve('@wppconnect/frontend/package.json'); 69 | frontendPath = path.join(path.dirname(frontendPackage), 'build'); 70 | } catch (error) { 71 | console.error( 72 | 'Não foi encontrado o caminho para o frontend, por favor defina com --frontend-path ou instale o pacote @wppconnect/frontend' 73 | ); 74 | process.exit(1); 75 | } 76 | } 77 | 78 | if (frontendPath) { 79 | // Requisição de configuração do frontend 80 | app.use('/config.js', (req, res) => { 81 | res.set({ 82 | 'Content-Type': 'application/javascript; charset=UTF-8', 83 | }); 84 | res.send(` 85 | // Arquivo gerado automaticamente 86 | window.IP_SERVER = location.protocol + "//" + location.host + '/api/'; 87 | window.IP_SOCKET_IO = ((location.protocol === 'https:') ? 'wss:' : 'ws:') + "//" + location.host; 88 | `); 89 | }); 90 | 91 | app.use(express.static(frontendPath)); 92 | 93 | app.get('*', function (req, res, next) { 94 | // Força a renderização do react para requisições do browser 95 | if (req.accepts('html')) { 96 | return res.sendfile(path.join(frontendPath, 'index.html')); 97 | } 98 | next(); 99 | }); 100 | } 101 | } 102 | } 103 | 104 | if (process.env['RUN_SERVER']) { 105 | run(); 106 | } 107 | -------------------------------------------------------------------------------- /src/program.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 WPPConnect Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import * as packageJSON from '../package.json'; 17 | import { Command } from 'commander'; 18 | export const program = new Command(); 19 | 20 | program.version(packageJSON.version); 21 | 22 | //#region frontend 23 | program.option('--frontend', 'Habilita o frontend'); 24 | program.option('--frontend-path ', 'Caminho dos arquivos de frontend (pasta dist)'); 25 | //#endregion 26 | 27 | //#region comum 28 | program.option('-c, --config ', 'Arquivo JSON de configuração para inicialização'); 29 | 30 | // Host 31 | program.option('-h, --host ', 'Host de execução'); 32 | program.option('-p, --port ', 'Porta de execução'); 33 | program.option('-k, --secretKey ', 'Chave secreta para validação de tokens'); 34 | program.option('--startAllSession', 'Habilita a auto inicialização das sessões'); 35 | program.option('--no-startAllSession', 'Desabilita a auto inicialização das sessões'); 36 | //#endregion 37 | 38 | //#region webhook 39 | program.option('--webhook-url ', 'URL para as chamadas de webhook'); 40 | program.option('--webhook-autoDownload', 'Habilita o auto download de arquivo'); 41 | program.option('--no-webhook-autoDownload', 'Desabilita o auto download de arquivo'); 42 | program.option('--webhook-readMessage', 'Habilita a marcação automática de lido'); 43 | program.option('--no-webhook-readMessage', 'Desabilita a marcação automática de lido'); 44 | program.option('--webhook-allUnreadOnStart', 'Envia no webhook todas as mensagens não lidas na inicialização'); 45 | program.option('--no-webhook-listenAcks', 'Desabilita o envio de ACKs no webhook'); 46 | program.option('--no-webhook-onPresenceChanged', 'Desabilita o envio do onPresenceChanged no webhook'); 47 | program.option('--no-webhook-onParticipantsChanged', 'Desabilita o envio do onParticipantsChanged no webhook'); 48 | //#endregion 49 | 50 | //#region archive 51 | program.option('--archive-enable', 'Habilita o auto-arquivamento'); 52 | program.option('--no-archive-enable', 'Desabilita o auto-arquivamento'); 53 | program.option('--archive-waitTime ', 'Tempo de espera de arquivamento entre chats'); 54 | program.option('--archive-daysToArchive ', 'Dias de inatividade para arquivar'); 55 | //#endregion 56 | 57 | //#region log 58 | program.option('--log-level ', 'Nível de detalhe de log'); 59 | program.option('--log-logger ', 'Opções de saída de LOG'); 60 | //#endregion 61 | 62 | //#region createOptions 63 | program.option('--createOptions-browserArgs ', 'Opções para serem passadas na inicialização do browser'); 64 | //#endregion 65 | --------------------------------------------------------------------------------