Skip to content

Latest commit

 

History

History
81 lines (64 loc) · 1.08 KB

docs.md

File metadata and controls

81 lines (64 loc) · 1.08 KB

API

Send OTP

const MSG91 = require('msg91.js');
const otp = new MSG91.OTP({ authKey });
const response = await otp.send({
  mobile: '',
  template_id: '',
  extra_params: '',
});

Verify an OTP

const MSG91 = require('msg91.js');
const otp = new MSG91.OTP({ authKey });
const response = await otp.verify({
  mobile: '',
  otp: '',
});

Resend an OTP

const MSG91 = require('msg91.js');
const otp = new MSG91.OTP({ authKey });
const response = await otp.resend({
  mobile: '',
  retrytype: 'text', // text | voice
});

Response

Success

{
  type: 'success',
  message: ''
}

Failure

{
  type: 'error',
  error: ''
}

V1 APIs

Send SMS

const SMS = new MSG91.SMS({
  authKey: env.authKey,
});

await SMS.sendSMS({
  mobiles: '8899009988',
  country: '91',
  message: 'Hi beautiful, your package is delivered with order number 1234.',
  route: '4',
  sender: 'MSG91J',
});

Response (success|failure)

{
  response: 'msg91 text response';
}