node.jsfacebookfacebook-ads-apifacebook-marketing-api

Facebook Ads API is deprecated, please update to the latest version v3.0


I have downloaded the "SAMPLE_CODE.js" from the Facebook developers website for their Marketing API. However, while I was trying to run their sample code, I continuously ran into this error:

response:
  { error:
     { message: '(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v3.0.',
       type: 'OAuthException',
       code: 2635,
       fbtrace_id: 'Hw2wXpUNyud' } }

No matter how many forums I have been on or how many times I have tried to fix this error I was not able to find the solution. (I tried to update the Ads API multiple times in many different ways but none of them would actually let me update the package, I have seen similar issues online but unfortunately I was still not able to resolve the problem). Does anyone know how to fix this issue?


Solution

  • I ran into this same problem when following Facebook's documentation to get custom audience. To get around this error in SAMPLE_CODE, I changed the required API from 'facebook-nodejs-ads-sdk' to 'facebook-nodejs-business-sdk'. The Business API should encapsulate all of the marketing APIs.