Categories

(104)
(47)
(60)
(15)

Facebook auto posting at the click of a button!

09.12.2015
Facebook auto posting at the click of a button!
Author:

Useful tips by the developers of our Drupal development
 
company make social networks closer and
 
your life easier ;) Once we told you about
 
Drupal modules for social network integration.
 
Now it’s time to discuss Facebook auto posting.

Today, if a website doesn’t have its own page in at least one social network, it is considered incomplete and is unlikely to get high ratings. Lots of people almost live in social networks and follow websites’ news directly from there. Thus, to make your life easier and avoid posting your news both on your website and on your social media page, consider setting up auto posting. This way, when you post something on your site, it will automatically be published on your social media page as well.

Today I'll tell you how to set up auto posting from a Drupal site to Facebook.

So let’s start. First you need to create your own application (New App) https://developers.facebook.com.

auto posting from a Drupal site to Facebook

Select "Web page". Next, Facebook lets you name your application. After that, you will be offered codes to embed on your site. We are not interested in those right now, so let’s just fill in the site address. Then you will see the application main page.

auto posting from a Drupal site to Facebook

On this page, you'll see an App ID (the ID of your application that you will be using in the future) and an App Secret (the application secret key).

Then go to "Settings" page.

auto posting from a Drupal site to Facebook

Fill in "Namespace", write the website domain, your email and website address. Save. If you do not have the block with the website address, then click "+ Add Platform" and select "Web Page".

auto posting from a Drupal site to Facebook

Then go to the "Status & Review" page and enable your application.

auto posting from a Drupal site to Facebook

We are through with the Facebook settings. The next step is to configure Drupal. For that, we need Facebook Autopost module and facebook-php-sdk. Enable the Facebook Autopost module, and put facebook-php-sdk in the libraries folder. Go to the /admin/config/services/fbautopost module settings page.

auto posting from a Drupal site to Facebook

Insert App ID and App Secret from your application page on Facebook. Save it and log in. Once you are logged in, you will be able to choose a page where to post.

auto posting from a Drupal site to Facebook

You also need to give permission to the Facebook Autopost app on the admin/people/permissions page. Next, if you want to be able to choose which content to post, you need to check the "Post to Facebook" mark. To do that, add a field in the type of content you need to post (it is desirable not to change the machine name).

auto posting from a Drupal site to Facebook

You should also look at the page of Facebook publication type settings: admin/structure/facebook-publications. Here you can configure the publication types. By the way, when creating rules, we will use fields of the type that are present on the page.

Rules

To make everything work, you need to create another rule: admin/config/workflow/rules. Name it "Post to Facebook after making an update".

Events

auto posting from a Drupal site to Facebook

Conditions

auto posting from a Drupal site to Facebook

In conditions, choose what type of content to post and see whether there is a check mark in the "Post to Facebook" field. For automatic posting you can skip this check and not create the check mark.

Actions

auto posting from a Drupal site to Facebook

Create a new entity to transform your content type into the type that you can post on Facebook.

auto posting from a Drupal site to Facebook

Then convert the fields of your content type into corresponding fields of content for posting.

auto posting from a Drupal site to Facebook

When the required fields are converted, the most important part begins — posting on Facebook. Create the "Publish to Facebook page" action.

auto posting from a Drupal site to Facebook

To keep control over what you post, save your entity. That's all. Now let's talk about possible mistakes. The most common error is “Insufficient permissions to publish on page with id xxxxxxxxxxxx. Please check your configuration.” Here you just need to verify that you have correctly specified the page for posting in the settings/admin/config/services/fbautopost and the page where to post in the rules.

Useful links:

http://www.thesstech.com/drupal-how-configure-facebook-autopost

http://www.thesstech.com/drupal-how-fix-Insufficient-permissions-publish-page-with-id

4 votes, Rating: 5

Read also

1

Hey there! If you are interested in Drupal web development, tips by our dev could do you a world of good....

2

In one of the recent blog posts by our developer, we offered you Drupal 8 development tips. Today, we'...

3

SASS and LESS preprocessors make front-end development much easier. To compile them to CSS...

4

If you want to begin studying Symfony web development, this Symfony2 framework tutorial by our developer could...

5

Hello, everyone! The release of Drupal 8 is almost here, but its beta version is available for use now....

Need a quote? Let's discuss the project

Are you looking for someone to help you with your Drupal Web Development needs? Let’s get in touch and discuss the requirements of your project. We would love to hear from you.

Join the people who have already subscribed!

Want to be aware of important and interesting things happening? We will inform you about new blog posts on Drupal development, design, QA testing and more, as well news about Drupal events.

No charge. Unsubscribe anytime