Do Minh Phong
Do Minh Phong

Reputation: 362

How to get user_id from page scope id

I'm trying to get page scope id (PSID) from user_id

As I know, one user have two kind ID: one for Graph API Platform (GID) and one for Messenger platform (MID).

(PSID = MID, user_id = GID)

I've found out the way to change from GID to MID:

GET /{GID}/ids_for_pages?access_token=[page_access_token]&appsecret_proof=[appsecret_proof]

enter code here

json I receive:

{   "data": [
  {
     "id": "MID here",
     "page": {
        "name": "Trang web b\u00e1n h\u00e0ng",
        "id": "1863210517250420"
     }
  }   ],   "paging": {
  "cursors": {
     "before": "MTg2MzIxMDUxNzI1MDQyMAZDZD",
     "after": "MTg2MzIxMDUxNzI1MDQyMAZDZD"
  }   }}

Now I want to change from MID to GID.

I try this

GET /{MID}/ids_for_pages?access_token=[page_access_token]&appsecret_proof=[appsecret_proof]

But I get error

{   "error": {
  "message": "(#230) Requires pages_messaging permission to manage the object",
  "type": "OAuthException",
  "code": 230,
  "fbtrace_id": "D+x01MWia1s"   }}

I've read Facebook's document in here but I can't find out the way to change from MID to GID.

Please help me. Thanks for reading my problem.

Upvotes: 2

Views: 1875

Answers (1)

Daniel Ta
Daniel Ta

Reputation: 416

You can try with ids_for_apps end point as being described here

Upvotes: 1

Related Questions