Autopost to Facebook

I ran into an issue with the Drupal for Facebook module, both for D6 and D7, where I wanted articles to auomatically be posted to Facebook when they are submitted.  There appeared to be no way to do this via the module and I had played around with Rules to see if that would work, but no luck.

I posted on Stack Exchange and actually got a useful reply...  I was aiming to figure out how to do a hook_form_alter, but was found that Rules and Form Events worked whlie I was testing the posted solution...

The thing I was missing was 

$form_state['fb_stream']['fb_stream_do_post']['#attributes']["checked"] = "checked"

['fb_stream']['fb_stream_do_post'] are the fieldset and field for the Post to Facebook checkbox.

The other little trick is that I only wanted to post to FB on the initial article creation but not any subsequent edits.  So I added the a condition that the current page URL matches node/add/article

The Rules Export (which also posts to Twitter) is 

{ "rules_form_alter_post_to_fb" : {
    "LABEL" : "Form Alter - Article Post to FB and Twitter",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_forms" ],
    "ON" : { "rules_forms_article_node_form_form_built" : [] },
    "IF" : [
      { "text_matches" : {
          "text" : [ "site:current-page:url" ],
          "match" : "http:\/\/www.example.com\/node\/add\/article"
        }
      }
    ],
    "DO" : [
      { "rules_forms_set_default" : {
          "form" : [ "form" ],
          "element" : "checkbox:fb_stream:fb_stream_do_post",
          "value" : 1
        }
      },
      { "rules_forms_set_default" : { "form" : [ "form" ], "element" : "checkbox:twitter:post", "value" : 1 } }
    ]
  }
}