clicksend
Version:
This is the official [ClickSend](https://clicksend.com) SDK. Documentation can be found [here](https://developers.clicksend.com/docs/rest/v3/?nodejs#introduction).
75 lines (46 loc) • 1.89 kB
Markdown
This is the official [ClickSend](https://clicksend.com) SDK. Documentation can be found [here](https://developers.clicksend.com/docs/rest/v3/?nodejs#introduction).
- [Sign Up](https://www.clicksend.com/signup) for a free ClickSend account.
- Copy your API key from the [API Credentials](https://dashboard.clicksend.com/#/account/subaccount) area.
To download the SDK into your package run the command:
```shell
npm i clicksend
```
You will need to install typescript to compile the code.
```shell
sudo npm install typescript
```
Run the following commands to compile typescript into javascript:
```shell
sudo npm add request http bluebird @types/node
tsc --target es5 /node_modules/clicksend/api.ts
```
Copy the api.js file along with the node_modules directory into your project to use the library, and include this in your file to use the SDK:
```shell
var api = require('./node_modules/clicksend/api.js');
```
Documentation for our SDK and REST API can be found [here](https://developers.clicksend.com/docs/rest/v3/?nodejs#introduction).
Please follow the [installation](
```nodejs
var api = require('./api.js');
var smsMessage = new api.SmsMessage();
smsMessage.from = "myNumber";
smsMessage.to = "+0451111111";
smsMessage.body = "test message";
var smsApi = new api.SMSApi("username", "api_key");
var smsCollection = new api.SmsMessageCollection();
smsCollection.messages = [smsMessage];
smsApi.smsSendPost(smsCollection).then(function(response) {
console.log(response.body);
}).catch(function(err){
console.error(err.body);
});
```