<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=822753331186041&amp;ev=PageView&amp;noscript=1">
  • Twitter Profile for Conversocial Social Customer Care Solutions for Business
  • LinkedIn Profile for Conversocial Social Customer Care Solutions for Business

Trending at Conversocial

Nought to Threaded Comments In 31 Thousand Seconds

By Christy O'Reilly on Apr 17, 2013 11:03:00 AM

How we integrated Facebook's comment replies in under 24 hours. 

It's five to nine and I've been working for about half an hour - I got in early today and am feeling productive in the quiet office. HipChat beeps:

We've been waiting for this for a few weeks now, so I know what this means: drop everything and start implementing.


I start poring over the Facebook documentation for their new functionality. I find that comments can only be nested one level deep: you can't have comments on comments on comments. There’s a new field we need to look for, the ‘parent’ of that comment, which shows up on nested replies. Using this, we can connect comments together properly in Conversocial.

I enable comment replies on my test Facebook page (for a charming character called Spidergoat), make a few posts and start playing with the Facebook Graph and FQL Explorer (interactive developer tools that Facebook provides for testing), verifying what I've read against the Facebook API responses. I make a few comment replies through the API too to test that we can publish as well as import.

By this point, Colin has arrived bearing coffee and we talk over the new feature. Gehan, who takes care of the Conversocial interface, makes his way in shortly afterwards, and we discuss what front end changes are needed to display comment replies effectively for our users. The single level of nesting means that we can display the parent comment and original post without worrying about flooding the screen and confusing our customers. Gehan starts coding the front-end changes, Colin will tackle replying to comments through Conversocial, leaving the imports of comment replies into Conversocial to me.

I turn my attention to our Facebook polling code and start planning how to integrate the new functionality. Facebook has a lot of different media types: posts, photos, videos, notes, links, questions; so we have generic code to import comments regardless of media type. This means that I only have to make changes to one function to import the new nested comments, and that we should hopefully be able to incorporate them faster.

I start making changes to the code and importing the test comments I previously created. The most important thing in this process is being able to iterate as quickly as possible: delete my test database, make a change to the code and import the comments again.


We have to account for paging. Our clients have some very popular content and the number of comments can often reach into the thousands. Asking for all of this data at once is a Bad Idea as it can slow things down, so we ask Facebook for 25 at a time to keep our imports snappy and reduce scope for error. We have multiple pollers pulling in messages concurrently, and there is no guarantee that a parent comment has been imported before its children (original comments that other fans have replied to). To get around this, if we can't find the parent comment in our database, we import it there and then, then attach the children to it, to ensure that our customers are always looking at the complete  context.

Colin ensures that integrating comment replies will not break another part of our Facebook pollers: we don't want the new functionality to come at the cost of disappointing our clients. He makes a comprehensive check that we can still import each different Facebook media type.

We work through lunch and get to the point where we're generally happy with our code in the early afternoon. It's peer review time. Reviewing each other's code has a lot of upsides: it makes more than one person familiar with all parts of the code base, ensures a consistently high quality throughout and also creates a good environment for learning and improvement through feedback. Colin and I review each other's code and then pair with each other on the suggested improvements. We look over Gehan's front-end changes together as well.  

We merge all our code into the main code base and start testing. And retesting. More comments replies get created on Facebook and we ensure they end up in our dev environment as expected, are displayed properly in the app and can be replied to. We deploy to our test server and get others in the company to join in too. Everyone gets very excited that it seems to work.

When we're satisfied that everything is working as expected, we deploy to the live site. Comment replies can be enabled on a per-page basis, so our change won't affect any of our customers until they choose to opt in. Yet more testing is done. Anna starts writing up the announcement of our speedy achievement.

Everything looks good. Now it's time for the pub. Everyone wants to buy us a pint to congratulate us for a job well done. =)

Topics: Customer Service

More in Customer Service


By Harry Rollason
Apr 20, 2018 9:41:59 AM


By Seleah Gardiner
Apr 17, 2018 5:02:58 AM


By Jason Valdina
Mar 28, 2018 4:57:16 PM

Join The Conversation!