facebookfacebook-graph-apifacebook-send-api

Messenger Platform Limit Error (#613) Calls to this api have exceeded the rate limit


I'm having trouble stress testing my app with the Messenger Platform to send the same message to several users in a small timeframe. I'm getting a Limit Error: (#613) Calls to this api have exceeded the rate limit.

Currently I'm testing this by sending the same message several times to the same user (me); in a real world scenario, the same message would be sent to several different users of course.

Also, I'm using a test application of a live app to perform these tests. Is this supposed to drastically improve in the live app?

I really need a nice throughput broadcasting messages, so currently my setup has several threads spawn (50) sending messages in parallel, some of them already hit this limit and error out. Also, I tried the Batch Requests to improve the speed of the delivery process, and at that point it really becomes unbearable, with a success rate of less than 50%.

I've read about general Graph API rate limits (https://developers.facebook.com/docs/graph-api/advanced/rate-limiting), and to send a message you provide a Page Access Token, so I would expect my app to fall into the "Page-Level Rate Limiting" category, if I was sending too many messages. However, in the error responses there are no X-Page-Usage headers (neither X-App-Usage, by the way).

In the Messenger Platform documentation (https://developers.facebook.com/docs/messenger-platform/send-api-reference#limits) the following is stated:

Messenger Platform supports a high rate of calls to the Send API.

However, you should architect your system such that you distribute any sudden high amounts of load over time and are able to control your throughput should you hit our rate limits.

Rate limits are in place to prevent malicious behavior and poor user experiences.

Be sure to catch any errors returned by the Send API including the one indicating that you've reached the rate limit.

These are not particularly helpful either, since they don't explicitly refer to the general Graph API limits neither specify a different amount of requests you're allowed to perform.

Is there anything that I might be missing?


Solution

  • The latest document from Facebook clearly lists out 250 calls per second for the SendAPI.

    The Send API does not have a fixed rate limit, but you can safely send 250 requests per second.

    More info here: https://developers.facebook.com/docs/messenger-platform/send-messages#limits