GithubHelp home page GithubHelp logo

facebook / facebook-business-sdk-codegen Goto Github PK

View Code? Open in 1sVSCode Editor NEW
57.0 12.0 36.0 2.34 MB

Codegen project for our business SDKs

License: MIT License

JavaScript 15.50% Java 13.27% HTML 0.51% PHP 36.54% CSS 0.23% Python 12.36% Ruby 9.00% Kotlin 0.34% Mustache 12.27%

facebook-business-sdk-codegen's Introduction

Facebook Business SDK Codegen


This project contains all the code to auto generate Facebook Business SDKs (php, python, nodejs, ruby, java). There are three parts of this project :

  • JSON schema representation of the Graph API endpoints.
  • Mustache template for 5 languages.
  • Codegen scripts.


Install Node.js

Install all dependencies by npm : npm install

Codegen SDK

npm run build && node lib/CodeGenerator.js <language>


During debug, if you want to compare with the generated SDK to our current SDK code, you can specific the output folder by using -o :

npm run build && node lib/CodeGenerator.js <language> -o outputDir

If you want to keep git config in outputDir, you can specific only cleanup source code by using -c , for example:

npm run build && node lib/CodeGenerator.js php -o ../facebook-php-business-sdk/ -c src/


Facebook Codegen for Business SDKs is licensed under the LICENSE file in the root directory of this source tree.

facebook-business-sdk-codegen's People


jingping2015 avatar HeyMultiverse avatar kongxinzhu avatar davit-y avatar donglinw-fb avatar Mxiim avatar andreladocruz avatar crazyministr avatar supasate avatar dependabot[bot] avatar zertosh avatar andreybolonin avatar eray-aydin avatar sandersjerik avatar hieptuanle avatar jawwad avatar josejia avatar jguittard avatar joekohlsdorf avatar mktktmr avatar linmx0130 avatar michaelwclark avatar MyrikLD avatar yakuban avatar ODAEL avatar oakhan3 avatar shinde-rahul avatar walt1020 avatar uwemaurer avatar facebook-github-bot avatar


 avatar  avatar Mokhtar Algholi avatar Cody Person avatar Dmitry Korolev avatar Alejandro Jesus del Campillo Jaime avatar Aman Goel avatar Nanashi Li avatar Kimberly AntleyFree  avatar  avatar  avatar Mauricio Valencia avatar  avatar Matt DeDiana avatar Zou Guangxian avatar Keany Vy KHUN avatar djmiggie avatar Daniel Vygolov avatar Takuya Arita avatar  avatar Jeket avatar George Kontridze avatar lilkypimp1 avatar Chun-Sheng, Li avatar debedb avatar Joe Adkins avatar  avatar Felipe Hernández Lagos avatar Roldan Geonson avatar  avatar  avatar  avatar NiNeW avatar  avatar Ketan avatar Zhang Bo avatar  avatar Gokhan Celik avatar Gábor Mihálcz avatar  avatar Clint avatar Yasuhiro Manai avatar Greg Murray avatar  avatar Stéphanie Laplante avatar Antonin Bouscarel avatar Supasate "Ping" Choochaisri avatar  avatar  avatar Marcus Drakon avatar Topher avatar Yuchan Hwang avatar  avatar Joseph Higgins avatar Justin avatar Luis Miguel Alvarado avatar  avatar


Tao Ge avatar Killian Murphy avatar Stoyan avatar  avatar James Cloos avatar Max Vyaznikov avatar Cody Winton avatar  avatar Jing Ping avatar Cody Person avatar Justin avatar Kimberly AntleyFree  avatar

facebook-business-sdk-codegen's Issues

Cannot run CodeGenerator.js



Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

  • Node Version: 15.14.0
  • NPM Version: 7.7.6


What do you want to achieve?

I want to run CodeGenerator.js as the described.
The command I used to run: npm run build && node lib/CodeGenerator.js python

Expected Results

What do you expect to happen?
CodeGenerator.js successfully executed.

Actual Results

Error: ENOENT: no such file or directory, open '/Users/james/Downloads/programmation/sdk/servers/python/release/'

What actually happened? Can you provide a stack trace?
It is not able to find the sdk folder. In fact, these are the folders named sdk: (find . -name "sdk" -type d)

