Created
July 27, 2018 14:09
-
-
Save roramirez/8ca01f70691c47fb51c578fe4656e7e2 to your computer and use it in GitHub Desktop.
API Clickfono Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Ejemplo para el utilizar el API Clickfono usando Node.js | |
*/ | |
var request = require('request'); | |
urlAPI = 'https://clickandtalk.medularis.com/calls/manage/api'; | |
/* | |
* Data para enviar mediante POST al API segun documentacion | |
* https://help.clickfono.com/article/6-uso-api-clickfono | |
* En el siguiente ejemplo usamos para llamar a un celular en Chile | |
* +56974766123 | |
*/ | |
var parameters = { | |
"popup_uuid": "MIPOPUP-UUID", | |
"phonenumber": "74766123", | |
"areacode": "9", | |
"country_code": "56", | |
"security_token": "MI_TOKEN", // https://help.clickfono.com/article/25-generacion-de-securitytoken | |
"adicional": { | |
"Nombre": "MI Nombre", | |
"Email": "11.111.111-1" | |
}, | |
}; | |
request({ | |
url: urlAPI, | |
json: parameters, | |
method: 'POST', // Usando Post | |
}, function(error, response, result) { | |
// en result obtienes la respuesta del API | |
// podrias obtener un resultado como | |
// {"success":true,"uuid":"uuid-de-la-llamada"} | |
// Con este uuid puedes obtener en tiempo real su estado | |
// https://help.clickfono.com/article/24-estados-de-las-llamadas-api | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment