Chances that you are publishing a Facebook publication link on the user timeline or to a Facebook fan page upon node creation are quite high.

The video tutorial and rules can help you greatly with that. The problem arises when you want to keep track of the changes in your node and reflect those changes in your Facebook publication. To do so you will need to store the facebook publication remote ID Facebook assigns to your publication when is posted.

The most common place to store this is in the Facebook Publication entity you created. Then the workflow is:

  1. Create the Facebook Publication entity.
  2. Publish the newly created entity to Facebook. This will return a facebook_publication_remote_id.
  3. Store the facebook_publication_remote_id in the Facebook Publication entity. There is a field specially designed for that.
  4. Save the Facebook Publication entity.

The only problem you need to solve is connect your node with the corresponding Facebook Publication entity(ies). The most simple way to do it is adding an entity reference field in your node type. This way you will need to:

  1. Create the Facebook Publication entity.
  2. Publish the newly created entity to Facebook. This will return a facebook_publication_remote_id.
  3. Store the facebook_publication_remote_id in the Facebook Publication entity. There is a field specially designed for that.
  4. Save the Facebook Publication entity.
  5. Set your newly created entity reference field to store your Facebook Publication entity.
  6. Save your node.

Now your node is connected with your Facebook Publication entity and this means that you can retreive the facebook_publication_remote_id associated with the node to feed the “Update Facebook Publication” rule’s action.

Comments

alejob86’s picture

Warning: Once we use this function every shared information as likes or comments at facebook will disappear on the post, because "Update in Facebook" function deletes previous post and creates a new one based on the previous id.

I could accomplish this using DEV version: fb_autopost-7.x-1.x-dev.
Let´s consider this scenario

Objective: Update a given post in facebook once a change on a given node has been made.

Requirement: Create an entity reference field into the Article content type

Relations :

Article (content type) fields

  • Body:value
  • Image:file:url

Are mapped respectively with these “Post” (facebook publication type) fields:

  • Field_facebook_message
  • Field_facebook_picture

Procedure :

Create a rule with

  • Events:
  1. After updating existing content
  • Conditions:
  1. Data Comparison (verifies if the updated content is of type Article)
  2. Entity has field (verifies if the updated content has a reference field)
  • Actions:
  1. Fetch entity by id (pull out the entity referenced in the updated Article)
  2. Create entity (create a facebook Post entity)
  3. Set a data value (assign fetched entity to the created post entity to access “post” particular fields)
  4. Set a data value (assign article body to field facebook message in the created entity)
  5. Set a data value (assign article image url to field facebook picture in the created entity)
  6. Update in facebook (update the created entity, which is basically the original entity)
  7. Set a data value (set the returned facebook ID into the created entity´s remote id field)
  8. Save entity (save the created entity, important: check forced option)
  9. Set a data value (assign the created entity to the node´s “entity reference” field)
  10. Save entity (save the “Node” , important: check forced option)

 

I could accomplish the objective with above steps, but there are better ways to do this. Any comment to improve this will be appreciated.

Note: Mateu gave me the hints to make this, without his help I couldn´t have done this.

I hope you find this useful. Thank you so much Mateu.

Best Regards.
Alejandro Bernal.

itshaseebanwar’s picture

Nice post Alenjandro

People if you want to see the step by step visuals for configuration of Drupal with facebook autopost, please visit the below link:

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

delacosta456’s picture

hi

Please it's looks like this step by step site is unavailable...

thanks

delacosta456’s picture

hi i am just thinking if Entityreference is really needed if the When creating the the return Id was saved...
and so when wanted to update , simply fetch_id of facebook publication by current edited node's id ?

Please let me know if i am right or wrong..

thaks