1.0.4 • Published 12 months ago

releans v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago