Getting Started with Whatsapp Unofficial
Make sure you install the packages and get your env variables first
Package Setup
Install the packages
npm install node-fetch
Add env variables
WOTVERIFY_SECRET=... # A secret key for your app (starts with wotverify_)
⚠️
If you don't already have a wotverify secret key, sign up (opens in a new tab) and create one from the dashboard! (opens in a new tab)
Set Up A Whatsapp Unofficial Service
Send request to generate otp
src/utils/sendOTP.ts
import fetch from "node-fetch";
const url = "https://wotverify.com/api/wm/otp";
const response = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringfy({
key: string,
countryCode: string,
phone: string,
appName: string,
}),
});
if (response.ok) {
const body = await response.json();
const { id, phone, otp, message } = body;
console.log(id, phone, otp, message);
}
Params
key = WOTVERIFY_SECRET
countryCode = International country code without +
phone = Whatsapp number of receiver without countryCode
appName = name of your app