Drupal 7.28
Created a rule that posts to a Facebook page. The post is shown on the Facebook page with the correct information, but the link shows up as Page not found. I looked for a read me in the tar file but did not see one. Any suggestions would be appreciated.

CommentFileSizeAuthor
#13 workingfb.jpg245.79 KBMtRoxx

Comments

MtRoxx’s picture

Issue summary: View changes
MtRoxx’s picture

I have tried two things

Set a data value in two different ways:
Parameter: Data: [site:url]/node/[node:nid]
Parameter: Data: [node:url]

If I ignore the PAGE NOT FOUND error on Facebook and click the link, the link works. So I'm really not sure if it is a problem with the module code. I wish I could just put the path on it and not have the display. Has anyone done that?

Export of rule:

{ "rules_post_to_fb_two_sites" : {
    "LABEL" : "Post to Fb Two sites",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "Facebook Autopost" ],
    "REQUIRES" : [ "rules", "fb_autopost_entity" ],
    "ON" : { "node_insert" : [] },
    "IF" : [
      { "NOT node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : {
              "date" : "date",
              "forum" : "forum",
              "mailhandler_source" : "mailhandler_source",
              "simplenews" : "simplenews",
              "eevent" : "eevent",
              "eevent_mailhandler_source" : "eevent_mailhandler_source"
            }
          }
        }
      }
    ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "facebook_publication",
            "param_type" : "link",
            "param_user" : [ "site:current-user" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:field-facebook-link" ],
          "value" : "[site:url]\/node\/[node:nid]"
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:field-facebook-message" ],
          "value" : [ "node:body:value" ]
        }
      },
      { "publish_to_facebook" : {
          "USING" : { "publication" : [ "entity-created" ], "pages" : "286244324796783" },
          "PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:facebook-id" ],
          "value" : "[facebook-publication-id]"
        }
      },
      { "entity_save" : { "data" : [ "entity-created" ] } }
    ]
  }
}
MtRoxx’s picture

So here is my work around. I set the Data Value to:
[node:body] To learn more visit: [node:url] The preview is gone, but so is the Page Not Found Error.

e0ipso’s picture

@MrRoxx, please post a screenshot of the Page Not Found error.

charles gantt’s picture

wjackson’s picture

@MrRoxx,

I ran into this issue as well. What fixed it for me was to update my rule to add a new "Set a data value" action, and created-facebook-post:field-facebook-name to be set with the node:title.

Hope this helps!

MtRoxx’s picture

@wjackson thank you for the feedback, I do not see created-facebook-post ?

wjackson’s picture

@MtRoxx,

The object that you're looking for will end with :field-facebook-name. The "created-facebook-post" part is the machine name that I had set on the entity that I created on my implementation. The :field-facebook-name object is what is used for the title of the post. Otherwise, when the new entity is created the node will not exist which results in having a page title of "Page not found".

Hope that this helps!

smuli’s picture

I fail to find the ':field-facebook-name'. More hints?

MtRoxx’s picture

Well, I have done my best to drill down, I have set conditions that the node is a certain content type, that the entity has the image field, that the field is not empty. I have flushed caches, uninstalled and reinstalled, and still I do not see the fields. I Just keep getting a subset of variables that my other sites have. All very interesting. Any suggestions would be appreciated.

soraver’s picture

Hi,
I run on the same issue.
Is it possible that facebook looks up the node before it gets saved?
I am not that good with rules, can we add a wait action before posting to facebook to test my theory?

@wjackson i also havent found the field you proposed in the rules. can we add it somehow from the module?

ps. i use the last dev version and i git cloned the sdk

soraver’s picture

here's the solution the way @wjackson proposed it :)

1) add 2 fields in the facebook link entity
2) edit the rules to fill those

1) go to admin/structure/facebook-publications/manage/link/fields
2) Add existing field: field_facebook_name
3) Add existing field: field_facebook_picture
4) go to rules and edit the "Add content to facebook" rule you have created
5) Add action -> Set a data value -> DATA: entity-created:field-facebook-name -> VALUE: [node:title]
6) Add action -> Set a data value -> DATA: entity-created:field-facebook-picture -> VALUE: [node:field-image:file:url]
7) keep the Publish to Facebook page rule last in the Actions list and try again.

It worked for me, so thanks @wjackson :)

MtRoxx’s picture

StatusFileSize
new245.79 KB

Thank you soraver. I do not know why, but I am missing several fields in the database. I have attached a copy of a working Facebook autopost site. The site I am working with does not have any of these fields.
I am concerned because I have uninstalled and reinstalled and still there are not there.
Working Autopost fields

soraver’s picture

Have you tried the latest dev version?

JulienThomas’s picture

Hi.

Just to confirm / explain, I faced same issue with a project, last version of autopost.
You can keep the url field and set it with [node:url]

It seems that the "Page not found" "Error" should more but "Title not defined".
What you have to do, as already said, is also defined the name field value, such as [node:title].

I set up both name and link and now fb posts have correct links with correct titles.

With the "Post" content type, you can add the message body and then the fb post is ready to go.

goinghome.fr’s picture

Hello,

I think this problem is exactly the same as the one raised here.

I have been running lots of tests to make this work on my website because I'm often away when I want my posts to be released (travel blogging). The solutions proposed above are just workarounds (title, image or whatever submission in the entity) but have a major problem as I will explain below.

Of what I understand, when posting a link on facebook: if it has never been posted before, it is crawled automatically to be able to provide a nice link preview and then cached.
When posting to facebook using Rules based on "After updating existing content" combined with "node goes from unpiblished to published", the facebook crawler gets a 403/404/whatever error. I think it is because the entity is sent to facebook before the publishing action is actually done.

That's why you get your link displayed as Page not found but still working. The link is valid at the end but the crawler gets there too early, before the node were actually released as published and accessible to anonymous users. This can be verified using the facebook debugger that shows the crawler gathered information. All it gets from this action is 403/404 response.

More than that, using the workarounds proposed earlier (title, image...) is a problem because YOUR posting on facebook is showing well but the crawler still gets the bad informations. Then if someone paste a link of your publication on facebook, the preview will be the 403/404 stuff, unless the crawler refreshes its databases (not sure it does, or on what time basis).

As long as your website has correct meta informations in your page, all you need to provide is the link address (for a link post) and the rest will be grabbed by the crawler. All I populate for my link entity are field-facebook-message and field-facebook-link and the crawler gets everything else perfectly from the

I don't know if the "node updating" event can be modified to be done after the node is actually published so I found another workaround that is easy to set. It works like a charm with the facebook crawler and the fields and metas I mentionned above. The solution is to use the scheduler and to set the event for the rule being "After a node has been published by Scheduler".

Have a nice day/afternoon/evening, wherever you are in the world.
Thanks for all the good work.

fonea’s picture

as #12 said go to:
= admin/structure/facebook-publications/manage/link/fields and there you should have:
- field_facebook_link;
- field_facebook_message
- field_facebook_published
- field_facebook_scheduled_publish
- field_facebook_name
- field_facebook_picture
- field_facebook_description
if are not there the fields add them from exiting fields; and then in rules set value for
- entity-created:field-facebook-link => [site:url]/node/[node:nid]
- entity-created:field-facebook-message => [node:field_facebook_event_message] (custom field defined by you)
- entity-created:field-facebook-name => [node:title]
- entity-created:field-facebook-picture => [node:field_image]
- entity-created:field-facebook-description => [node:body]

this should work,
thanks

e0ipso’s picture

Category: Bug report » Support request
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

luison’s picture

Perfect!! Instead of using facebook-link, use facebook-page and set field-facebook-name to node:title.