Facebook Instant game bot message often results in “Cannot send Instant Game message to user at this time”

佐手、 提交于 2019-12-11 05:10:02

问题


I'm making a Facebook instant game, and am sending myself test messages via the associated bot.

It works. But not always, why?

Very often I get this:

{
    "error": {
        "message": "(#100) Cannot send Instant Game message to user at this time.",
        "type": "OAuthException",
        "code": 100,
        "error_subcode": 2018144,
        "fbtrace_id": "DNZhKZlP83D"
    }
}

This error code is not listed in the error code documentation.

I suppose it could be some message sending limit, but I would assume that as the listed developer of the app I would be exempt from any limits.

More details just in case they are relevant

I have subscribed to the webhooks, and created a page associated with my instant game app and have the access token for it. The user I am trying to message is me, listed as the developer.

When I receive a game_play event such as:

{
    "object": "page",
    "entry": [{
        "id": "189899011738553",
        "time": 1521899151513,
        "messaging": [{
            "recipient": {
                "id": "189899011738553"
            },
            "timestamp": 1521899151513,
            "sender": {
                "id": "1647209385355472"
            },
            "game_play": {
                "game_id": "176650212970169",
                "player_id": "1293384810761815"
            }
        }]
    }]
}

I find the sender ID, and send a response like so:

{
    "message": {
        "attachment": {
            "type": "template",
            "payload": {
                "template_type": "generic",
                "elements": [{
                    "buttons": [{
                        "type": "game_play",
                        "title": "Play"
                    }],
                    "title": "Hello World"
                }]
            }
        }
    },
    "recipient": {
        "id": "1647209385355472"
    }
}

Here's the cURL version:

curl -X POST \
  'https://graph.facebook.com/me/messages?access_token=MY_ACCESS_TOKEN' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{"message": {"attachment": {"type": "template", "payload": {"template_type": "generic", "elements": [{"buttons": [{"type": "game_play", "title": "HELLO"}], "title": "HELLO WORLD"}]}}}, "recipient": {"id": "1647209385355472"}}'

And just to show the access token is valid, despite the "OAuthException", and that it does really sometimes work:


回答1:


We've ensured that this error is now documented.

This message indicates that the number of messages or time window in which messages are sent to the user of an Instant Game exceeds the Instant Games bot policy.

This applies to developers and administrators as well as users of the app. Playing the game or communicating with the bot should reset these limits.



来源:https://stackoverflow.com/questions/49468009/facebook-instant-game-bot-message-often-results-in-cannot-send-instant-game-mes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!