Posts under category Meta & Facebook

I'm working on a Django API that integrates with the Meta API for WhatsApp product feeds. This endpoint works perfectly on my local machine, but when I deploy it to production, it returns a 504 Gateway Timeout error.

Details:

Local Request (Works):

curl -X POST http://127.0.0.1:8000/api/whatseat/save-changes/ -d "business_id=2"

Production Request (504 Gateway Timeout):

curl -X POST https://<production-url>/api/whatseat/save-changes/ -H "Authorization: Token <token>" -d '{"business_id": 2}'

Key Observations:

  • Error happens only in production—locally, the endpoint works fine.
  • When this endpoint is called without the necessary WhatsApp data, it correctly returns a prompt to complete settings. So, the problem seems to occur during an external API request to the Meta (WhatsApp) API.
 def post(self, request):     business_id = request.data.get('business_id')          try:         whatsapp_business = WhatsApp.objects.get(business=business_id)     except ObjectDoesNotExist:         return Response({"message": "Complete WhatsApp setup in settings"}, status=400)          access_token = whatsapp_business.access_token     product_catalog_id = whatsapp_business.catalog_id          if not all([access_token, product_catalog_id]):         return Response({"error": "Missing Access Token or Catalog ID"}, status=400)     # External API request (seems to be the timeout issue in production)     try:         product_feed_data = request.build_absolute_uri(reverse('get-product-feeds'))         response = requests.get(product_feed_data, params={             'access_token': access_token,             'product_catalog_id': product_catalog_id         })         response.raise_for_status()     except requests.RequestException as e:         return Response({'error': str(e)}, status=500)     # Other logic... (contains another call to graph api for uploading the new data feed) 

Troubleshooting Attempts:

  • Local vs. Production Testing: Locally, the endpoint works without issues.

  • Error Isolation: Confirmed the timeout is likely due to the Meta Products Feed API request.

What might cause a 504 Gateway Timeout when accessing the Meta Products Feed API in production, but not locally? Could this be due to server or network configuration differences, or specific Meta API requirements in production? Any advice on addressing API timeouts in Django would be helpful.

I am using Python and Facebook Graph API v17.0 to schedule image posts. I use scheduled_publish_time parameter when creating the post, also I am specifying published parameter to false. The problem I have is that the post is scheduled but it does not appear in the "facebook planner" (in meta bussines suite).

Even the post is not in the calendar, it is posted in the feed according to date and time specified in the code.

is there a way to access to a specified scheduled post (with the id) and check or edit manually (if is necessary) ?

I tryed with:

https://www.facebook.com/{page_id}/posts/{post_id}/

But it shows the post with the date and time when it was created not when the post should go live (scheduled date&time).

Do you know how to construct a link to access to a specific scheduled post that shows the date and time when it should go live (scheduled date&time)?

I hope someone can help.

Thanks in advance.

We have implemented Facebook login on our React application. Our "Log in with Facebook" button's click handler calls FB.login. We have supplied a callback to FB.login that handles the response and authenticates with our backend using the provided access token.
The works in most cases - except if the user has two-factor authentication enabled on their Facebook account. In this scenario, if the user successfully goes through the flow in the Facebook popup to complete two factor authentication and verify their identity, the popup closes - but the response object supplied to the FB.login callback has a status of "unknown" and does not include an access token.
The user must then click "Log in with Facebook" a second time, and only then is a successful auth response supplied to the FB.login callback.
Looking for support in handling this scenario so that the user does not need to click "Log in with Facebook" twice in order to authenticate with our app.