Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wapijs/wapi.js

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wapijs/wapi.js

a typescript based client library to build whatsapp cloud api based chat bots

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

@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.

✨ 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 wapi.js
yarn add wapi.js
pnpm install 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-bot

🔗 References

  • Message Structures: Refer to the WhatsApp Docs here.

  • Notification Payloads: Details can be found here.

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.

Keywords

FAQs

Package last updated on 12 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc