All Projects → pindoio → pindo-cli

pindoio / pindo-cli

Licence: MIT license
A simple Command Line Interface that allows you to authenticate with the Pindo API.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pindo-cli

sms
Simple SMS Gateway Package for sending short text messages from your Application. Facade for Laravel 5(Updated to work with Laravel 5.5).Currently supported Gateways Clickatell, MVaayoo, Gupshup, SmsAchariya, SmsCountry, SmsLane, Nexmo, Mocker / Any HTTP/s based Gateways are supported by Custom Gateway. Log gateway can be used for testing.
Stars: ✭ 41 (+28.13%)
Mutual labels:  sms-api, sms-messages, sms-gateway
sms blitz
Send SMS messages through multiple different providers
Stars: ✭ 29 (-9.37%)
Mutual labels:  sms-api, sms-messages
messages-web
📱 SMS gateway using your own phone!
Stars: ✭ 34 (+6.25%)
Mutual labels:  sms-api, sms-gateway
jasmin-web-panel
📨 Jasmin Web Panel for Jasmin SMS Gateway
Stars: ✭ 33 (+3.13%)
Mutual labels:  sms-api, sms-gateway
Redoc
📘 OpenAPI/Swagger-generated API Reference Documentation
Stars: ✭ 15,935 (+49696.88%)
Mutual labels:  api-documentation
Api Generator
Api Generator是一款可以自动解析Controller类抽取REST接口信息并自动上传YApi的IDEA插件。YApi好伴侣,从此维护文档再也不是事儿了!
Stars: ✭ 139 (+334.38%)
Mutual labels:  api-documentation
Angular Swagger Ui
An angularJS implementation of Swagger UI
Stars: ✭ 131 (+309.38%)
Mutual labels:  api-documentation
Class Validator Jsonschema
Convert class-validator-decorated classes into JSON schema
Stars: ✭ 118 (+268.75%)
Mutual labels:  api-documentation
apidoc-template
A cleaner and beautiful template for apiDoc
Stars: ✭ 46 (+43.75%)
Mutual labels:  api-documentation
Yii2 Apidoc
Yii 2 apidoc extension.
Stars: ✭ 236 (+637.5%)
Mutual labels:  api-documentation
Nei
NEI 接口管理平台 源代码
Stars: ✭ 198 (+518.75%)
Mutual labels:  api-documentation
Documentation Starter
Interactive REST API Documentation
Stars: ✭ 156 (+387.5%)
Mutual labels:  api-documentation
Eolinker Api Management 2.x For Php
全球领先API接口管理平台,2.x开源稳定版
Stars: ✭ 211 (+559.38%)
Mutual labels:  api-documentation
Awesome Documentation Tools
🔥 📚 All the tools, processes and resources you need to create an awesome API & Project documentation
Stars: ✭ 138 (+331.25%)
Mutual labels:  api-documentation
hapi-docs
Beautiful API documentation generator for Hapi using Vue
Stars: ✭ 64 (+100%)
Mutual labels:  api-documentation
Robinhood
Unofficial Documentation of Robinhood Trade's Private API
Stars: ✭ 1,569 (+4803.13%)
Mutual labels:  api-documentation
Json Schema Spec
The JSON Schema I-D sources
Stars: ✭ 2,441 (+7528.13%)
Mutual labels:  api-documentation
Flasgger
Easy OpenAPI specs and Swagger UI for your Flask API
Stars: ✭ 2,825 (+8728.13%)
Mutual labels:  api-documentation
Smogcloud
Find cloud assets that no one wants exposed 🔎 ☁️
Stars: ✭ 168 (+425%)
Mutual labels:  api-documentation
Json Schema To Openapi Schema
A little NodeJS package to convert JSON Schema to OpenAPI Schema Objects
Stars: ✭ 168 (+425%)
Mutual labels:  api-documentation

pindo-cli

Tests fury pipy

Installation

Install from PyPi using pip, a package manager for Python.

pip install pindo-cli

Don't have pip installed? Try installing it, by running this from the command line:

$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

python setup.py install

You may need to run the above commands with sudo.

Getting Started

