System interaction plugin with smartplug
We provide a base code that each company can adapt to connect Freschat, through smartplug, to the system.
Variables you need to load and replace:
- CountryCode: With the code for each country, so that we can obtain the phone number of the person who writes, for Argentina use 549, for Spain 34, Mexico 52
- endpoint: API URL, depending on where your system is located, the URLs are here: <https://docs-ispkeeper.anatod.com/reference/inicio>
- key: The API key of your system, if you don't have it, request it from [email protected]
- SystemURL: The URL that the link uses to get the direct link. Ex: https://testing.ispkeeper.com
Payment Methods Link
Additionally, you can upload direct payment links with different methods, concatenating the client ID:
- Mercapago: https://clientes.SUEMPRESA.com/mercado-pago/ID_DE_CLIENTE
- Siro: https://clientes.SUEMPRESA.com/siro/ID_DE_CLIENTE
- Redsys: https://clientes.SUEMPRESA.COM/redsys/ID_DE_CLIENTE
- Pagoralia: https://clientes.SUEMPRESA.com/pagoralia/ID_DE_CLIENTE
Demo code of the system
<!DOCTYPE html>
<!--
anatod ®
-->
<html>
<head>
<title>anatod</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<p>anatod ®</p>
<h5><span id='anatod_cliente'>Client: [searching...]</span></h5>
<h5><span id='anatod_dni'>DNI: [searching...]</span></h5>
<h5><span id='anatod_domicilio'>Address: [searching...]</span></h5>
<h5><span id='anatod_saldo'>Balance: [searching...]</span></h5>
<h5><a id="anatod_link" href='#' target="_blank">View in system</a></h5>
<script>
var makeRequest = function() {
let codigoPais=""; //549 PARA ARGENTINA, 34 ESPAÑA ...
let endpoint=""; //SEGUN SERVIDOR https://docs.ispkeeper.com/reference/inicio
let key=""; //KEY DEL API
let urlSistema=''; // EJ: https://testing.ispkeeper.com
let phone = $('.phone-field').text().trim();
let cleanedString = decodeURIComponent(phone);
let regex = new RegExp(codigoPais + ".*");
let telefonoClean = cleanedString.match(regex)[0];
let telefono = telefonoClean.replace(codigoPais, "").trim();
const settings = {
url: endpoint+'/clientes?q='+telefono,
method: 'GET',
headers: {
accept: 'application/json',
'x-api-key': key
}
};
$.ajax(settings).done(function (response) {
var data=response.data[0];
$('#anatod_cliente').text('(' + data.cliente_id + ') '+data.cliente_apellido + ' ' + data.cliente_nombre);
$('#anatod_saldo').text('Saldo: ' + data.cliente_saldo);
$('#anatod_dni').text('DNI: ' + data.cliente_dnicuit);
$('#anatod_domicilio').text('Domicilio: ' + data.cliente_domicilioreal);
$('#anatod_link').attr('href', urlSistema+'/clientes/ver/'+data.cliente_id);
});
};
makeRequest();
</script>
</body>
</html>