Skip to content

Commit

Permalink
Merge pull request #9 from sreeteja06/v2.x
Browse files Browse the repository at this point in the history
extra_param parameter in send request.
  • Loading branch information
sumitsk20 committed Jan 28, 2021
2 parents 9335bba + 9aac70e commit c3874e8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ await msg91otp.retry("919999999999",true)

**userip** : `string` User IP

**extra_param** : Here you can pass the variables created in the SendOTP template.

### Licence: (MIT License)

**Copyright (c) 2018 Sumeet Bhardwaj**
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "msg91-lib",
"version": "2.0.1",
"version": "2.0.2",
"description": "Unofficial msg91 library to send OTP & messages",
"main": "index.js",
"scripts": {
Expand All @@ -11,6 +11,7 @@
"url": "git+https://github.com/sumitsk20/msg91-lib.git"
},
"homepage": "https://github.com/sumitsk20/msg91-lib/tree/v2.x",
"types": "./types/index.d.ts",
"keywords": [
"msg91",
"otp",
Expand Down
3 changes: 2 additions & 1 deletion src/msg91OTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class Msg91Otp {
otp_expiry: args.expiry || this.defaultOtpExpiry,
otp_length: args.otpLength || this.defaultOtpLength,
email: args.email || '',
invisible: args.invisible || 1
invisible: args.invisible || 1,
extra_param: args.extra_param || ''
}
};
return await makeRequest(options);
Expand Down
29 changes: 29 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
interface IMsg91OtpConstructorArgs {
authKey: string;
templateId: string;
baseUrl?: string;
apiVersion?: string;
otpExpiry?: number;
otpLength?: number;
}

interface IMsg91SendOtpArgs {
templateId?: string;
expiry?: number;
otpLength?: number;
email?: string;
invisible?: 0 | 1;
extra_param: any;
}

declare class Msg91Otp {
constructor(args: IMsg91OtpConstructorArgs);

send(contactNumber: string | number, args?: IMsg91SendOtpArgs): Promise<any>;

retry(contactNumber: string | number, retryType?: string): Promise<any>;

verify(contactNumber: string | number, otp: number | string): Promise<any>;
}

export { Msg91Otp as msg91OTP };

0 comments on commit c3874e8

Please sign in to comment.