In the documentation it is not told to include page_id in the request but this error says to provide a valid application id:
{
"error": {
"message": "(#200) Provide valid app ID",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "AA23cGCw0PM8uPLrX2SdyhS"
}
}
I want to see which apps have installed Pages in webhook meta with this function
def cek_subs_app_webhook(page_id, access_token):
url = f"https://graph.facebook.com/{page_id}/subscribed_apps"
payload = {
'access_token': access_token
}
get = requests.get(url, data= payload)
return get.json()
and execute the function with this FastAPI app
@router.get("/cek-subs-app/{page_id}")
async def check(page_id: str, access_token: str = Header(..., description="meta token")):
response = cek_subs_app_webhook(page_id, access_token)
return JSONResponse (response)
You are passing the
access_tokenas aFormparameter, when using thedataargument in Pythonrequests. If you would like to add theaccess_tokento the query string instead (i.e., as a query parameter), you should use theparamsargument. Example:Alternatively, you could add the
access_tokento theheaders, similar to this answer.I would highly recommend using
httpxinstead ofrequests; especially, if you are going to define the endpoint withasync def. Please have at this answer, as well as this answer for more details and examples.