-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
20,580 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Ignore node_modules | ||
node_modules | ||
|
||
# Ignore dotenv files | ||
.env | ||
.env.example | ||
|
||
# Ignore logs | ||
logs | ||
|
||
# Ignore test files | ||
tests | ||
|
||
# Ignore session files | ||
sessions | ||
sessions_test | ||
|
||
# Ignore git related files | ||
.git | ||
.gitignore | ||
|
||
# Ignore other unnecessary files | ||
README.md | ||
CONTRIBUTING.md | ||
LICENSE.md | ||
Dockerfile | ||
docker-compose.yml | ||
swagger.yml | ||
.github | ||
assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Application ## | ||
PORT=3000 # OPTIONAL, DEFAULT 3000 | ||
API_KEY=your_global_api_key_here # OPTIONAL, DEFAULT EMPTY | ||
BASE_WEBHOOK_URL=http://localhost:3000/localCallbackExample # MANDATORY | ||
ENABLE_LOCAL_CALLBACK_EXAMPLE=TRUE # OPTIONAL, DISABLE FOR PRODUCTION | ||
RATE_LIMIT_MAX=1000 # OPTIONAL, THE MAXIUM NUMBER OF CONNECTIONS TO ALLOW PER TIME FRAME | ||
RATE_LIMIT_WINDOW_MS=1000 # OPTIONAL, TIME FRAME FOR WHICH REQUESTS ARE CHECKED IN MS | ||
|
||
## Client ## | ||
MAX_ATTACHMENT_SIZE=10000000 # IF REACHED, MEDIA ATTACHMENT BODY WILL BE NULL | ||
SET_MESSAGES_AS_SEEN=TRUE # WILL MARK THE MESSAGES AS READ AUTOMATICALLY | ||
# ALL CALLBACKS: auth_failure|authenticated|call|change_state|disconnected|group_join|group_leave|group_update|loading_screen|media_uploaded|message|message_ack|message_create|message_reaction|message_revoke_everyone|qr|ready|contact_changed|unread_count|message_edit|message_ciphertext | ||
DISABLED_CALLBACKS=message_ack|message_reaction|unread_count|message_edit|message_ciphertext # PREVENT SENDING CERTAIN TYPES OF CALLBACKS BACK TO THE WEBHOOK | ||
WEB_VERSION='2.2328.5' # OPTIONAL, THE VERSION OF WHATSAPP WEB TO USE | ||
WEB_VERSION_CACHE_TYPE=none # OPTIONAL, DETERMINTES WHERE TO GET THE WHATSAPP WEB VERSION(local, remote or none), DEFAULT 'none' | ||
RECOVER_SESSIONS=TRUE # OPTIONAL, SHOULD WE RECOVER THE SESSION IN CASE OF PAGE FAILURES | ||
CHROME_BIN= # OPTIONAL, PATH TO CHROME BINARY | ||
HEADLESS=TRUE # OPTIONAL, RUN CHROME IN HEADLESS MODE | ||
|
||
## Session File Storage ## | ||
SESSIONS_PATH=./sessions # OPTIONAL | ||
|
||
ENABLE_SWAGGER_ENDPOINT=TRUE # OPTIONAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
jest: true | ||
}, | ||
extends: 'standard', | ||
overrides: [ | ||
], | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module' | ||
}, | ||
rules: { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: CI/CD Pipeline for Pull Requests to Master | ||
|
||
'on': | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: | ||
- 18.x | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: 'Use Node.js ${{ matrix.node-version }}' | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '${{ matrix.node-version }}' | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Run tests | ||
run: npm test | ||
timeout-minutes: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: CI/CD Pipeline for Docker Tag Push | ||
|
||
'on': | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: | ||
- 18.x | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: 'Use Node.js ${{ matrix.node-version }}' | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '${{ matrix.node-version }}' | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Run tests | ||
run: npm test | ||
timeout-minutes: 1 | ||
|
||
docker: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: '${{ secrets.DOCKER_HUB_USERNAME }}' | ||
password: '${{ secrets.DOCKER_HUB_TOKEN }}' | ||
- name: Build and push with dynamic tag | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||
push: true | ||
tags: | | ||
avoylenko/wwebjs-api:${{ github.ref_name }} | ||
avoylenko/wwebjs-api:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Ignore node_modules | ||
node_modules | ||
|
||
# Ignore dotenv files | ||
.env | ||
|
||
# Ignore sessions | ||
sessions | ||
sessions_test | ||
.wwebjs_cache | ||
|
||
# Ignore logs | ||
logs | ||
|
||
# Ignore test coverage reports | ||
coverage | ||
|
||
# Ignore other unnecessary files | ||
.DS_Store | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Contributing to WWebJS REST API Wrapper | ||
|
||
Welcome to WWebJS API Wrapper! We appreciate your interest in contributing to this project. Please follow the guidelines below to contribute effectively. | ||
|
||
## Getting Started | ||
|
||
1. Fork the repository. | ||
2. Clone your forked repository to your local machine. | ||
3. Install the necessary dependencies by running `npm install`. | ||
4. Create a new branch for your contribution. | ||
|
||
## Code Style | ||
|
||
- Follow the existing code style and conventions in the project. | ||
- Use meaningful variable and function names. | ||
- Add comments to your code, especially for complex or tricky parts. | ||
|
||
## Pull Requests | ||
|
||
- Create a pull request from your branch to the `master` branch of this repository. | ||
- Provide a clear and descriptive title for your pull request. | ||
- Include a detailed description of the changes you made in the pull request. | ||
- Reference any related issues in your pull request description using the `#` symbol followed by the issue number. | ||
|
||
## Testing | ||
|
||
- Write appropriate unit tests for your code. | ||
- Make sure all existing tests pass. | ||
- Provide instructions for testing your changes, if necessary. | ||
|
||
## Documentation | ||
|
||
- Update the README.md file with any relevant information about your contribution, including installation instructions, usage examples, and API documentation. | ||
|
||
## Code Block Example | ||
|
||
When providing code examples or error messages, please use code blocks. You can create a code block by wrapping your code or message with triple backticks (\```) on separate lines, like this: | ||
|
||
\``` | ||
// Example code block | ||
const hello = "Hello, world!"; | ||
console.log(hello); | ||
\``` | ||
|
||
This will render as: | ||
|
||
``` | ||
// Example code block | ||
const hello = "Hello, world!"; | ||
console.log(hello); | ||
``` | ||
|
||
## Contact Us | ||
|
||
If you have any questions or need further assistance, feel free to contact us by opening an issue or reaching out to us through email or chat. | ||
|
||
Thank you for your contribution! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Use the official Node.js Alpine image as the base image | ||
FROM node:18-alpine | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Install Chromium | ||
ENV CHROME_BIN="/usr/bin/chromium-browser" \ | ||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" \ | ||
NODE_ENV="production" | ||
RUN set -x \ | ||
&& apk update \ | ||
&& apk upgrade \ | ||
&& apk add --no-cache \ | ||
udev \ | ||
ttf-freefont \ | ||
chromium \ | ||
ffmpeg | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install the dependencies | ||
RUN npm ci --only=production --ignore-scripts | ||
|
||
# Copy the rest of the source code to the working directory | ||
COPY . . | ||
|
||
# Expose the port the API will run on | ||
EXPOSE 3000 | ||
|
||
# Start the API | ||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# MIT License | ||
|
||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
|
||
The WhatsApp Web.js REST API Wrapper is licensed under the MIT License, which is a permissive open source license that allows you to use, modify, and distribute the software for both commercial and non-commercial purposes. Please see the full license text below. | ||
|
||
## License | ||
|
||
MIT License | ||
|
||
``` | ||
MIT License | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
``` |
Oops, something went wrong.