Giter Site home page Giter Site logo

sarthakjdev / wapi.js Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 3.35 MB

Wapi.js is a node library built for developing WhatsApp cloud API based chat bots in a user friendly way.

Home Page: https://wapijs.co

License: Apache License 2.0

Shell 0.28% JavaScript 7.03% TypeScript 92.13% CSS 0.57%
whatsapp-chatbot whatsapp-cloud-api whatsappjs nodejs typescript whatsapp-bot cloud-api cloud-api-sdk whatsapp chat-bot whatsapp-customer-support-bot

wapi.js's Introduction


@wapijs/wapi.js


๐Ÿ“Œ Status

Beta Version - This library is not stable right now. It is currently in beta version. Report issues here.

๐Ÿ“– About

Wapi.js is a JavaScript module, written in TypeScript, designed to interact with the WhatsApp cloud API in a user-friendly manner.

Packages:

  • @wapijs/wapi.js: Interact with WhatsApp cloud API with simple and easy-to-manage code.
  • @wapijs/create-wapi-app: Start with the development of your WhatsApp bot using this starter template utility.

โœจ Features

  • Object-Oriented Architecture
  • Single Client Model
  • Send Messages with the least configuration
  • Event Listener for Notifications (support both User and System Notifications)
  • Upload Media to WhatsApp servers
  • Reply and React to incoming messages.

๐Ÿ’ป Installation

Ensure you have the Node.js 18 LTS version to use this library.

npm install @wapijs/wapi.js
yarn add @wapijs/wapi.js
pnpm install @wapijs/wapi.js

Note: This library is not affiliated with the official WhatsApp Cloud API or does not act as any official solution provided the the Meta Inclusive Private Limited, this is just a open source library built for developers to support them in building whatsapp cloud api based chat bots easily.

๐Ÿš€ Usage

  • Kickstart your first WhatsApp application with Wapi.js. Check the User Manual.
  • You can check out the example WhatsApp bot here. Example Chatbot
  • You can get started with the development of your bot with this starter template utility.
pnpm create-wapi-app

๐Ÿ”— References

  • Message Structures: Refer to the WhatsApp Docs here.

  • Notification Payloads: Details can be found here.

๐Ÿ”— Other Links

Example Usage

import { Client, TextMessage } from 'wapi.js'

	const whatsappClient = new Client({
		apiAccessToken: process.env.WHATSAPP_API_ACCESS_TOKEN,
		businessAccountId: process.env.WHATSAPP_BUSINESS_ACCOUNT_ID,
		phoneNumberId: process.env.WHATSAPP_PHONE_NUMBER_ID,
		port: 8080,
		webhookEndpoint: '/webhook',
		webhookSecret: process.env.WHATSAPP_WEBHOOK_SECRET
	})

	await whatsappClient.message.send({
		message: new TextMessage({ text: 'hiii, this is wapijs library' }),
		phoneNumber: 'XXXXXXXXXX'
	})

	whatsappClient.on('TextMessage', (message) => {
		console.log(message)
	})

	whatsappClient.on('TextMessage', async (message) => {
		message.reply({
			message: new TextMessage({ text: 'hiii, this is wapijs library' }),,
		})
	})

	whatsappClient.initiate()

๐Ÿค Contribution Guidelines

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

For detailed guidelines, check Contributing.md.

๐Ÿ“œ License

Distributed under the Apache 2.0 License. View LICENSE.

๐Ÿ“ž Contact

Note: This library is part of an open-source product-building initiative by Softlancer, and this repository will soon be moved under the same organization.

wapi.js's People

Contributors

sarthakjdev avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

wapi.js's Issues

Feature: Add support for WhatsApp Business Management API

Is your feature request related to a problem? Please describe.
N/A

Describe the solution you'd like
We should have support for whatsapp business management api in the library itself, this way we can manage the phone numbers, templates etc programmatically itself and it would expand the library to be usable by technical vendors to provide solutions to the end consumers.

Describe alternatives you've considered
N/A

Additional context
https://developers.facebook.com/docs/whatsapp/business-management-api
https://developers.facebook.com/docs/whatsapp/business-management-api/guides/set-up-webhooks

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.