Once you have installed Pindo CLI you're ready to go.

pindo --help
Usage: pindo [OPTIONS] COMMAND [ARGS]...

Pindo CLI
	
A simple Command Line Interface that allows you to authenticate with the Pindo API
	
https://www.pindo.io

Options:
  --debug / --no-debug
  -v, --version         Show the version and exit.
  --help                Show this message and exit.

Commands:
  balance        Get account balance
  org            Organization
  refresh-token  Refresh a Token.
  register       Create a new Pindo account.
  sms            Send a test message
  token          Request a token for using Pindo API.
  • Send a test message
pindo sms --help
Usage: pindo sms [OPTIONS]

  Send a test message

Options:
  --token TEXT   API Token
  --to TEXT      Receiver phone number (+250xxxxxx)
  --text TEXT    Message to send
  --sender TEXT  Sender name
  --help         Show this message and exit.

API Response Code

Code Text Meaning
201 sent Successfully sent
401 unauthorized unauthorized access
404 not found invalid resource URI
409 conflict number is from unsupported country
409 conflict number is from unsupported telco
409 conflict Wrong phone number format
  • An example of a successfully sent SMS.
{
    "count": 1,
    "remaining_balance": 3.11,
	"sms_id":"1058918",
    "self_url": "https://api.pindo.io/v1/sms/1058918",
    "sms_items": [
        {
            "id": 1062502,
            "item_price": 0.01,
            "network": "63510",
            "remaining_balance": 3.11,
            "status": "sent",
            "to": "+250785000000"
        }
    ]
}
  • Pindo Delivery Report (DLR) Webhook Event example POST methods
{
    "status": "DELIVRD",
    "sms_id": 1058918,
    "modified_at": "24-07-2020, 23:35:32",
    "retries_count": 0
}

SMS API Usage

The pindo api needs your Token. You can either pass the token directly to the constructor (see the code below) or via environment variables.

# cURL

curl -X POST \
https://api.pindo.io/v1/sms/ \
-H 'Accept: */*' \
-H 'Authorization: Bearer your-token' \
-H 'Content-Type: application/json' \
-d '{
"to" : "+250781234567",
"text" : "Hello from Pindo",
"sender" : "Pindo"
}'
# python

import requests

token='your-token'
headers = {'Authorization': 'Bearer ' + token}
data = {'to' : '+250781234567', 'text' : 'Hello from Pindo', 'sender' : 'Pindo'}

url = 'https://api.pindo.io/v1/sms/'
response = requests.post(url, json=data, headers=headers)
print(response)
print(response.json())
// NodeJS

var request = require("request");
data = { to: "+250781234567", text: "Hello from Pindo", sender: "Pindo" };

var options = {
  method: "POST",
  body: data,
  json: true,
  url: "https://api.pindo.io/v1/sms/",
  headers: {
    Authorization: "Bearer your-token"
  }
};

function callback(error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body);
  }
}
//call the request

request(options, callback);
// Java

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{"to" : "+250781234567", "text" : "Hello from Pindo","sender" : "Pindo"}");
Request request = new Request.Builder()
.url("https://api.pindo.io/v1/sms/")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer your-token")
.build();
Response response = client.newCall(request).execute();
// PHP

$request = new HttpRequest();
$request->setUrl('https://api.pindo.io/v1/sms/');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
'Authorization' => 'Bearer your-token',
'Content-Type' => 'application/json'
));

$request->setBody('{
"to" : "+250781234567",
"text" : "Hello from Pindo",
"sender" : "Pindo"
}');

try {
$response = $request->send();

echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}

// cURL

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pindo.io/v1/sms/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\n\t\"to\" : \"+250781234567\",\n\t\"text\" : \"Test SMS.\",\n\t\"sender\" : \"Pindo\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer token",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
// GO

package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.pindo.io/v1/sms/"

payload := strings.NewReader("{"to" : "+250781234567", "text" : "Hello from Pindo","sender" : "Pindo"}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer your-token")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

}
// C#

var client = new RestClient("https://api.pindo.io/v1/sms/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer your-token");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\n\t\"to\" : \"+250781234567\", \n\t\"text\" : \"Hello from Pindo\",\n\t\"sender\" : \"Pindo\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
# ruby

