我想将我的Joomla网站的用户整合到sugarcrm面板中。我正在使用SuiteCRM版本7.7.6 [Sugar Version 6.5.24(Build 509)]并尝试通过钩子将用户的csv文件导入到sugarcrm的联系人列表中。 意味着我想在Joomla和Sugarcrm站点之间构建自动集成功能。当新用户在Joomla网站上注册时,它们应该自动添加到crm面板的联系人列表中。
有没有可能的方法来实现这种集成?
答案 0 :(得分:1)
我有一个解决方案,通过Rest API将记录集成到sugarcrm的特定模块中。
API代码:
$url = "http://{site_url}/service/v4_1/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
$curl_reque**strong text**st = curl_init();
curl_setopt($curl_request, CURLOPT_URL, $url);
curl_setopt($curl_request, CURLOPT_POST, 1);
curl_setopt($curl_request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($curl_request, CURLOPT_HEADER, 1);
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_request, CURLOPT_FOLLOWLOCATION, 0);
$jsonEncodedData = json_encode($parameters);
$post = array(
"method" => $method,
"input_type" => "JSON",
"response_type" => "JSON",
"rest_data" => $jsonEncodedData
);
curl_setopt($curl_request, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($curl_request);
curl_close($curl_request);
$result = explode("\r\n\r\n", $result, 2);
$response = json_decode($result[1]);
ob_end_flush();
return $response;
}
//login --------------------------------------------
$login_parameters = array(
"user_auth" => array(
"user_name" => $username,
"password" => md5($password),
"version" => "1"
),
"application_name" => "RestTest",
"name_value_list" => array(),
);
$login_result = call("login", $login_parameters, $url);
/*
echo "<pre>";
print_r($login_result);
echo "</pre>";
*/
//get session id
$session_id = $login_result->id;
//create contacts ------------------------------------
$set_entries_parameters = array(
//session id
"session" => $session_id,
//The name of the module from which to retrieve records.
"module_name" => "Contacts",
//Record attributes
"name_value_list" => array(
array(
//to update a record, you will nee to pass in a record id as commented below
//array("name" => "id", "value" => "912e58c0-73e9-9cb6-c84e-4ff34d62620e"),
array("name" => "first_name", "value" => "John"),
array("name" => "last_name", "value" => "Smith"),
),
array(
//to update a record, you will nee to pass in a record id as commented below
//array("name" => "id", "value" => "99d6ddfd-7d52-d45b-eba8-4ff34d684964"),
array("name" => "first_name", "value" => "Jane"),
array("name" => "last_name", "value" => "Doe"),
),
),
);
$set_entries_result = call("set_entries", $set_entries_parameters, $url);
echo "<pre>";
print_r($set_entries_result);
echo "</pre>";
答案 1 :(得分:0)
是的,虽然在钩子里做不可行,但是有可能。
如果您需要多次导入CSV,为导入实施调度程序作业可能是个好主意。
但实际上你根本不能使用CSV,而是让Joomla或中间脚本使用你的CRM的REST API以实时或你选择的时间间隔将数据推送到糖。