A
A
AlevVS2018-05-15 12:06:48
PHP
AlevVS, 2018-05-15 12:06:48

Viber bot how to set response body?

Good afternoon.
I'm on 1C.
I don't understand PHP. The authorities instructed to make a bot for viber.
I do as it is written here Link but easier.
And it just doesn't have what I need. Everything is processed in 1C. Except for the "conversation_started" event. The API documentation says that you need to set the response body in the form of json

{
   "sender":{
      "name":"John McClane",
      "avatar":"http://avatar.example.com"
   },
   "tracking_data":"tracking data",
   "type":"picture",
   "text":"Welcome to our bot!",
   "media":"http://www.images.com/img.jpg",
   "thumbnail":"http://www.images.com/thumb.jpg"
}

Сейчас Вебхук выглядит так:
<?php
$json = file_get_contents('php://input');
$viber = JSON_decode($json);
if ($viber->event == "conversation_started"){
///Как установить тело ответа тут
}
else {
$client = new SoapClient("http://хххххх.ru/audit/ws/хххххх.1cws?wsdl", array('login'=>"хххх",'password' => "ххххх"));
$result = $client->ViberSend(array('MSG'=>$json));
}
?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question