pimax / fb-messenger-php-example

Facebook Messenger Bot PHP API Example
107 stars 54 forks source link

this code not run #21

Closed tuanxuong closed 7 years ago

tuanxuong commented 7 years ago

hello sir, I download your source and config on my host. But when i send a message to Bot, Bot not reply. If i set $command in line 71 (before switch ($command)), bot Reply. Pls help me

tuanxuong commented 7 years ago

i see https://github.com/pimax/fb-messenger-php-example/pull/20/commits/fe5d454fca57fa00f1018015e21ef98fc9029d46 and fix it

but, i can fix it with add

if (!empty($message['message'])) { $command = $message['message']['text'];

        // When bot receive button click from user
        } else if (!empty($message['postback'])) {
            $command = $message['postback']['payload'];

        } else 
        {
            return;
        }