facebook-chatbotfacebook-send-api

Facebook bot stopped replying except with cards


I have a chatbot that used to work normally but last week, it stopped answering some people who interacts with it while some people continued normally. Then after two days it went back to answer all of the clients but only with list of cards (no text, postback options, images .. etc). I haven't changed the request and using facebook API verion 2.10 which is still not deprecated. So is there a problem in facebook system right now or are there changes in their API? cause I was checking the docs and all I see as a breaking change has a default value from FB regarding "messaging_type" parameter. Also, I thought that the problem is regarding ids and tokens (PSID is wrong for example but then how does it reply with cards)?

here is an example of a request that stopped working (which has been the same and working since months for this bot: Request:

{
    "message": {
        "text": "To change the language to english, please type 'En'"
    },
    "recipient": {
        "id": "ClientRecipientPSID"
    }
}

Response (400 bad request):

{
    "error": {
        "message": "(#2022) Your account is temporarily unavailable. Regain access by logging in from a mobile or web browser.",
        "type": "OAuthException",
        "code": 2022,
        "fbtrace_id": "BeDypKgHKH2"
    }
}

Note: I already logged in and out so many times and the client account is active but nothing changed.

While this is an example of a working reuest (only list of cards):

{
    "message": {
        "attachment": {
            "type": "template",
            "payload": {
                "elements": [{
                    "title": "ZZZ",
                    "subtitle": "Hello John I’m ZZZ Bot. Ask me anything and I'll be glad to help you.",
                    "buttons": [{
                        "type": "postback",
                        "title": "Title1",
                        "payload": "1"
                    }, {
                        "type": "postback",
                        "title": "Title2",
                        "payload": "2"
                    }, {
                        "type": "web_url",
                        "url": "client_url",
                        "title": "Title3"
                    }],
                    "image_url": "our_img_url",
                    "default_action": {
                        "type": "web_url",
                        "url": "link_to_client_site",
                        "webview_height_ratio": "tall",
                        "fallback_url": "link_to_client_site",
                        "messenger_extensions": true
                    }
                }, {
                    "title": "ZZZ",
                    "subtitle": "Click below for more information:",
                    "buttons": [{
                        "type": "postback",
                        "title": "TitleX",
                        "payload": "371"
                    }, {
                        "type": "postback",
                        "title": "TitleY",
                        "payload": "372"
                    }, {
                        "type": "postback",
                        "title": "TitleZ",
                        "payload": "373"
                    }],
                    "image_url": "our_img_url",
                    "default_action": {
                        "type": "web_url",
                        "url": "link_to_client_site",
                        "webview_height_ratio": "tall",
                        "fallback_url": "link_to_client_site",
                        "messenger_extensions": true
                    }
                }],
                "template_type": "generic"
            }
        }
    },
    "recipient": {
        "id": "ClientRecipientPSID"
    }
}

Any idea why this happened? Thanks.


Solution

  • The problem was with the account of the app owner not the account of the clients. It needed a password reset. However, we didn't think that the problem was with the owner account since it replies to the clients. Sorry for the inconvenience but I believe that this is also a bug in Facebook since if the app owner account is not active, the bot shouldn't reply at all or either keep replying, but not answer with cards but ignore other message types.