The Conversions API Parameter Builder SDK is a multi-language toolkit designed to improve the quality of Conversions API parameter retrieval and validation. The SDK ensures event parameters adhere to best practices across multiple platforms.
Repository: https://github.com/facebook/capi-param-builder
- Server-side: PHP, Java, NodeJS, Python, Ruby
- Client-side: JavaScript
Each language implementation lives in its own top-level directory with its own build system, tests, examples, and documentation.
param_sdk/
├── README.md # Main project documentation
├── AGENTS.md # AI Agent guidance (this file)
├── CODE_OF_CONDUCT.md # Code of conduct
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE # License file
├── composer.json # PHP root composer file
├── .github/workflows/ # CI/CD workflows for all languages
├── java/ # Java implementation
├── nodejs/ # Node.js implementation
├── php/ # PHP implementation
├── python/ # Python implementation
└── ruby/ # Ruby implementation
Note: The client_js/ directory is not open-sourced yet, the dir only
contains examples.
Each language directory follows a consistent structure:
<language>/
├── README.md # Language-specific quick start guide
├── CHANGELOG.md # Version history and changes
├── CONTRIBUTING.md # Contribution guidelines
├── CODE_OF_CONDUCT.md # Code of conduct
├── LICENSE # License file
├── capi-param-builder/ # Main SDK implementation (Python/Ruby use capi_param_builder with underscore)
│ ├── src/ # Source code
│ ├── tests/ or test/ # Unit tests
│ └── ... # Language-specific build files
└── example/ or examples/ # Example usage code (PHP uses "examples")
The SDK provides utilities for:
- Cookie parameter extraction - Facebook click identifier (fbc) and browser identifier (fbp)
- Client IP address retrieval - Enhanced mechanisms for capturing client IP addresses with IPv6 support (IPv4 fallback when IPv6 is unavailable)
- Customer Information Parameters normalization and hashing - Tools to help adopt best practices for normalizing and hashing customer information including email, phone, name (first and last), address (city, state, zip code, country), gender, date of birth, external ID
For details on features, refer to the Parameter Builder Library.
MANDATORY: After making any code changes to a language implementation, you MUST run the appropriate test command for that language before considering the task complete.
cd nodejs/capi-param-builder
npm install
npm testTested on Node.js versions: 18.x, 20.x, 22.x, 24.x
cd python/capi_param_builder
python3 -m unittest test/test_param_builder.pyTested on Python versions: 3.9, 3.10, 3.11
cd java/capi-param-builder
chmod +x ./gradlew
./gradlew buildTested on Java versions: 8, 11, 17, 21
cd php/capi-param-builder
composer install --dev --prefer-source
./vendor/bin/phpunit ./tests/ --debugTested on PHP versions: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4
cd ruby/capi_param_builder
gem install minitest
ruby -Ilib:test test/test_param_builder.rbTested on Ruby versions: 3.0, 3.2, 3.3
-
Maintain API Consistency: All language implementations should provide equivalent functionality with language-appropriate idioms. When adding a feature to one language, consider whether it should be added to others.
-
Backward Compatibility: The SDK is used by external developers. We strongly recommend maintaining backward compatibility with existing flows. Breaking changes require:
- Version bump (follow semantic versioning)
- Changelog entry
- Migration guide if necessary
-
Human Review for Intrusive Changes: If you have intrusive changes that could break existing integrations or significantly alter SDK behavior, please ensure human review before implementation. Always prefer backward-compatible solutions over breaking changes.
Note: Python and Ruby use capi_param_builder (with underscores) instead of
capi-param-builder (with dashes).
- Core logic:
<language>/capi-param-builder/src/(orcapi_param_builder/for Python/Ruby) - Tests:
<language>/capi-param-builder/tests/or<language>/capi-param-builder/test/(orcapi_param_builder/for Python/Ruby) - Models:
<language>/capi-param-builder/src/model/or similar (orcapi_param_builder/for Python/Ruby) - Utilities:
<language>/capi-param-builder/src/utils/(orcapi_param_builder/for Python/Ruby)
- Research existing implementation - Check if similar functionality exists in other language implementations
- Update the implementation - Add code to
src/directory - Add tests - Create or update test files with comprehensive test coverage
- Run tests locally - Use the appropriate test command for the language
- Update documentation - Update README.md and add inline code documentation
- Update CHANGELOG.md - Document the change following existing format
- Bump version - If the code change needs to be released, bump the version number following semantic versioning (see Version Files section below)
- Test examples - Verify example code still works if applicable
When bumping versions, update the version number in these files:
- Node.js:
nodejs/capi-param-builder/package.json - Python:
python/capi_param_builder/setup.py - Java:
java/capi-param-builder/build.gradleandjava/build.gradle - PHP:
php/capi-param-builder/composer.jsonandcomposer.json - Ruby:
ruby/capi_param_builder/capi_param_builder.gemspecwithruby/capi_param_builder/lib/release_config.rb
Note: For Client-side JavaScript (Meta Internal Only), see the dedicated section above.
- Reproduce the issue - Write a failing test that demonstrates the bug
- Fix the implementation - Make targeted changes to source code
- Verify the fix - Ensure the new test passes
- Run full test suite - Confirm no regressions
- Update CHANGELOG.md - Document the bug fix
- Bump version - If the bug fix needs to be released, bump the version number following semantic versioning
- Check other languages - Verify if the same bug exists in other implementations
Each language has its own CI workflow in .github/workflows/:
<language>_ci.yml- Continuous integration (runs tests)<language>_cd.yml- Continuous deployment (publishes packages)
CI runs automatically on:
- Push to any branch (for changed files in that language's directory)
- Pull requests
- Manual workflow dispatch
The CI matrix tests against multiple versions of each language runtime to ensure compatibility.
- Follow language-specific conventions and style guides
- Keep functions focused and testable
- Add meaningful comments for complex logic
- Use descriptive variable and function names
- Write unit tests for all new functionality
- Test edge cases (null, empty, invalid input)
- Mock external dependencies when appropriate
- Update README.md for public API changes
- Add inline documentation for complex functions
- Include usage examples for new features
- Keep CHANGELOG.md up to date
- Make focused commits with clear messages
- Reference issue numbers in commit messages
- Keep changes scoped to single language when possible
- Run tests before pushing
- Find the constants file (e.g.,
Constants.js,constants.py) - Update the constant value
- Check for tests that may be affected
- Run full test suite
- Update any dependent example code
- Update the main builder class (e.g.,
ParamBuilder.js,param_builder.py) - Add validation logic if needed
- Add tests for the new parameter
- Update examples to show usage
- Document in README.md
- Parameter Builder Library Overview
- Conversions API Documentation
- Language-specific READMEs in each directory
- Read the error message carefully - test frameworks provide specific failure details
- Run tests in isolation to identify the failing test
- Check if changes affected shared utilities or constants
- Verify all dependencies are installed
- Check the specific workflow that failed (language-specific)
- Review the GitHub Actions logs for error details
- Ensure changes work on all tested language versions
- Verify no uncommitted files are required
- Check package manager files for each language:
- Node.js:
package.json - Python:
setup.py - Java:
build.gradle - PHP:
composer.json - Ruby:
capi_param_builder.gemspec
- Node.js:
- Ensure versions are compatible with the tested runtime versions
- Run clean install (delete
node_modules,.gradle, cache, etc. and reinstall)
- Never commit secrets or credentials - This is a public open-source project
- Cross-language consistency - Keep APIs and behavior consistent across implementations
- Semantic versioning - Follow semver for version bumps
- Run tests before submitting - All tests must pass before changes are complete