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
WOTMASTER_SECRET=... # A secret key for your app (starts with wotmaster)
⚠️
If you don't already have a wotmaster 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
Connecting your whatsapp account.
All the Unofficial whatsapp message are send through your whatsapp account.
- Login (opens in a new tab) to wotmaster Service.
- Click on [add accounts].(https://wotmaster.com/dashboard/accounts (opens in a new tab))
- Scan the qr code from Whatsapp App.
- Check the status of the connected account.
Send request to generate otp
src/utils/sendOTP.ts
import fetch from "node-fetch";
const url = "http://wotmaster.com/api/wu/otp";
const response = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringfy({
key: "wotmaster_••••••••••••••••••••••••",
countryCode: "91",
phone: "9999999999",
instanceId: "••••••••••••••••••••••••",
appName: "wotmaster",
}),
});
if (response.ok) {
const body = await response.json();
const { id, phone, otp, message } = body;
console.log(id, phone, otp, message);
}
Params
key = WOTMASTER_SECRET
countryCode = International country code without +
phone = Whatsapp number of receiver without countryCode
instanceId = Instance Id of whatsapp account connected and active
appName = name of your app