Skip to content

Demo showing how to integrate Africa's Talking APIs (Payments and USSD and SMS ) with IoT

License

Notifications You must be signed in to change notification settings

africastalkingiotltd/kitchensink_web

Repository files navigation

Africa's Talking IoT : Kitchen sink Demo - web

Deploy

Usage

Running Locally

  1. Setup Docker and Docker-Compose for your operating system
  2. Navigate to the ./docker folder and run the followinng command
docker-compose up -d
  1. Navigate back to the root directory of this project and run the following command to install dependencies.

Node V14 needed

yarn install

#or

npm install
  1. Edit the ./.env.example file with your Africa's Talking credenntials as detailed below in the Heroku setup.

Note by default REDIS_URL is redis://127.0.0.1:6379

  1. Rename ./.env.example to .env
  2. Run the app by executing yarn run dev or npm run dev
  3. You can view what's being stored in Redis by navigating to http://localhost:7843 and setting redis host as redis .

Quick-Deploy to Heroku

  1. Create a free Heroku account if you do not have one
  2. Click on Deploy button to bootstrap the app
  3. Give your app a name Set your app name
  4. Under your Heroku Config Vars section add the following variables (see the screen grabs below for more info):
    • APPLICATION_USERNAME : Your IoT Application username
    • DEVICE_GROUP : The device group you want to authenticate to
    • DEVICE_PASS : The password assigned to the device group
    • SERVO_TOPIC : The topic to which the IoT device is listening to for servo motor control. Example if your base topic is coolguy/devicegroup/# and the IoT device is listening for servo motor control command at coolguy/devicegroup/servo then this value should be servo.
    • LED_TOPIC : Same as above but for LED control
    • AT_USERNAME: Preferrably sandbox
    • AT_APIKEY : Your sandbox API KEY
    • IOT_APIKEY: Your live application API KEY Configure environment variables

Note : If you need to modify them later see below screen grabs on where to get them Where to get environement variables Setting up environement variables Your application URL is under the "Domains" section. Should read https://<appname>.herokuapp.com/ Getting your app URL

  1. Once you're done, click on the "Deploy App" button Deploy App

Setup Africa's Talking Account

USSD (Sandbox)

  1. In your Sandbox account, navigate to the USSD blade and click on "Create Channel" Sandbox main page
  2. In the channel creation form, add an USSD shortcode number, and in the callback URL field add the your app URL and append ussd. Example if your Heroku app url in 4 above is https://mycoolapp.herokuapp.com/ then your USSD callback should be https://mycoolapp.herokuapp.com/ussd. Creating a channel and adding callback URL
  3. Save and in the end you should have something like shown on the screen grab below USSD Short codes Sandbox View

IoT (Live)

  1. Inside your AT IoT account, Click on the ... under the Actions tab for the device group you'd like to configure the callback for and update the callback URL to iot. Example if your Heroku app url above is https://mycoolapp.herokuapp.com/ then your IoT callback should be https://mycoolapp.herokuapp.com/iot. Update IoT Device Group Callback

The Simulator (Sandbox)

  1. Navigate to the AT Sandbox Simulator page. Enter a valid phone number.
  2. Click on the USSD option Main Sandbox app
  3. Dial your USSD code. If your short code above was 1000, enter *384*1000# and press the Call button for magic! Dial USSD shortcode

Contributing

About

Demo showing how to integrate Africa's Talking APIs (Payments and USSD and SMS ) with IoT

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published