botman / studio

Ready to use BotMan + Laravel framework
331 stars 90 forks source link

Facebook Bot Not Posting #75

Open aldnav opened 5 years ago

aldnav commented 5 years ago

I followed https://botman.io/2.0/installation and Tinker works fine. image

When I added my Facebook messenger bot, the verification works. When chatting with the bot, I receive the POST request as per Postman and ngrok, it responds 200 OK. image

Problem But I don't get actual reply from the bot.

Setup

"require": {
        "php": "^7.1.3",
        "botman/botman": "~2.0",
        "botman/driver-facebook": "^1.9",
        "botman/driver-web": "~1.0",
        "botman/studio-addons": "~1.3",
        "botman/tinker": "~1.0",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0"
}

Possible cases

https://github.com/botman/driver-facebook/commit/d26cb64bcb6087d7a55be3c4d4c0b25ff297fbc6

whereas as of writing new apps acquire v3.2

image

laravel.log is empty

aldnav commented 5 years ago

When I updated the code to spit some logs

# botman.php
$botman->hears('Hi', function ($bot) {
    Log::debug('Scope: Hi');
...

$botman->fallback(function($bot) {
    Log::debug('Scope: Fallback');

It's always

# laravel.log
[2018-12-01 14:49:57] local.DEBUG: Scope: Fallback

Facebook POST request

{
    "object": "page",
    "entry": [
        {
            "id": "1067603503414535",
            "time": 1543675797630,
            "messaging": [
                {
                    "sender": {
                        "id": "1659215634184784"
                    },
                    "recipient": {
                        "id": "1067603503414535"
                    },
                    "timestamp": 1543675796954,
                    "message": {
                        "mid": "TfSuKwd8mFzC3eJI0QH5mssGHHHEjCG32Zy27yird-f11cPWNk9fzqRnX1up0DvuRBSJBtJk2z_4ekOeAJosaA",
                        "seq": 1544429,
                        "text": "Hi",
                        "nlp": {
                            "entities": {
                                "sentiment": [
                                    {
                                        "confidence": 0.73355811297703,
                                        "value": "positive"
                                    }
                                ],
                                "greetings": [
                                    {
                                        "confidence": 0.99994528293428,
                                        "value": "true"
                                    }
                                ]
                            }
                        }
                    }
                }
            ]
        }
    ]
}
vdomah commented 4 years ago

Same situation now with Telegram. Also receiving POST request from Telegram, but bot doesn't respond. Did you find any solution or other suggestions?

kurumbus commented 4 years ago

@aldnav I don't think this is your case, but I had such problem when I forgot to put $botman->listen(); at the end of the method.

I also had a problem with incorrect config.