0

I am using Facebook Autopost module for drupal 7.

Following the instructions in from here, I went up with rules scheduler to delay posting of nodes to facebook by few minutes but it is not posting to facebook and showing

enter image description here

My current rule definition is:

{ "rules_facebook_post_delay_post" : {
"LABEL" : "Facebook Post delay post",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_switch_user", "rules_scheduler" ],
"ON" : { "node_update--article" : { "bundle" : "article" } },
"IF" : [
  { "NOT data_is" : {
      "data" : [ "node:field-category:0" ],
      "op" : "IN",
      "value" : { "value" : {
          "17" : "17",
          "19" : "19",
          "26" : "26",
          "27" : "27",
          "20" : "20",
          "15" : "15",
          "18" : "18",
          "24" : "24",
          "23" : "23",
          "22" : "22",
          "16" : "16",
          "21" : "21",
          "14" : "14",
          "25" : "25"
        }
      }
    }
  },
  { "NOT data_is_empty" : { "data" : [ "node:field-media-new" ] } },
  { "node_is_published" : { "node" : [ "node" ] } }
],
"DO" : [
  { "rules_switch_user_action_switch_to" : { "account" : [ "node:author" ] } },
  { "schedule" : {
      "component" : "rules_post_to_facebook_rule",
      "date" : { "select" : "node:changed", "date_offset" : { "value" : 1 } },
      "param_fb_article_post_rule" : [ "node" ]
    }
  },
  { "rules_switch_user_action_switch_back" : [] }
]

} }

And current rule component definition is:

{ "rules_post_to_facebook_rule" : {
"LABEL" : "Post to Facebook Rule",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules_switch_user", "rules", "fb_autopost_entity" ],
"USES VARIABLES" : { "fb_article_post_rule" : { "label" : "Post to Facebook Article compoent", "type" : "node" } },
"DO" : [
  { "rules_switch_user_action_switch_to" : { "account" : [ "fb-article-post-rule:author" ] } },
  { "entity_create" : {
      "USING" : {
        "type" : "facebook_publication",
        "param_type" : "link",
        "param_user" : [ "fb-article-post-rule:author" ]
      },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-facebook-link" ],
      "value" : "[node:url_www]"
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-facebook-picture" ],
      "value" : "[node:mdm_facebook_picture]"
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-facebook-description" ],
      "value" : "[node:mdm_facebook_description]"
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-facebook-message" ],
      "value" : "[node:mdm_facebook_message]"
    }
  },
  { "variable_add" : {
      "USING" : { "type" : "integer", "value" : "105777439461526" },
      "PROVIDE" : { "variable_added" : { "fb_pub_id" : "FB Publication ID" } }
    }
  },
  { "publish_to_facebook" : {
      "USING" : { "publication" : [ "entity-created" ], "pages" : "105777439461526" },
      "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" ] } },
  { "entity_fetch" : {
      "USING" : { "type" : "node", "id" : [ "fb-article-post-rule:nid" ] },
      "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
    }
  },
  { "rules_switch_user_action_switch_back" : [] }
],
"PROVIDES VARIABLES" : [ "fb_article_post_rule" ]

} }

I have also used rules switch user to switch users based on posted author so that this anonymous issue during cron run can go but not working for me as facebook publication id and facebook authentication is not working for me.

0

Ok the problem was I set value incorrectly in rules component. Instead of [node:url_www] it should had been [fb-article-post-rule:url_www] which was causing facebook authentication issue as there was no link to post to facebook what is defined in their facebook app.

Not the answer you're looking for? Browse other questions tagged or ask your own question.