Coder Social home page Coder Social logo

vhirmanchaniago / baileys-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ookamiiixd/baileys-api

0.0 0.0 0.0 342 KB

Simple WhatsApp REST API with multiple device support

License: MIT License

Shell 0.72% JavaScript 2.09% TypeScript 97.19%

baileys-api's Introduction

Baileys API

An implementation of @adiwajshing/Baileys as a simple REST API with multiple device support

Requirements

Installation

  1. Download or clone this repo. If you want to skip the build step, you can download the prebuilt one (file with the baileys-api-VERSION.tgz name pattern) from the release page
  2. Enter to the project directory
  3. Install the dependencies
npm install
  1. Build the project using the build script
npm run build

You can skip this part if you're using the prebuilt one from the release page

Setup

  1. Copy the .env.example file and rename it into .env, then update your connection url in the DATABASE_URL field
  2. Update your provider in the prisma/schema.prisma file if you're using database other than MySQL
  3. Run your migration
npx prisma migrate (dev|deploy)

or push the schema

npx prisma db push

Don't forget to always re-run those whenever there's a change on the prisma/schema.prisma file

.env Configurations

# Listening Host
HOST="localhost"

# Listening Port
PORT="3000"

# Database Connection URL
DATABASE_URL="mysql://root:12345@localhost:3306/baileys_api"

# Reconnect Interval (in Milliseconds)
RECONNECT_INTERVAL="5000"

# Maximum Reconnect Attempts
MAX_RECONNECT_RETRIES="5"

# Maximum SSE QR Generation Attempts
SSE_MAX_QR_GENERATION="10"

# Pino Logger Level
LOG_LEVEL="warn"

Usage

  1. Make sure you have completed the Installation and Setup step
  2. You can then start the app using the start script
npm run start
  1. Now the endpoint should be available according to your environment variables configuration. Default is at http://localhost:3000

API Docs

The API documentation is available online here. You can also import the Postman Collection File (postman_collection.json) into your Postman App alternatively

Notes

  • There's no authentication, you may want to implement your own. I don't want to force anyone into using a specific authentication method, choose whatever you love

Notice

This project is intended for learning purpose only, don't use it for spamming or any activities that's prohibited by WhatsApp

baileys-api's People

Contributors

ookamiiixd avatar dgbkn avatar dependabot[bot] avatar

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.