Giter Site home page Giter Site logo

ochiengotieno304 / africastalking-esp8266 Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 23 KB

The unofficial AfricasTalking API Wrapper for ESP8266

License: MIT License

C++ 95.46% C 4.54%
api-wrapper arduino arduino-library communication esp8266 esp8266-library sdk

africastalking-esp8266's Introduction

Africa's Talking ESP8266 Library

Provides convenient access to the Africa's Talking API from esp8266 module written in C++.

Installation

Download the zip package from here.

Manually install the library

Once you get the library, just 3 steps are required before you can use it:

  1. Extract the archive.
  2. Place the library folder in Arduino/libraries/.
  3. Restart the Arduino IDE.

Install from the IDE

In you Arduino IDE got to Sketch > Include Library > Add .ZIP Library and browse to find your .zip archive. Alternatively, in the Arduino library manager search for AfricasTalking library

Usage

The library needs to be instantiated using your username and API key, which you can get from the dashboard.

You can use this library for either production or sandbox apps. For sandbox, the app username is ALWAYS sandbox.

Initialization

In your .ino file:

  #include <AfricasTalking.h>

  static const char *apiKey = "YOUR_API_KEY";
  static const char *username = "YOUR_USERNAME";

  AfricasTalking *AT;
  AT = new AfricasTalking(apiKey, username);

Application

  String appData = AT->applicationData();

Airtime

  String recipients[] = { "{ \"phoneNumber\":\"+254XXXXXXXXX\",\"currencyCode\":\"KES\",\"amount\":\"5\" }" };

  bool success = AT->airtime(recipients);
  • recipients: string array with recipient info REQUIRED
    • phoneNumber: phone number that will be topped up REQUIRED
    • currencyCode: currency code REQUIRED
    • amount: value of airtime to send

SMS

  bool success = AT->sms(toNumber, fromNumber, message);
  • toNumber: message recipient phone number, comma seperated for bulk send REQUIRED
  • fromNumber: Africa's Talking provide short codeREQUIRED
  • message: message to senderREQUIRED

Voice

Make Call

  bool success = AT->voice(fromNumber, toNumber);
  • toNumber: call destination phone number REQUIRED
  • fromNumber: Africa's Talking provide phone number REQUIRED

Payments

Note: Implementing

Development

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ochiengotieno304/africastalking-esp8266/issues.

License

The library is available as open source under the terms of the MIT License.

africastalking-esp8266's People

Contributors

ochiengotieno304 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

keya254

africastalking-esp8266's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.