Hello, my received middleware receives some facebook messages multiple times (with same timestamp, text, everything). Is there any way to discard message from middleware / don't react to it? Something like return false instead of return $next($message)?
Thank you.
There are multiple ways to ignore an incoming message inside the received middleware.
The easiest way would be to just send a 200 OK response and stop the code execution.
But it should also be possible to just pass $next(false) or $next(null).
I can't return anything else, because I get:
Type error: Argument 1 passed to BotMan\BotMan\Messages\Matcher::isMessageMatching() must be an instance of BotMan\BotMan\Messages\Incoming\IncomingMessage, boolean given, called in /Users/matej.minar/Web/knihozrut/vendor/botman/botman/src/Commands/ConversationManager.php on line 80 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Type error: Argument 1 passed to BotMan\\BotMan\\Messages\\Matcher::isMessageMatching() must be an instance of BotMan\\BotMan\\Messages\\Incoming\\IncomingMessage, boolean given, called in /Users/matej.minar/Web/knihozrut/vendor/botman/botman/src/Commands/ConversationManager.php on line 80 at /Users/matej.minar/Web/knihozrut/vendor/botman/botman/src/Messages/Matcher.php:31)
@matejminar Same problem for me.
Did you find a solution?
Did anyone ever figure this out?
This way from @mpociot is working:
"The easiest way would be to just send a 200 OK response and stop the code execution."
Code is:
http_response_code(200);
die();
Most helpful comment
This way from @mpociot is working:
Code is: