UNPKG

msg91

Version:
80 lines (79 loc) 2.03 kB
type Options = { authKey: string; [key: string]: any; }; type Type = "voice" | "text"; declare class Msg91 { private authKey?; private initialized; initialize(options: Options): void; private validateInit; getCampaign(options?: { authKey?: string; }): Campaign; getOTP(templateId: string, options?: { authKey?: string; length?: number; }): Otp; getSMS(options?: { authKey?: string; }): Sms; } type SmsOptions = { senderId?: string; shortURL?: boolean; }; type SmsRecipients = { mobile: string; [key: string]: string; }; declare class Sms { private authKey; constructor(authKey: string); send(flowId: string, recipient: SmsRecipients | [SmsRecipients], options?: SmsOptions): Promise<unknown>; } type Channel = { campaign_id: number; channel_id: number; count: number; }; type CampaignType = { id: number; name: string; is_active: boolean; slug: string; channels: [Channel]; }; type Field = { mapping: [{ [key: string]: any; }]; variables: [string]; }; declare class Campaign { private authKey; constructor(authKey: string); getAll(): Promise<[CampaignType]>; getFields(slug: string): Promise<Field>; getBody(slug: string): Promise<unknown>; run(slug: string, body: any): Promise<unknown>; send(slug: string, body: any): Promise<unknown>; } type OtpOptions = { templateId?: string; expiry?: number; length?: number; }; declare class Otp { private templateId; private authkey; private length; constructor(templateId: string, authkey: string, options?: { length?: number; }); retry(mobileNumber: string, type?: Type): Promise<unknown>; verify(mobileNumber: string, otp: string): Promise<unknown>; send(mobileNumber: string, options?: OtpOptions): Promise<unknown>; } declare const msg91: Msg91; export default msg91;