WhatsApp Flows down on iOS
Currently none of our flows are working on iOS devices. Upon opening a flow a blank page is rendered (with no components at all). Android devices do not seem to have any issues.
Tony-Marketing-API.cn is a vibrant community dedicated to Facebook, Meta,Google Ads api, app development, Instagram, and related technologies. It offers valuable bug solutions, troubleshooting cases, and problem-solving strategies shared by users. Stay updated with real-world solutions, development tips, and the latest trends in digital marketing and app development.
Currently none of our flows are working on iOS devices. Upon opening a flow a blank page is rendered (with no components at all). Android devices do not seem to have any issues.
I created an app on Facebook and added Facebook Login use case. Now I need to add user_link
permissions. From what I understood to this end I need to add another use case but when I click Edit use cases I see only Run ads to promote your app use case. What should I change to be able to add user_link
permission?
Body:
I need to retrieve all daily metrics (e.g., impressions, reactions, video views) for my Facebook posts, videos, reels, etc., starting from their creation date. However, using Graph API v20.0 or higher, I only receive cumulative or incorrect data instead of individual daily values.
Here is what I’ve tried so far:
Refreshing the Access Token:
I've implemented token refresh logic to ensure a valid access token is always available.
Fetching Metrics Daily:
I request metrics using the insights
endpoint with period=day
. However, the results seem cumulative or incomplete.
Code Snippets:
1. Token Refresh Logic
The function below refreshes the token and saves it locally.
import requests from config import ACCESS_TOKEN, API_VERSION, CLIENT_ID, CLIENT_SECRET def refresh_access_token(): """Refresh the access token to get a new long-lived token.""" refresh_url = f"https://graph.facebook.com/{API_VERSION}/oauth/access_token" params = { 'grant_type': 'fb_exchange_token', 'client_id': CLIENT_ID, 'client_secret': CLIENT_SECRET, 'fb_exchange_token': ACCESS_TOKEN, } response = requests.get(refresh_url, params=params) if response.status_code == 200: data = response.json() new_access_token = data.get('access_token') if new_access_token: print("New token obtained:", new_access_token) with open('access_token.txt', 'w') as token_file: token_file.write(new_access_token) return new_access_token else: raise Exception(f"Error refreshing token: {response.status_code} - {response.text}")
2. Fetch Daily Metrics for a Post
I fetch metrics using period=day
, but the data is cumulative:
def fetch_daily_metrics(post_id, metrics, start_date, end_date): token = get_access_token() insights_url = f"https://graph.facebook.com/v20.0/{post_id}/insights" params = { 'metric': ','.join(metrics), 'access_token': token, 'period': 'day', 'since': start_date, 'until': end_date, } response = requests.get(insights_url, params=params) if response.status_code == 200: return response.json().get('data', []) else: print(f"Error fetching metrics: {response.status_code}") print(response.text) return None
3. Processing Metrics into Google Sheets
I use this to upload metrics into Google Sheets for analysis:
import pandas as pd from google_sheets import upload_to_google_sheets def process_and_upload_metrics(metrics_data): rows = [] for metric in metrics_data: name = metric['name'] for value in metric.get('values', []): rows.append({'Date': value['end_time'], 'Metric': name, 'Value': value['value']}) df = pd.DataFrame(rows).pivot_table(index='Date', columns='Metric', values='Value').reset_index() upload_to_google_sheets(df, "Facebook Insights", "Daily Metrics")
Current Problems:
Metrics are cumulative:
I expected daily values but received cumulative ones. How can I ensure the API provides individual daily values?
Data mismatch:
Some metrics appear inconsistent with the Facebook UI insights.
API Version:
I’ve tested API versions from v15.0
to v21.0
. Which version is recommended for daily metrics?
Any advice or suggestions would be greatly appreciated!
Tags:
[facebook-graph-api] [python] [google-sheets] [facebook-api]
Links:
Here’s the documentation I’ve been following.
Thank you for your help! 😊
I'm trying to make a GET request to the Facebook Graph API to fetch analytics for a WhatsApp Business Account using Postman. The request is structured as follows:
https://graph.facebook.com/v21.0/{whatsapp-business-account-ID}?fields=analytics.start(1732672800).end(1732932000).granularity(DAY)&access_token={access-token}
What I've Tried: Set the request type to GET. Added all the required query parameters (fields, start_time, end_time, granularity, access_token) in Postman. Checked that the access_token is valid with the right permissions (whatsapp_business_management). Problem: When I send the request, I get an error response:
json Copy code
{ "error": { "message": "(#100) Tried accessing nonexisting field (analytics) on node type (WhatsAppBusinessPhoneNumber)", "type": "OAuthException", "code": 100, "fbtrace_id": "XXXXXXXXXXXX" } }
What I Need:
Clarification on whether analytics is a valid field for a WhatsApp Business Account. How to set up this request correctly in Postman or any potential troubleshooting steps. Any additional permissions or API version considerations to make this work.
Additional Details:
Access token: Valid and has whatsapp_business_management permission. API version: v21.0 (can switch to another version if necessary). End goal: Retrieve analytics for a specific date range with daily granularity.
During development, the private reply API (https://graph.facebook.com/PAGE-ID/messages) was working correctly. However, after my app's review was rejected, the API started failing.
The error I encounter is:
"An unknown error has occurred."
Is it possible for an API to stop functioning after an app review rejection?
Investigated Details:
The token's validity has been confirmed as fine via the developer tools. The COMMENT-ID was obtained from the Webhook, so it should be correct. The PAGE-ID works with other APIs, so it also appears to be correct.