Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 685 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 685 Bytes

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();