Package: pindo-cli
pindo-cliInstallationInstall from PyPi usingpip, a package manager for Python.pip install pindo-cliDon'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 | pythonpython setup.py installYou may need to run the above commands withsudo.Getting StartedOnce you have installedPindo CLIyou're ready to go.pindo--helpUsage:pindo[OPTIONS]COMMAND[ARGS]...

PindoCLIAsimpleCommandLineInterfacethatallowsyoutoauthenticatewiththePindoAPIhttps://www.pindo.io

Options:--debug/--no-debug-v,--versionShowtheversionandexit.--helpShowthismessageandexit.

Commands:balanceGetaccountbalanceorgOrganizationrefresh-tokenRefreshaToken.registerCreateanewPindoaccount.smsSendatestmessagetokenRequestatokenforusingPindoAPI.Send a test messagepindosms--helpUsage:pindosms[OPTIONS]Sendatestmessage

Options:--tokenTEXTAPIToken--toTEXTReceiverphonenumber(+250xxxxxx)--textTEXTMessagetosend--senderTEXTSendername--helpShowthismessageandexit.API Response CodeCodeTextMeaning201sentSuccessfully sent401unauthorizedunauthorized access404not foundinvalid resource URI409conflictnumber is from unsupported country409conflictnumber is from unsupported telco409conflictWrong phone number formatAn 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 Webhook Event examplePOSTmethods{"status":"DELIVRD","sms_id":1058918,"modified_at":"24-07-2020, 23:35:32","retries_count":0}SMS API UsageThepindo apineeds your Token. You can either pass the token directly to the constructor (see the code below) or via environment variables.# cURLcurl-XPOST\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"}'# pythonimportrequeststoken='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())// NodeJSvarrequest=require("request");data={to:"+250781234567",text:"Hello from Pindo",sender:"Pindo"};varoptions={method:"POST",body:data,json:true,url:"https://api.pindo.io/v1/sms/",headers:{Authorization:"Bearer your-token"}};functioncallback(error,response,body){if(!error&&response.statusCode==200){console.log(body);}}//call the requestrequest(options,callback);// JavaOkHttpClientclient=newOkHttpClient();MediaTypemediaType=MediaType.parse("application/json");RequestBodybody=RequestBody.create(mediaType,"{"to" : "+250781234567", "text" : "HellofromPindo","sender" : "Pindo"}");Requestrequest=newRequest.Builder().url("https://api.pindo.io/v1/sms/").post(body).addHeader("Content-Type","application/json").addHeader("Authorization","Bearer your-token").build();Responseresponse=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;// GOpackagemainimport("fmt""strings""net/http""io/ioutil")funcmain(){url:="https://api.pindo.io/v1/sms/"payload:=strings.NewReader("{"to" : "+250781234567", "text" : "HellofromPindo","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)deferres.Body.Close()body,_:=ioutil.ReadAll(res.Body)fmt.Println(res)fmt.Println(string(body))}// C#varclient=newRestClient("https://api.pindo.io/v1/sms/");varrequest=newRestRequest(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);IRestResponseresponse=client.Execute(request);# rubyrequire'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_jsonhttp.request(req)// Dartimport'dart:convert';import'package:http/http.dart'ashttp;Futuremain()async{Stringurl='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.Responseresponse=awaithttp.post(url,body:jsonEncode(data),headers:headers,);print(response.statusCode);print(jsonDecode(response.body));}Verify API UsagePindoVerfiyAPI 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.# pythonimportrequestsimportjsonurl="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())// NodeJSvarrequest=require('request');varoptions={'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)thrownewError(error);console.log(response.body);});// JavaOkHttpClientclient=newOkHttpClient().newBuilder().build();MediaTypemediaType=MediaType.parse("application/json");RequestBodybody=RequestBody.create(mediaType,"{\n    \"brand\":\"Pindo\",\n    \"number\":\"+250781234567\"\n}\n");Requestrequest=newRequest.Builder().url("https://api.pindo.io/v1/verify").method("POST",body).addHeader("Authorization","Bearer your-token").addHeader("Content-Type","application/json").build();Responseresponse=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// NodeJSvarrequest=require('request');varoptions={'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)thrownewError(error);console.log(response.body);});Check PIN status// NodeJSvarrequest=require('request');varoptions={'method':'GET','url':'https://api.pindo.io/v1/verify/status/:request_id','headers':{'Authorization':'Bearer your-token'}};request(options,function(error,response){if(error)thrownewError(error);console.log(response.body);});Cancel a PIN// NodeJSvarrequest=require('request');varoptions={'method':'PUT','url':'https://api.pindo.io/v1/verify/cancel/:request_id','headers':{'Authorization':'Bearer your-token'}};request(options,function(error,response){if(error)thrownewError(error);console.log(response.body);});