Search code examples
djangofacebook-graph-apifacebook-messengerfacebook-messenger-bot

facebook-messenger-bot error: When & why this error raised "(#100) Length of param name_placeholder[text] must be less than or equal to 640"


I have a Django application that is connected to Messenger for a Facebook page. When any Facebook user messages to the Facebook page my application try respond automatically after parsing Facebook user's message. If any error occurred during sending message from my Django application I stored the error text in a column of a table. When I tried to analyze the errors generated while sending message I found one error text is as follow

"(#100) Length of param name_placeholder[text] must be less than or equal to 640"

and I can not regenerate it.

There is another similar error "(#100) Length of param message[text] must be less than or equal to 2000" which is very clear and I can regenerate it.

I have searched on Google and found nothing that can help me.

I just wants to know that when and why the error occur so that I can modify my application to handle it.

I have used the following api for sending messages to Facebook user https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN with this header parameter
{'content-type': 'application/json'}
and this data

{
    "messaging_type": "RESPONSE",
    "recipient": {
        "id": "receiver_id"
    },
    "message": {
        "text": "message_text"
    }
}

Note: I know Facebook gives error code, type, error_subcode and other information but unfortunately only error message is stored in the table. So I don't have code and subcode of the error.


Solution

  • If you want to send a Button Template, then the text will have a limit of 640 characters. Probably your text is too long and that's why you get this error message.

    See message.attachment.payload > text: UTF-8-encoded text of up to 640 characters. Text will appear above the buttons.

    If you just send a plain text message over the Send API, then this will have a limit of 2000 characters.