1.0.0 • Published 1 year ago

@retarus/sms v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Retarus Sms Node SDK

The official SMS SDK implemented in typescript for (node, deno and bun) to use the retarus service with ease.

Installation

yarn:

yarn add @retarus/sms

npm:

npm i @retarus/sms

Usage

The Node SDK provides a client implementation to contact our sms services. To offer a fast and simple way to integrate our services into your applications without having to write a lot of code. The examples can be found in the examples directory sorted by each service. Furthermore, you can check out our OpenAPI documents on the interfaces here: https://developers.retarus.com

Configuring the SDK

First, you need to configure the SDK with your details.

import { Configuration, Region } from '@retarus/sms'

Configuration.getInstance().setRegion(Region.Europe);
Configuration.getInstance().setAuth(process.env["retarus_userid"]!, process.env["retarus_sms_password"]!)

Each service implementes a client which contains all the functions to contact and work with the messaging services. As you can see we globally set our region for the SDK, where your data should be processed and also your credentials are needed to authorize your requests.

import { SmsClient } from '@retarus/sms'

const smsClient = new SmsClient();

Send a SMS

To send a sms, first set up the SDK like described above. For your credentials, we recommend setting up an .env file.

Please note: Using the API will only work with valid credentials.

After that, you can execute the examples "01.send_sms.ts" with Typescript. As a result, you should get a message that reports back the ID of the created job, it will also show how to request the according report for the job.

1.0.0

1 year ago