Answer the question
In order to leave comments, you need to log in
How do I remove the message status notification?
It turns out there is a store on Opencart, in it, on the success page, I added the functions:
function sendReq($data)
{
$request_data = json_encode($data);
$ch = curl_init("https://chatapi.viber.com/pa/send_message");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if($err) {return $err;}
else {return $response;}
}
function sendMsg($sender_id, $text, $type, $tracking_data = Null, $arr_asoc = Null)
{
global $auth_token, $send_name;
$auth_token = 'авыавы1';
$send_name = 'авыавы';
$data['auth_token'] = $auth_token;
$data['receiver'] = $sender_id;
if($text != Null) {$data['text'] = $text;}
$data['type'] = $type;
$data['sender']['name'] = $send_name;
if($tracking_data != Null) {$data['tracking_data'] = $tracking_data;}
if($arr_asoc != Null)
{
foreach($arr_asoc as $key => $val) {$data[$key] = $val;}
}
return sendReq($data);
}
function sendMsgText($sender_id, $text, $tracking_data = Null)
{
return sendMsg($sender_id, $text, "text", $tracking_data);
}
Answer the question
In order to leave comments, you need to log in
else {return $response;}
returns you the answer and prints it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question