this is a fork of the official Africa's Talking node module but for the Sandbox
# africastalking sandbox-node.js
AfricasTalking node.js Sandbox API wrapper
### About
This is a wrapper for the Africa's Talking Sandbox API. It tracks the Official Africa's talking API. The documentation provided here is the same.
### Install
```bash
$ npm install --save atsandbox
```
### Initialization
```javascript
var options = {
apiKey: 'YOUR_API_KEY',
username: 'YOUR_USERNAME',
format: 'json' // or xml
};
var AfricasTalking = require('africastalking')(options);
// ...
```
**`Important`: If you register a callback URL with the API, always remember to acknowledge the receipt of any data it sends by responding with an HTTP `200`; e.g. `res.status(200);` for express**.
### SMS
```javascript
var sms = AfricasTalking.SMS;
// all methods return a promise
sms.send(opts)
.then(success)
.catch(error);
```
#### Sending SMS
- `send(options)`: Send a message. `options` contains:
- `to`: A single recipient or an array of recipients. `REQUIRED`
- `from`: Shortcode or alphanumeric ID that is registered with Africa's Talking account.
- `message`: SMS content. `REQUIRED`
- `sendBulk(options)`: Send bulk SMS. In addition to paramaters of `send()`, we would have:
- `enqueue`: "[...] would like deliver as many messages to the API before waiting for an Ack from the Telcos."
- `sendPremium(options)`: Send premium SMS. In addition to paramaters of `send()`, we would have:
- `keyword`: Value is a premium keyword `REQUIRED`
- `linkId`: "[...] We forward the `linkId` to your application when the user send a message to your service" `REQUIRED`
- `retryDurationInHours`: "It specifies the number of hours your subscription message should be retried in case it's not delivered to the subscriber"
#### Retrieving SMS
> You can register a callback URL with us and we will forward any messages that are sent to your account the moment they arrive.
> Read more
- `fetchMessages(options)`: Manually retrieve your messages.
- `lastReceivedId`: "This is the id of the message that you …