require 'net/http'
require 'json'
require 'uri'

data = { to: '+250781234567', text: 'Hello from Pindo', sender: 'Pindo' };

uri = URI('https://api.pindo.io/v1/sms/')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer your-token'
req['Content-Type'] = 'application/json'
req.body = data.to_json
http.request(req)
// Dart

import 'dart:convert';
import 'package:http/http.dart' as http;

Future main() async {
  String url = 'https://api.pindo.io/v1/sms/';
  Map<String, String> data = {
    'to': '+250781234567',
    'text': 'Hello from Pindo',
    'sender': 'Pindo'
  };

  Map<String, String> headers = {
    'Authorization': 'Bearer your-token',
    'Content-Type': 'application/json'
  };

  http.Response response = await http.post(
    url,
    body: jsonEncode(data),
    headers: headers,
  );
  print(response.statusCode);
  print(jsonDecode(response.body));
}

Inbound SMS API Usage

Pindo Inbound messaging allows you to have two-way SMS communication. By quickly setting up a Webhook URL in Pindo's dashboard, you will receive any event on your configured short or long code.

  • Pindo Inbound Webhook Event example POST methods
{
    "from": "+25078123456",
    "to": "7878",
    "created_at": "24-07-2020, 23:35:32",
    "sms_id": 1058918,
    "text": "Hello from Pindo",
    "telco": "MTN"
}
  • List All Inbound SMS
{
   "inbound_sms":[
      {
         "account_id":11783,
         "conversation_id":null,
         "created_at":"2022-08-05T12:32:42.196907",
         "id":20,
         "id_smsc":null,
         "inbound_sms_number":"+250781113333",
         "language_id":null,
         "telco_id":null,
         "text":"Hello world !"
      }
   ],
   "pages":{
      "first_url":"http://api.pindo.io/v1/sms/inbounds?page=1&per_page=20",
      "last_url":"http://api.pindo.io/v1/sms/inbounds?page=1&per_page=20",
      "next_url":null,
      "page":1,
      "pages":1,
      "per_page":20,
      "prev_url":null,
      "total":20
   }
}

Verify API Usage

PindoVerfiy API lets you send a PIN to a user's phone and validate that they received it. PindoVerfiy can be used for a number of authentication and anti-fraud purposes, such as 2-factor authentication, password-less sign-in, and validating users’ phone numbers.

  • An example of a successfully generated PIN.
{
    "message": "success",
    "network": "63510",
    "remaining_balance": 487.49,
    "request_id": 4
}
  • An example of a successfully verified PIN.
{
    "message": "success",
    "remaining_balance": 487.49,
    "request_id": 4
}
  • Generate a PIN.
# python

import requests
import json

url = "https://api.pindo.io/v1/verify"

payload = json.dumps({
  "brand": "Pindo",
  "number": "+250781234567"
})
headers = {
  'Authorization': 'Bearer your-token',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.json())
// NodeJS

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.pindo.io/v1/verify',
  'headers': {
    'Authorization': 'Bearer your-token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "brand": "Pindo",
    "number": "+250781234567"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
// Java

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"brand\":\"Pindo\",\n    \"number\":\"+250781234567\"\n}\n");
Request request = new Request.Builder()
  .url("https://api.pindo.io/v1/verify")
  .method("POST", body)
  .addHeader("Authorization", "Bearer your-token")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
// PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.pindo.io/v1/verify',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "brand":"Pindo",
    "number":"+250781234567"
}
',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer your-token',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
  • Verify a PIN
// NodeJS

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.pindo.io/v1/verify/check',
  'headers': {
    'Authorization': 'Bearer your-token',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "code": "752623",
    "request_id": 4
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
  • Check PIN status
// NodeJS 

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.pindo.io/v1/verify/status/:request_id',
  'headers': {
    'Authorization': 'Bearer your-token'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
  • Cancel a PIN
// NodeJS

var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://api.pindo.io/v1/verify/cancel/:request_id',
  'headers': {
    'Authorization': 'Bearer your-token'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].