Also, it is trying to access the parent folder of the repo. (the cwd is: /Users/james/Downloads/programmation/facebook-business-sdk-codegen)

Taking a look at how this path is generated, the path is written inapi_specs/version_path.json, and src/common/Utils.js: loadDefaultSDKVersion went 3 directories back, but __dirname is facebook-business-sdk-codegen/lib/common.

Steps to Reproduce

What are the steps necessary to reproduce this issue?
npm install && npm run build && node lib/CodeGenerator.js python

Code Samples & Details

Please provide a code sample, as well as any additional details, to help us track down the issue. If you can provide a link to a test project that allows us to reproduce the issue, this helps us immensely in both the speed and quality of the fix.

Note: Remember to format your code for readability:

npm install && npm run build && node lib/CodeGenerator.js python

Feature Request: Add missing types for nested Objects (such as Ads/insights/filtering)


  • I've updated to the latest released version
  • I've searched for existing feature requests on GitHub issues
  • I've read the Code of Conduct
  • I've given my issue the title: Feature Request: [name of my feature request]


Be able to fully validate and describe the API, align to official references documentation

Expected Results

I expect a field like filtering to contain list<FilterObject> or list<AdRuleFilter> and not list<Object>

Code Samples & Details


    "apis": [],
    "fields": [
            "name": "field",
            "type": "string"
            "name": "operator",
            "type": "Filters_operator"
            "name": "value",
            "type": "Object"


                    "name": "filtering",
                    "required": false,
                    "type": "list<FilterObject>"


Missing Call-to-Action enum CALL_NOW



I'm using the Java Business sdk v10.0.1.


Use a call to action type of CALL_NOW, as shown in examples here:

Expected Results

SDKs contain an enum value of CALL_NOW in EnumType for AdCreativeLinkDataCallToAction

Code Samples & Details

The enum_types.json file in this project doesn't contain the CALL_NOW call-to-action enum value.

Related to this, the Java Business SDK method AdCreativeLinkDataCallToAction.setFieldType has only one implementation where the first argument is the EnumType. A different solution might be to include an overloaded method in the SDK with a String type argument instead.

Also reported here

FacebookAds\Object\AdAccount -> createAdCreative() not handling the exception properly.


  • I've updated to the latest released version (facebook/php-ads-sdk": "5.0")
  • I've searched for existing GitHub issues
  • I've looked for existing answers on Stack Overflow and the Facebook Developers Group
  • This issue is not security related and can safely be disclosed publicly on GitHub


facebook/php-ads-sdk": "5.0.*


I want to create new Creative while creating a new ad. If it fails then returns specific message returned from FB API.

Expected Results

Speicifc errpr message return from FB API like "The image couldn't be downloaded. Please wait a few minutes and try again."
What do you expect to happen?

Actual Results

"array_key_exists() expects parameter 2 to be array, null given".

What actually happened? Can you provide a stack trace?
{ "error": { "message": "Invalid parameter", "type": "OAuthException", "code": 100, "error_data": "null", "error_subcode": 1487833, "is_transient": true, "error_user_title": "Image wasn't downloaded", "error_user_msg": "Your image, https://someimage.png, couldn't be downloaded. Please wait a few minutes and try again.", "fbtrace_id": "AGIA_kW9Khu9XO05piwiXuw" } }

Steps to Reproduce

We can't provide token and other details for securoty reasons. You can just try to create a new creative by using following payload.

Code Samples & Details

{ "access_token": "XXX", "object_type": "SHARE", "object_story_spec": { "page_id": "XXX", "link_data": { "message": "Some message", "link": "", "name": "test", "picture": "", "description": "Some descriotion", "call_to_action": { "type": "LEARN_MORE", "value": { "lead_gen_form_id": "XXX" } } } } }

Now, whenever a exception occurs getData(); method not handling that properly and not returning appropriate error message.

API call

$adAccount = new AdAccount('act_<ad_account_id>'');
$creative = $adAccount->createAdCreative([], $payload)->getData();

This function is calling createAdCreative() method in FacebookAds\Object\AdAccount class

public function createAdCreative(array $fields = array(), array $params = array(), $pending = false) {
	// Code stuff

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.