botman / botman

A framework agnostic PHP library to build chat bots
https://botman.io
MIT License
6.07k stars 812 forks source link

Facebook - Dialogflow. Not responding when attach images #766

Closed jrafaelborja closed 2 years ago

jrafaelborja commented 6 years ago

Description:

Using Facebook Messenger with DialogFlow, after the chatbot sends any image stops conversation. Chatbot works fine hearing and sending text, but when send images stop conversation.

Steps To Reproduce:

use BotMan\BotMan\Middleware\ApiAi; use BotMan\BotMan\Messages\Attachments\Image; use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;

$botman = resolve('botman'); $dialogflow = ApiAi::create('xxxxxxxxxx11111111111xxxxxxxxxx')->listenForAction(); $botman->middleware->received($dialogflow);

$botman->hears('.*', function ($bot) { $extras = $bot->getMessage()->getExtras(); $apiReply = $extras['apiReply']; $bot->reply($apiReply); // ADDING THIS TWO BELOW LINES CHATBOT STOPS RESPONDING $message = OutgoingMessage::create('Here is a nice image')->withAttachment(Image::url('https://www.mydomain.com/images/pic.jpg')); $bot->reply($message); })->middleware($dialogflow);

slashequip commented 6 years ago

Is it sending the image or just no response?

From my experience if there is no response at all its down to an uncaught error, anything in the error logs?

jrafaelborja commented 6 years ago

Yes, the chatbot sends the image, it is ok, but when the user make a new question just after the image shows, the chatbot stops

gdpsysgarage commented 6 years ago

It seems that when you use Botman and DialogFlow as your logic, the image attached on Facebook didnt trigger any intent. I was having the same issue

LeonanCarvalho commented 5 years ago

Any work around for it?