01. Register in kookoo

Link : http://www.kookoo.in

Register your account from above link, and fill all the details.

02. Get your authentication details

Login with your username and password,
and Go to http://www.kookoo.in/index.php/dashboardv2 page.

Get your API Key, this credentials will required in your REST API.

03. Text to Speech API

Now using IndianTTS Text to Speech API and convert your text to audio format, refer bellow screen shot for TEXT to Speech API

function ttsCall(<Your Text>, cb){
 msg = msg.substr(0,360)
 var options = {
 "method": "GET",
 "hostname": <TTS API HOST>,
 "port": <TTS API PORT>,
 "path": "/tts?
 };
 console.log("options---",options)
 var TTSreq = http.request(options, function (TTSres) {
 var chunks = [];
 TTSres.on("data", function (chunk) {
 chunks.push(chunk);
 });
 TTSres.on('error', function (e) {
 console.log("EROOR in TTSres : ", e); 
 TTSreq.abort();
 cb(null);
 });
 TTSres.on("end", function () {
 var body = Buffer.concat(chunks).toString();
 console.log("body---",body)
 cb(body) 
 });
 });
 TTSreq.on('error', function (e) {
 console.log("EROOR in TTSreq : ", e);
 TTSreq.abort();
 cb(null);
 });
 
 TTSreq.setTimeout(60000, function () {
 TTSreq.abort();
 cb(null);
 })
 TTSreq.end(); 
};

04. Integrate kookoo API code 

Audio URL (which is return from TTS) integrate with kookoo API code, code is bellow

var options = {
 "method": "GET",
 "hostname": "www.kookoo.in",
 "path": encodeURI("/outbound/outbound.php?phone_no="+ mobile +
 "&api_key=<APIKEY>&outbound_version=2&extra_data=<response><playaudio>"
 +filePath+"</playaudio></response>")
 };
var req = http.request(options, function (res) {
 var chunks = [];
 res.on("data", function (chunk) {
 chunks.push(chunk);
 });
 res.on("end", function () {
 var body = Buffer.concat(chunks);
 body = body.toString(); 
 });
});
req.end();

05. Log Entry Provide by KooKoo


kookoo.

Share this: