releans
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Releans Logo Releans

A node library to implement Releans SMS API. License MIT


Releans Docs


SMS API

Read doc

Send a message

        import { SMS } from 'releans';
        const config: IConfig = {
            apiKey: 'your-key',
        }
        const data: IMessageData = {
            sender: 'SenderName',
            mobile: 'E164FormatNumber',
            content: 'Your content'
        };
        const sms = new SMS(config);
        const result = await sms.send(data);

        if (result.data) {
            console.dir(result.data)
        }

        if(result.error) {
            console.log(result.error);
        }

Retrieve all messages

        import { SMS } from 'releans';
        const config: IConfig = {
            apiKey: 'your-key',
        }
 
        const sms = new SMS(config);
        const result = await sms.retrieveAll();

        if (result.data) {
            console.dir(result.data)
        }

        if(result.error) {
            console.log(result.error);
        }

Retrieve messages by date

        import { SMS } from 'releans';
        const config: IConfig = {
            apiKey: 'your-key',
        }
        const date = '2023-05-16' //'yyyy-MM-dd'
        const sms = new SMS(config);
        const result = await sms.retrieveByDate(date);

        if (result.data) {
            console.dir(result.data)
        }

        if(result.error) {
            console.log(result.error);
        }

Retrieve a message by messageId

        import { SMS } from 'releans';
        const config: IConfig = {
            apiKey: 'your-key',
        }
        const messageId = 12345678
        const sms = new SMS(config);
        const result = await sms.retrieveByMessageId(messageId);

        if (result.data) {
            console.dir(result.data)
        }

        if(result.error) {
            console.log(result.error);
        }

OTP / Verify API

Read doc

Send OTP Code

        import { OTP } from 'releans';
        const config: IConfig = {
            apiKey: 'your-key',
        }
         const data: IOTPSendData = {
            sender: 'Sender Name',
            mobile: 'E164FormatNumber',
            channel: 'sms' // sms or voice
        };
        const otp = new OTP(config);
        const result = await otp.send(data);

        if (result.data) {
            console.dir(result.data)
        }

        if(result.error) {
            console.log(result.error);
        }

Verify OTP Code

        import { OTP } from 'releans';
        const config: IConfig = {
            apiKey: 'your-key',
        }
         const data: IOTPVerifyData = {
            mobile: 'E164FormatNumber',
            code: '123456'
        };
        const otp = new OTP(config);
        const result = await otp.verify(data);

        if (result.data) {
            console.dir(result.data)
        }

        if(result.error) {
            console.log(result.error);
        }

Balance API

Read doc

        import { Balance } from 'releans';
        const config: IConfig = {
            apiKey: 'your-key',
        }
 
        const balance = new Balance(config);
        const result = await balance.retrieve();

        if (result.data) {
            console.dir(result.data)
        }

        if(result.error) {
            console.log(result.error);
        }

Bug report

https://github.com/Drunkenpilot/releans/issues

Package Sidebar

Install

npm i releans

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

41.5 kB

Total Files

45

Last publish

Collaborators

  • betalife