SnatchBot Support

Welcome to SnatchBot Support. You'll find comprehensive guides and documentation to help you start working with SnatchBot as quickly as possible, as well as support if you get stuck. Let's jump right in!

Please note that the community forum is not a helpdesk.
ProPlan users, remember you can raise a ticket from your dashboard.

Get Started    SNATCHBOT API

Questions

Ask A Question
11
ANSWERED

Webhook is not receiving User input

My Webook is not retrieving the users input. Only the Bots input. $requestBody = file_get_contents('php://input'); $requestBodyJson = json_decode($requestBody,true); $file = '/srv/uk-debtcollection.com/public/htdocs/chat'; $current = file_get_contents($file); $current .= "*****START*****\n"; foreach($requestBodyJson as $key => $value) { if(is_array($value)) { foreach($value as $k => $v) { $current .= "POST Arr parameter '$k' has '$v'\n"; file_put_contents($file, $current); } } else { $current .= "POST parameter '$key' has '$value'\n"; file_put_contents($file, $current); } } $current .= "*****END*****\n"; file_put_contents($file, $current); This is my code. This is the result when the User types something: *****START***** POST parameter 'bot_id' has '51530' POST Arr parameter 'channel' has 'webchat' POST Arr parameter 'from' has 'TestBot' POST Arr parameter 'message' has 'OK thank you for confirming that ::next:: May I please by take your name?' POST Arr parameter 'module_id' has '770105' POST parameter 'session_id' has '2812762' POST parameter 'source' has 'bot' *****END***** *****START***** POST parameter 'bot_id' has '51530' POST Arr parameter 'channel' has 'webchat' POST Arr parameter 'from' has 'user.15a1051c120d7fa1.pBFTPCdb' POST Arr parameter 'message' has '' POST Arr parameter 'module_id' has '770105' POST parameter 'session_id' has '2812762' POST parameter 'source' has 'bot' *****END***** As you can see there is no message in the second set, this is the users response. Please confirm what im doing wrong.

Posted by Daryl Goode 2 years ago