Wapi.js is a node SDK built for developing WhatsApp Business platform apps with ease and faster
AGPL-3.0 License
Visit the documentation of the SDK here
Beta Version - This SDK is not stable right now. It is currently in beta version. Report issues here.
Wapi.js is a JavaScript module, written in TypeScript, designed to interact with the WhatsApp cloud API in a user-friendly manner.
Ensure you have the Node.js 18 LTS version to use this SDK.
npm install @wapijs/wapi.js
yarn add @wapijs/wapi.js
pnpm install @wapijs/wapi.js
Note: This SDK 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 SDK built for developers to support them in building whatsapp cloud api based chat bots easily.
pnpm create-wapi-app
Message Structures: Refer to the WhatsApp Docs here.
Notification Payloads: Details can be found here.
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 SDK' }),
phoneNumber: 'XXXXXXXXXX'
})
whatsappClient.on('TextMessage', (message) => {
console.log(message)
})
whatsappClient.on('TextMessage', async (message) => {
message.reply({
message: new TextMessage({ text: 'hiii, this is wapijs SDK' }),,
})
})
whatsappClient.initiate()
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)For detailed guidelines, check Contributing.md.
Distributed under the AGPL 3.0 License. View LICENSE.
Note: This SDK is part of an open-source product-building initiative by Softlancer, and this repository will soon be moved under the same organization.