facebookfacebook-graph-apifacebook-marketing-api

Facebook graph API, Assign system user to a page


We have Page-Access-Token with all the permissions available (just for testing purposes), we also have a Business System User token and this is the steps we are trying to do

1: We connect our business to the facebook page as an agency using this api call

/me/agencies?access_token=${PAGE_ACCESS_TOKEN}&business=${BUSINESS_ID}&permitted_tasks=['ADVERTISE']

we will become partners with the page successfully.

2: we try to assign our business System user to the page that we just connected our business to using this api call

/me/assigned_users?business=${BUSINESS_ID}&user=${SYSTEM_USER_ID}&access_token=${PAGE_ACCESS_TOKEN}

but this request will fails and we get this response

error: {
  message: 'Invalid parameter',
  type: 'OAuthException',
  code: 100,
  error_subcode: 1752100,
  is_transient: false,
  error_user_title: '‎User is not Business Scoped‎',
  error_user_msg: '‎The user ID provided is not business scoped. Please provide a business or a system user ID‎',
  fbtrace_id: 'AMSzq06ES6nymFDFD31JWAk'
}

we know that it's possible for the System User to be assigned to the page because you can do that in the businees.facebook.com but we want to do it using graph api

Things we confirmed

Things we saw that were interesting if the page owner have role in the business the second api call would end up successfully and the system user will be assigned to the page

So, How can we assign our system user to the pages that connect to our business


Solution

  • Found a workaround, I created a Business Asset Group, added the system user to this group in the business.facebook.com then through Graph Api I could add the page to this group and the system user now have control over the page just like how I want it.