Skip to content

Instantly share code, notes, and snippets.

@raghavgarg1257
Created December 22, 2017 09:24
Show Gist options
  • Select an option

  • Save raghavgarg1257/2ce8ae9353361c77858ea0225fc2e71e to your computer and use it in GitHub Desktop.

Select an option

Save raghavgarg1257/2ce8ae9353361c77858ea0225fc2e71e to your computer and use it in GitHub Desktop.
sendOtp(mobiles, message = null) {
const params = [
{ key: 'authkey', value : process.env.SMS_API_KEY },
{ key: 'sender', value : process.env.SMS_SENDERID },
{ key: 'otp_length', value : 6 },
{ key: 'message', value : message || encodeURIComponent("Your verification code for Spectrum is ##OTP##.") },
{ key: 'mobile', value : mobiles }
];
const queryParams = params.map( o => `${o.key}=${o.value}` );
return axios.post(`http://control.msg91.com/api/sendotp.php?${queryParams.join('&')}`, params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment