Installing Social Post Facebook

Last updated on
30 August 2017

This page has not yet been reviewed by Social API maintainer(s) and added to the menu.

Social Post Facebook module depends on Facebook Base client library for the league oauth2 client library. Composer can automatically download the correct version of the SDK for you.

Overview of installation steps

  1. Create an app id and app secret from developers.facebook.com/apps/

  2. Download Social Post Facebook and Facebook Base library of TheLeague OAuth2 using Composer.

  3. Enable Social Post Facebook module and configure it.

Step 1: Create a Facebook App

  • Create a new app on Implementer Developer Page, the URL is listed in the settings page of the implementer.

  • The app might ask for a callback/redirect URI. The callback function is called by /user/social-post/facebook/auth/callback. However, you do not need to specify a valid callback URL as Facebook does not check if this value is matched in the request. Just make sure it is not a local URL, like localhost

Step 2: Install Social Post Facebook and Facebook library for The League OAuth2 Client using Composer.

On the the command line of your server, navigate to your Drupal root directory.

Let's inform Composer that we want to use packages.drupal.org/8 as a package repository:

composer config repositories.drupal composer https://packages.drupal.org/8

Now that Composer can search packages from Drupal 8 package repository, let Composer download Social Auth Google (and all its dependencies). The following command will download the latest 8.x-2.0 release of Social Auth Google:

composer require "drupal/social_post_fb:1.x-dev"

Step 3: Enable and configure Social Post Facebook module

Now that Composer has downloaded the Facebook base library, you can enable Social Post Facebook module.

  • The module settings can be configured on /admin/config/social-api/social-post/social-facebook.

  • Add your App ID/ App Secret (from step 1) to the module settings.

  • You probably also want to check your Drupal account settings at /admin/config/people/accounts and provide permission for specified roles to auto posting.

User Setup

Once the module is installed and configured, users can set up their account so they can post on Facebook.

  • Users who have a role with permission to post will find a "Social Post Facebook Add Account" button in their My Account Edit page (user/{user_id}/edit).

  • Users click on this Add Account button which redirects to the Facebook page specific to your app (configured in Step 1) and enters their credentials. If successful, they are redirected back to the user/edit page where their Facebook screen name will now be shown.

  • Posting is organized by user,  each having an independent account on facebook and whose credentials are not known to the Drupal site administrator.

  • The site admin can see which users have set up accounts by looking at admin/config/social-api/social-post/facebook/users.

Rules

You can alternatively use Rules to perform posting actions without writing any lines of code.

You can add Reaction Rules, specifying the event (e.g.: After saving new content) and conditions. Then, you can add the action post and add the status text value. For example, putting the value "{{ node.title.value }}" fires the Rule Action when new content is created and post the title of the new content.

Help improve this page

Page status: No known problems

You can: