facebook-messenger-bot

Messenger is not sending attachment info for pdf sent by messenger to app


Have an app for handling FB Messenger events. I am sharing files to and from the app.

Messaging with attachments is working properly from the app to messenger.

Also, from messenger to app, image files are successfully sent (fb_messenger_bot_message_received event with fb_messenger_bot_message_type: image).

But when I send a pdf file from messenger to app, there is no information about the attachment in the event received on the webhook. Looking at the events in the FB Developer console, I see that the fb_messenger_bot_message_received event has fb_messenger_bot_message_type: unknown.

Anyone else experiencing this? Is there a solution for this problem?

To reproduce (Node.js), write the following piece of code in your app and try sending a pdf and an image from FB to app:

app.post('/webhook', (req, res) => {
    var data = req.body;
    logger.info("Message event data is " + JSON.stringify(data));
});

The above code gives the following output:

  1. For Image:
{
    "object": "page",
    "entry": [{
        "id": "XXXXXX",
        "time": 1603867612794,
        "messaging": [{
            "sender": {
                "id": "YYYYYY"
            },
            "recipient": {
                "id": "XXXXXX"
            },
            "timestamp": 1603867612713,
            "message": {
                "mid": "ALPHANUMERIC_MID_0001",
                "attachments": [{
                    "type": "image",
                    "payload": {
                        "url": "https://scontent.xx.fbcdn.net_Image_Location"
                    }
                }]
            }
        }]
    }]
}
  1. For PDF:
{
    "object": "page",
    "entry": [{
        "id": "XXXXXX",
        "time": 1603867801741,
        "messaging": [{
            "sender": {
                "id": "YYYYYY"
            },
            "recipient": {
                "id": "XXXXXX"
            },
            "timestamp": 1603867801642,
            "message": {
                "mid": "MID_0002"
            }
        }]
    }]
}

There is no information except mid in the event received for message with PDF attachment.

Edit Here is a bug tracking this issue (for anyone else encountering this problem). https://developers.facebook.com/support/bugs/1248094478904310/


Solution

  • This was an issue on Facebook's (FB) end. Hence I am answering this question myself. There isn't much that can be done in this issue without FB's intervention.

    This issue caused temporary disruption of file sharing (from FB Messenger to application webhooks) for many users.

    FB says they have fixed the problem (and marked the bug https://developers.facebook.com/support/bugs/1248094478904310/ as fixed).

    But some users are still commenting on the bug that they are still facing this issue. But my application is working fine now. I had issues with PDFs only and it is now fixed.

    Please feel free to comment on this question or the FB bug mentioned above if you are facing this issue.