Oracle Service Cloud RightNow CX PHP Connect API write to Custom Business Object example Custom Controller

url: /cc/GSChatLog/createChatLog


<?php

namespace Custom\Controllers;

/************* Agent Authentication ***************/
require_once( get_cfg_var("doc_root")."/ConnectPHP/Connect_init.php" );
initConnectAPI();
use RightNow\Connect\v1_2 as RNCPHP;

class GSChatLog extends \RightNow\Controllers\Base
{

function __construct()
{
parent::__construct();
}

public function createChatLog() {

try{
\RightNow\Libraries\AbuseDetection::check();

$email = $_POST['email'];
$cID = (int)$_POST['countryID'];
$languageID = (int)$_POST['langID'];
$name = $_POST['name'];
$referrerUrl = $_POST['referrerUrl'];
$siteID = $_POST["siteID"];
$platformID = $_POST["platformID"];
$chatStatus = $_POST["chatStatus"];
$chatID = $_POST["chatID"];
$lob = strtoupper($_POST["lob"]);

$log = new RNCPHP\ContactUs\chat_log();
$log->chat_id = $chatID;
$log->chat_log_status = $chatStatus;
$log->site_id = $siteID;
$log->chat_group = 2156;
$log->referring_url = $referrerUrl;
$log->interface = $platformID;
$log->email_address = $email;
$log->name = $name;
$log->language_id = $languageID;
$log->country_id = $cID;
$log->lob_id = $lob;
$log->save();

catch (Exception $err ){
echo $err->getMessage();
}
}
}
?>

Leave a Reply

You must be logged in to post a comment.