
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
whatsapp-nodejs-sdk
Advanced tools
A Node.js SDK for the WhatsApp Cloud API, allowing easy integration of WhatsApp messaging into your applications.
A Node.js SDK for the WhatsApp Cloud API, allowing easy integration of WhatsApp messaging into your applications.
Install the SDK via npm:
npm install whatsapp-nodejs-sdk
Before using the SDK, initialize the WhatsAppClient
with your phone number ID and access token. Get it from Meta Developers.
const { WhatsAppClient } = require('whatsapp-nodejs-sdk');
const whatsappClient = new WhatsAppClient(
"YOUR_PHONE_NUMBER_ID",
"YOUR_ACCESS_TOKEN"
);
Send an image to the user with an introductory message:
whatsappClient.sendMediaMessage(
"258841234567", // recipient's phone number
"image", // media type
"https://www.w3schools.com/w3css/img_lights.jpg", // media URL
"Hello! I'm Quick Top Up Bot, here to help you get top-ups for your favorite games quickly and easily." // caption
);
Send an interactive message with a list of options for the user to select from:
whatsappClient.sendInteractiveMessage(
"258841234567",
"list",
"Open the list below to explore some available options",
[
{
title: "Choose an option",
rows: [
{ id: "OP_1", title: "Buy Top-Ups", description: "Get top-ups for your favorite games." },
{ id: "OP_2", title: "FAQ", description: "Find answers to frequently asked questions." },
{ id: "OP_3", title: "Tutorial", description: "Learn how to use the bot step by step." },
]
},
],
);
Send an interactive message with buttons for the user to select from:
whatsappClient.sendInteractiveMessage(
"258841234567",
"button",
"You chose *500 MZN* to get *1000 Diamonds* in Free Fire! \n\nSelect a payment method:",
[
{ id: "MPESA", title: "M-Pesa" },
{ id: "EMOLA", title: "E-Mola" },
],
);
Send a simple text message to the user:
whatsappClient.sendTextMessage(
"258841234567",
"Hello! I'm Quick Top Up Bot, here to help you get top-ups for your favorite games quickly and easily."
);
FAQs
A Node.js SDK for the WhatsApp Cloud API, allowing easy integration of WhatsApp messaging into your applications.
The npm package whatsapp-nodejs-sdk receives a total of 162 weekly downloads. As such, whatsapp-nodejs-sdk popularity was classified as not popular.
We found that whatsapp-nodejs-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.