How to Add a Comment Box to your Facebook Page

When you work with Facebook fan pages or applications, you may have encountered instances where you needed to write in FBML, or Facebook Markup Language. FBML resembles HTML with elements created specifically for Facebook purposes. In this short tutorial, I will show you how you can take advantage of this simple markup language to add a comment box to your Facebook page.

Facebook has made some changes with some of the parameters that can be used with the fb:comments tag in Facebook pages. For example, the candelete parameter, which allowed users to delete comments, no longer works. Instead, it is now replaced with an option to report any comments for spam or any other reasons. Also, the send_notification_uid does not work on Facebook pages. Thanks for all the great comments, guys!

In order to add the comment box, you need to have the Static FBML application added to your Facebook page. Then, proceed to the edit page and add the following snippet of code wherever you desire:

<fb:comments xid="your_id_here" canpost="true" numposts="5" publish_feed="true" simple="false">
<fb:title>Join the conversation!</fb:title>
</fb:comments>

This will output something resembling a Wall you will find on profile pages.

Let’s go over the various parts in the snippet:

xid

This is the unique id you will assign to your comment box. For example, if your Facebook page is called Nike Golf Shoes, you can assign the value “Nike_comments” The label can comprise of alphanumeric characters (Aa-Zz, 0-9), hyphens (-), percent (%), period (.), and underscores (_)

canpost

This property determines whether the viewer can post a comment on the page. It takes values of either “true” or “false.”

publish_feed

If set to true, the Post comment to my Facebook profile is checked automatically. The comment must be at least 5 words in length in order to be published to the user’s feed. Otherwise, this parameter will remain at its default value of false.

numposts

This property determines the maximum number of comments to display on the page. The default value is 10.

simple


If set to true, this parameter removes the rounded grey box around the Add a comment… link. Default value is false.

For more information on the FBML tag, fb:comments, check out the Facebook developer page.

In other news…

Join LonePlacebo on Facebook!

Update: Facebook has stopped supporting the Static FBML application. More info from Hubspot. I recommend using the Static HTML: iframe tabs app.

  • adam

    thank you
    but sending a notification didnt work , and im pretty sure its the right id

  • adam

    sorry to post again ..
    is there away to make it only admin can remove comment ?

    • http://loneplacebo.com/about Tony Hue

      Hey, Adam. I’ve looked into the fb:comments tag and it seems that Facebook has disabled the notification feature. However, it did not specifically mention Facebook pages being affected, but rather applications. I guess it is implied since both utilize FBML. You can find the full article here: http://www.insidefacebook.com/2010/02/02/fbcomments-tag-no-longer-notifying-users/

      As for being able to delete comments, you can simply change the candelete attribute to “true” temporarily and then delete the comment. Afterwards, just change the value back to “false”.

  • adam

    Thanks Tony

  • http://pureintegrity.com Teresa

    Thanks so much. it works great. :) )

    Question – Is there a way to have the box “Post comment to my Facebook profile” already clicked?

    • http://loneplacebo.com/about Tony Hue

      First things first…why would you want that? Some users would be annoyed about that if it is clicked by default, especially if they ignore it or don’t see it.

      According to the Facebook Developers page describing the fb:comments tag,

      Comments can be published to a user’s Feed only if the user checks Post comment to my Facebook profile. Previously, all comments would be published if developer set the ‘publish_feed’ parameter to true.

      Further down the page…

      Indicates whether to publish a Feed story when the comment gets posted. The comment must be at least 5 words in length in order to be published to Feed.
      Note: The comment can be published to a user’s Feed only if the user checks Post comment to my Facebook profile.

      In other words, no. The box cannot be checked off by default.

  • Yaron

    hi
    i was just trying to change the candelete from false to true in order to delete a comment. it doesn’t seem to have any effect.
    any ideas?
    thanks!

    • http://loneplacebo.com/about Tony Hue

      candelete no longer works. It was replaced by a report button for spammers. I’ve updated the post. Thanks for the comment, Yaron!

  • Yaron

    thanks. just saw your update.
    2 bad FB guys don’t update their doc as well…

  • http://www.kamalupatel.com Kamal Patel

    hey very well explained
    thanks for great information…keep it up

  • http://www.gsfans.org/ taner okutan

    cool. thanks…

  • http://tipsandtricksworld.com alex

    Steps to add facebook comments box to wordpress site in less than 10 minutes http://tipsandtricksworld.com/web-design/wordpress/adding-facebook-comment-box-to-wordpress-blog-in-10-minutes

  • http://www.facebook.com/commentscod?v=app_4949752878 shohan

    thank a lots tony
    its work great :D

  • nil

    H,
    its still not Posted comment to my Facebook profile

    i have only 30 members ?

  • emily subden

    Hi there

    Thanks for updating about not being about to delete comments, I’ve been trying to get this to work for ages. How though, do I go about report spam/abuse though? I can’t see a button.

    Thanks
    Emily

  • http://http://www.facebook.com/pages/Alan-azs/189569777726674(ThisisjustaTrialahahahahah) tuah moden89

    hai,ermmmm i had a problem that i had try to solved but never did it………….
    i can make a comment box to my pages but my problem is IF SOMEONE comment on the comment box,the comment they did didnt appear on their personal wall.I had to solved this due to i want their comment appear on theris facebook wall for marketing purpose.HELP MEEEEEEEEEE PLEASEEEEEEEEEEEEE anyone have an idea please send me a message to http://www.facebook.com/profile.php?id=100001568527822

  • stahnkestahnke

    Thanks for this article Tony. Did the report spam feature that replaced candelete get removed as well? I can’t find a report comment option anywhere. I really like the interactivity fb:comments offers but if I can’t control the content on our site I don’t know that I can continue to use it.

    Thanks,
    Scott

  • http://www.facebook.com/clubphysical Josh

    Incase you don’t see my fb:comment above, i’m having problems getting ‘like’ or ‘reply’ options to display under posts. Meaning that it would just end up as a list of unanswerable and unlikable posts. Help?

    You will see my problem here, where I am testing.. http://www.facebook.com/clubphysical?sk=app_7146470109

    Code:
    <fb:comments xid="ask_the_trainer" canpost="true"
    num_posts="3" width="350" simple="true" What is your question for our PTs?

  • http://www.fbaddiction.org/ Facebook Addiction

    I have been reading out some of your posts and i can claim pretty good stuff.

  • yk

    Hi Josh,

    I just discover an option from the code inside this page, you should add migrated=”1″ to let facebook recognize your application as use FBML (I guess) not XFBML. Look like this

  • http://www.facebook.com/Bewajah Bewajah Unnecessary

    i have posted your given codes on my page like this

    Join the conversation!

    later on i also want to add like and send box to the page but its not working.. :( please help me out,
    please have a look on page and help me out,,
    http://www.facebook.com/Pakistani.TogetherWeStand

  • Shovon Creative

    Thanks for giving a great tip.I also try it and it’s work..

  • Daniel Raider

    I’ve done that with the official Facebook tutorial.

  • http://twitter.com/Aivaras18 Aivaras

    http://www.addhop.com
    Addhop is a link sharing community website, where users can submit various content and discuss it via comments. User submitted content can be voted up or down, bringing the best links to the top for every user to see.

    link share, online community, new links, top videos, best pictures, ragecomics, web list

  • Anonymous

    Thanks for the article. Keep it up! provo web design

  • http://10pixel.com/ Ashish

    Wow. nice post. very helpful to ad me there a comment box in my page.
    thank you for this…