Hola,
puedes utilizar la API de LimeSurvey.
[url]
www.limesurvey.org/manual/RemoteControl_2_API
[/url]
y
[url]
api.limesurvey.org/classes/remotecontrol_handle.html
[/url]
Aquí hay un pequeño ejemplo en php para agregar participantes y generar un token.
Code:
<?php
require_once 'jsonrpcphp/JsonRPCClient.php';
define( 'LS_BASEURL', 'https://www.myServer.de/limesurvey'); // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'username' );
define( 'LS_PASSWORD', 'password' );
$myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );
// receive session key
$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
if(is_array($sessionKey))
{
header("Content-type: application/json");
echo json_encode($sessionKey);
die();
}
// Here I use GET parameters
$survey_id = $_GET['SID'];
$firstName = $_GET['NOMBRE'];
$lastName = $_GET['APELLIDO'];
$email = $_GET['EMAIL'];
$atokenParams = array("email"=>$email,"lastname"=>$lastName,"firstname"=>$firstName,"token"=>$token,"emailstatus"=>"OK");
$aParticipantData=array($atokenParams);
$bCreateToken = true;
// Create the token in survey
$newToken = $myJSONRPCClient->add_participants( $sessionKey, $survey_id, $aParticipantData, $bCreateToken);
// If token successfully created, redirect to survey
if(isset($newToken[0]['tid']) AND isset($newToken[0]['token'])) {
$link='www.myServer.de/limesurvey/index.php/'.$survey_id.'?token='.$newtoken[0]['token'];
// Here you may send the link to the participant
}
// Otherwise, display errors
else if (isset($newToken['status'])) {
echo $newToken['status'];
}
else {
echo '<br />';
echo 'Error: '.$newToken[0]['errors']['token'][0];
}
// release the session key
$myJSONRPCClient->release_session_key( $sessionKey );
?>
El CRM debe iniciar este script con cada nuevo contacto.
Debe transferir los datos necesarios (nombre, apellido, correo electrónico).
El script agrega el participante, genera el token y luego también puede invitar el participante. (por ejemplo, con phpMailer)
Joffm