2
My project consists of a chatbot that receives user information, consults an api created by me with this information, and must present to the user the return of this query. This return is a list of JSON’s. To create the bot, I’m using the framework Botman, and to make the requisitions, the library httpful. My problem is time to present the return to the user, which Botman cannot present.
Function:
public function pega_dados(){
if($this->tipo == 'Produto'){ $aux = 1; }
else { $aux = 2; }
$uri = "localhost:7000/weight/?i=$aux&a=$this->descricao";
$response = \Httpful\Request::get($uri)->send();
$this->say($response->body[0]->id);
}
This return that is not being presented: $this->say($response->body[0]->id);
.
If I just let: $this->say($response->body);
and make a request that generates error in my API, it correctly returns the error. Otherwise, nothing happens and I have no return.
Man, thank you so much! Solved my problem!
– Willian Freitas