I'm using Python to create a script that allows me to create a label in the inbox (for a Facebook page), and then associate or tag a user with a specific label.

This is the function I made:

def associate_label_to_user(recipient_id, label_id, access_token): url = f"https://graph.facebook.com/v19.0/{label_id}/label?access_token={access_token}" data = {     "user": recipient_id } response = requests.post(url, json=data) response_json = response.json() # print(response_json) if response.status_code == 200:     success = response_json['success']     if success:         print("[LOGS] Association of label to user successful") else:     print("[LOGS] Error associating label to a user") 

I'm reading their documents here https://developers.facebook.com/docs/messenger-platform/identity/custom-labels/, and I'm not experiencing any other problem.

Whenever I run the script, it works (I see the user being labeled correctly), but I'm getting this error in return:

{'error': {'message': 'Unsupported request - method type: post', 'type': 'GraphMethodException', 'code': 100, 'fbtrace_id': 'ApHRHoVZFM_BUqHpOs3KdKX'}} 

I don't understand what this means, when it works for me anyway.

Tag:python, curl, facebook-graph-api, post

Add a new comment.