Closed webappbuilder closed 7 years ago
Hi
if you want to sending replies via queue, I think you have to create a job and chatbot class.
namespace App;
use Casperlaitw\LaravelFbMessenger\Contracts\BaseHandler;
class Chatbot extends BaseHandler
{
public function __construct()
{
$this->createBot(config('fb-messenger.app_token'));
}
/**
* Handle the chatbot message
*
* @param ReceiveMessage $message
*
* @return mixed
*/
public function handle(ReceiveMessage $message)
{
return false;
}
}
then you can use chatbot to send message. like this.
use Casperlaitw\LaravelFbMessenger\Messages\Text;
use App\Chatbot;
$chatbot = new Chatbot;
$text = new Text($senderId, 'Text');
$chatbot->send($text);
Hi @webappbuilder, is it solved?
Hi, thank you. I solved this earlier. I understand how to use queues with laravel. But I have to write custom send function for Jobs: `$api = new Bot(config("fb-messenger.app_token"));
$api->setSecret(config("fb-messenger.app_secret"));
$api->setDebug(null);` because of debug uses request class.
Hi
if you don't need to debug, you don't call $api->setDebug(null);
if you didn't setup debug, bot will ignore call debug function
Okay, i got it. Thanks. I mean I can't use plugin with debug turned on in config within console command or queue. You can close issue if it's proper functionality.
I get an error: 'Parameter error: You cannot send messages to this id'. Please help me
@letanhienth92 Can you provide more specific issue you get? some code and some logs.
I can't get any hint from your error message.
Thanks
Hello! Please provide example how to implement sending replies via queue?