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_token
as a Form
parameter, when using the data
argument in Python requests
. If you would like to add the access_token
to the query string instead (i.e., as a query parameter), you should use the params
argument. Example:
q_params= {'access_token': access_token}
r = requests.get(url, params=q_params)
Alternatively, you could add the access_token
to the headers
, similar to this answer.
I would highly recommend using httpx
instead of requests
; especially, if you are going to define the endpoint with async def
. Please have at this answer, as well as this answer for more details and examples.