Skip to content

PalashCoder/whatsappotp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to Whataspp OTP Service

Usages

import { WhatsappOTP } from 'whatsappopt';

const otpService = new WhatsappOTP({
  whatsappApiUrl: 'https://api.your-whatsapp-provider.com/v1/messages',
  whatsappApiToken: 'YOUR_API_TOKEN',
  fromNumber: 'YOUR_WHATSAPP_NUMBER'
});

async function main() {
  const userPhoneNumber = 'USER_PHONE_NUMBER';

  // Send OTP
  await otpService.sendOTP(userPhoneNumber);

  // Simulate user input for OTP
  const userInputOTP = 'USER_INPUT_OTP';

  // Verify OTP
  if (otpService.verifyOTP(userPhoneNumber, userInputOTP)) {
    console.log('OTP is correct');
  } else {
    console.log('Invalid OTP');
  }
}

main();