The SolidusFacebookCatalog permit us to send our products catalog to facebook to create Dynamic Ads. Thanks to Facebook that has developed the Business SDK and we use this to send our catalogs.
Add this line to your application's Gemfile:
gem 'facebookbusiness'
gem 'solidus_facebook_catalog', git: 'https://github.com/2beDigital/solidus_facebook_catalog', branch: 'master'If you want to send sales_price, please install:
gem 'solidus_sales', git: 'https://github.com/2beDigital/solidus_sales', branch: 'master'And then execute:
$ bundle install
$ bundle exec rails g solidus_facebook_catalog:install
Run migrations:
$ bundle exec rake db:migrate
Business SDK Getting Started Guide
We developed this SDK using Ruby 2.0, and supports Ruby 2.0+, however, the SDK is not thread-safe at the moment.
To get started with the SDK, you must have an app registered on developers.facebook.com.
To manage the Marketing API, please visit your App Dashboard and add the Marketing API product to your app.
IMPORTANT: For security, it is recommended that you turn on 'App Secret Proof for Server API calls' in your app's Settings->Advanced page.
When someone connects with an app using Facebook Login and approves the request for permissions, the app obtains an access token that provides temporary, secure access to Facebook APIs.
An access token is an opaque string that identifies a User, app, or Page.
For example, to access the Marketing API, you need to generate a User access token
for your app and ask for the ads_management permission.
Refer to Access Token Guide to learn more.
For now, we can use the Graph Explorer to get an access token.
- Go to Graph API Explorer
- Select correct App.
- Select User Token.
- Generate a user token with the necessary permissions.
- Click in icon info inside input token.
- Open token debugger from the Graph API Explorer
- Extend the access token. (Source = Web)
- Config this token in settings.
There are several ways to configure access token and app secret. If you only use one access token and app secret (example: an internal app managing only your own assets). You can set a global access token and app secret will be used across all requests
Config a ENV variable in a file like:
FB_access_token_app: 'YOUR_ACCESS_TOKEN'
FB_app_secret: 'YOUR_APP_SECRET'Your initialize is like this:
FacebookAds.configure do |config|
config.access_token = ENV['FB_access_token_app']
config.app_secret = ENV['FB_app_secret']
endIn your admin panel dashboard, access to Facebook Catalog, in settings config your business_Id, and can update your access_token.
Please raise any issue on GitHub.