Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

africastalking

Package Overview
Dependencies
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

africastalking - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

lib/mobileData.js

2

lib/common.js

@@ -25,3 +25,3 @@ 'use strict';

exports.PAYMENT_URL = "https://payments." + baseDomain;
exports.MOBILE_DATA_URL = "https://bundles." + baseDomain;

@@ -28,0 +28,0 @@ exports.CONTENT_URL = sandbox

@@ -13,3 +13,3 @@ 'use strict';

const Voice = require('./voice');
const Payment = require('./payments');
const MobileData = require('./mobileData');

@@ -64,5 +64,4 @@

this.VOICE = new Voice(this.options);
this.PAYMENTS = new Payment(this.options);
this.PAYMENT = this.PAYMENTS; /* So we don't break apps using old version */
this.AIRTIME = new Airtime(this.options);
this.MOBILE_DATA = new MobileData(this.options);
this.TOKEN = new Token(this.options);

@@ -69,0 +68,0 @@ this.USSD = USSD;

{
"name": "africastalking",
"version": "0.6.3",
"version": "0.6.4",
"description": "Official AfricasTalking node.js API wrapper",
"main": "index.js",
"scripts": {
"test": "nyc mocha ./test",
"test": "nyc mocha ./test --exit --recursive",
"test-windows": "nyc node_modules/mocha/bin/_mocha ./test"

@@ -36,2 +36,3 @@ },

"body-parser": "^1.19.1",
"dotenv": "^16.3.1",
"google-libphonenumber": "^3.2.33",

@@ -38,0 +39,0 @@ "lodash": "^4.17.21",

@@ -58,14 +58,17 @@ # Africa's Talking Node.js SDK

- [Application Service](#applicationservice) : `AfricasTalking.APPLICATION`
- [SMS Service](#sms) : `AfricasTalking.SMS`
- [Airtime Service](#airtimeservice) : `AfricasTalking.AIRTIME`
- [Airtime Service](#airtime) : `AfricasTalking.AIRTIME`
- [SMS Service](#smsservice) : `AfricasTalking.SMS`
- [Mobile Data Service](#mobiledata) : `AfricasTalking.MOBILEDATA`
- [Voice Service](#voiceservice) : `AfricasTalking.VOICE`
- [Voice Service](#voice) : `AfricasTalking.VOICE`
- [Token Service](#tokenservice) : `AfricasTalking.TOKEN`
- [USSD](#ussd) : USSD API
- [Token Service](#token) : `AfricasTalking.TOKEN`
- [Application Service](#application) : `AfricasTalking.APPLICATION`
## Services

@@ -78,87 +81,9 @@

### `SMS`
### `ApplicationService`
- `send({ to, from, message, enqueue })`: Send an SMS to one or more phone numbers
- `fetchApplicationData()`: Get app information. e.g. balance
For more information, please read [https://developers.africastalking.com/docs/application](https://developers.africastalking.com/docs/application)
### `AirtimeService`
- `airtime.send({ recipients })`: Send airtime to a bunch of phone numbers.
- `recipients`: An array of objects containing the following keys:
- `phoneNumber`: Recipient of airtime. `REQUIRED`.
- `currencyCode`: 3-digit ISO format currency code. `REQUIRED`.
- `amount`: Amount to charge. `REQUIRED`.
- `maxNumRetry`: This allows you to specify the maximum number of retries in case of failed airtime deliveries due to various reasons such as telco unavailability. The default retry period is 8 hours and retries occur every 60seconds. For example, setting `maxNumRetry=4` means the transaction will be retried every 60seconds for the next 4 hours.`OPTIONAL`.
- Example:
```javascript
airtime.send({
recipients: [
{
phoneNumber: '+xxxxxxxxxxxx',
currencyCode: 'KES',
amount: 90
},
{
phoneNumber: '+xxxxxxxxxxxx',
currencyCode: 'KES',
amount: 897
}
],
maxNumRetry: 3, // Will retry the transaction every 60seconds for the next 3 hours.
});
```
For more information, please read [https://developers.africastalking.com/docs/airtime/sending](https://developers.africastalking.com/docs/airtime/sending)
### `SmsService`
- Send a message to one recipient.
```javascript
send({
to: '+xxxxxxxxxxxx',
from: 'XYZ LTD',
message: 'Hello world',
enqueue: true,
});
```
- Send a message to multiple recipients.
```javascript
send({
to: ['+xxxxxxxxxxxx','+yyyyyyyyyyyy','+zzzzzzzzzzzz'],
from: 'XYZ LTD',
message: 'Hello world',
enqueue: true,
});
```
- Send different messages to different recipients.
```javascript
send([
{
to: ['+aaaaaaaaaaaa','+bbbbbbbbbbbb','+cccccccccccc'],
from: 'XYZ LTD',
message: 'Congratulations team! You have won it!',
enqueue: true,
},
{
to: '+xxxxxxxxxxxx',
from: 'XYZ LTD',
message: 'Congratulations coach! Your team has won!',
enqueue: true,
}
]);
```
- `send([{ to, from, message, enqueue }])`: Send multiple SMSes to one or more phone numbers
- `to`: Recipient(s) phone number. `REQUIRED`
- `to`: Recipient(s) phone number. Can either a single phone number or an array of phone numbers `REQUIRED`
- `from`: Shortcode or alphanumeric ID that is registered with Africa's Talking account

@@ -170,3 +95,2 @@ - `message`: SMS content. `REQUIRED`

- `send()` parameters plus:
- `keyword`: You premium product keyword

@@ -176,3 +100,2 @@ - `linkId`: We forward the `linkId` to your application when the user send a message to your service

- `fetchMessages({ lastReceivedId })`: Manually retrieve your messages

@@ -182,3 +105,2 @@

- `fetchSubscription({ shortCode, keyword, lastReceivedId })`: Fetch your premium subscription data

@@ -204,6 +126,41 @@

### `VoiceService`
### `Airtime`
- `voice.call({ callFrom, callTo })`: Initiate a phone call
- `send({ recipients })`: Send airtime to a bunch of phone numbers.
- `recipients`: An array of objects containing the following keys:
- `phoneNumber`: Recipient of airtime. `REQUIRED`.
- `currencyCode`: 3-digit ISO format currency code. `REQUIRED`.
- `amount`: Amount to charge. `REQUIRED`.
- `maxNumRetry`: This allows you to specify the maximum number of retries in case of failed airtime deliveries due to various reasons such as telco unavailability. The default retry period is 8 hours and retries occur every 60seconds. For example, setting `maxNumRetry=4` means the transaction will be retried every 60seconds for the next 4 hours.`OPTIONAL`.
For more information, please read [https://developers.africastalking.com/docs/airtime/sending](https://developers.africastalking.com/docs/airtime/sending)
### `MobileData`
- `send({ productName, recipients })`
- `productName`: This is the application's product name.
- `recipients`: An array of objects containing the following keys:
- `phoneNumber`: Recipient of the mobile data. `REQUIRED`.
- `quantity`: a numeric value for the amount of mobile data. It is based on the available mobile data package[(see "Bundle Package" column of mobile data pricing)](https://africastalking.com/pricing). `REQUIRED`.
- `unit`: The units for the specified data quantity, the format is: ``MB`` or ``GB``. It is based on the available mobile data package[(see "Bundle Package" column of mobile data pricing)](https://africastalking.com/pricing). `REQUIRED`.
- `validity`: The period of the data bundle’s validity this can be `Day`, `Week`, `BiWeek`, `Month`, or `Quarterly`. It is based on the available mobile data package [(see "Validity" column of mobile data pricing)](https://africastalking.com/pricing). `REQUIRED`.
- `metadata`: A JSON object of any metadata that you would like us to associate with the request. `OPTIONAL`.
- `findTransaction({ transactionId })`: Find a mobile data transaction
- `fetchWalletBalance()`: Fetch a mobile data product balance
For more information, please read the [https://developers.africastalking.com/docs/data/overview](https://developers.africastalking.com/docs/data/overview)
### `Voice`
- `call({ callFrom, callTo })`: Initiate a phone call
- `callFrom`: Your Africa's Talking issued virtual phone number. `REQUIRED`

@@ -214,3 +171,3 @@ - `callTo`: Comma-separated string of phone numbers to call. `REQUIRED`

- `voice.fetchQuedCalls({ phoneNumber })`: Get queued calls
- `fetchQuedCalls({ phoneNumber })`: Get queued calls

@@ -220,3 +177,3 @@ - `phoneNumber`: Your Africa's Talking issued virtual phone number. `REQUIRED`

- `voice.uploadMediaFile({ phoneNumber, url })`: Upload voice media file
- `uploadMediaFile({ phoneNumber, url })`: Upload voice media file

@@ -233,13 +190,17 @@ - `phoneNumber`: Your Africa's Talking issued virtual phone number. `REQUIRED`

### `USSD`
For more information, please read [https://developers.africastalking.com/docs/ussd/overview](https://developers.africastalking.com/docs/ussd/overview)
### `TokenService`
### `Token`
- `generateAuthToken()`: Generate an auth token to use for authentication instead of an API key.
### `USSD`
### `Application`
For more information, please read [https://developers.africastalking.com/docs/ussd/overview](https://developers.africastalking.com/docs/ussd/overview)
- `fetchApplicationData()`: Get app information. e.g. balance
For more information, please read [https://developers.africastalking.com/docs/application](https://developers.africastalking.com/docs/application)

@@ -246,0 +207,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc