Disqus: How-To notify your authors of new comments

The commenting platform Disqus is really easy to get up and running and a great addtion to your blog.  However, there was one feature I needed for Inside the Agency that didn't appear to be as simple as it sounded.

disqus_logo_-_white_on_blue_background (1).png

An implied feature of any collaborative site (including Inside the Agency) is that each author who contributes to the site is notified of any new comments that were posted on their articles, but this is not a feature that Disqus handles directly.  Disqus can send notifications to each Disqus moderator when a new comment is posted but often the author is not a Disqus moderator so sending author notifications has to be handled outside of Disqus.

Disqus does provided you with a onNewComment callback which means you can notify the author of a new comment yourself and gives you a lot more control over what happens when new comment is posted.

The example below shows how you could configure the onNewComment callback to make an AJAX call to /comments/new and pass in the URL of the page the event was fired from.

Github Gist Placeholder

This example can be easily tweaked to use alternative ways of identifying which article the event has been fired from i.e. via a data attribute holding the article id.

Github Gist Placeholder

With the AJAX call in place you can now build the functionality behind /comments/new in your backend language (PHP in our case), retrieve the article that fired the event based on the data passed in the AJAX call, locate the author and then send an email to notify them of the new comment.

Adding this will help keep everyone happy.  Your authors will now know when a new comment is left and you will receive a higher engagement on the articles on your site as the authors and commenters can respond to one another in a timely manner.

Do you use Disqus as your comment platform or can you suggest a better alternative?  Have you had any additional features you have had to build in? Let us know in the comments below.


I am a web developer specialising in web driven applications using PHP, MySQL, Symfony and Zend and I am currently working for the The Drum in Glasgow, Scotland.

Most days I can be found frantically coding away with EuroDance in my ears and consuming what I hope to be a never ending supply of coffee... happy days!

Want more like this?

Keep up-to-date with latest news from Inside the Agency using any of the following services


Digital Ocean

Chris's Reading List

BFF @ SoundCloud

Our friends at SoundCloud embarked on a journey a few years ago that changed their system and moved it from a monolithic Rails application towards an ecosystem of microservices. Read more

The Drum

The Drum

Google'€™s AMP is bringing some much needed speed to mobile but the transition won'€™t be easy for publishers

A week after launching, the Google-led Accelerated Mobile Pages (AMP) initiative has raised more questions than answers for publishers... Read more



Quick Tip: How to Permanently Change SQL Mode in MySQL

MySQL 5.7 introduced some awkward changes for older codebases and tends to break apps. Here's how to temporarily (or permanently) lower the strictness level Read more



How to Build Your Own Dependency Injection Container

Andrew Carter builds a Dependency Injection container from scratch, showing you how that rocket science is really just fireworks strapped to lego figures! Read more



13 Reasons Your Organic Traffic is in Decline | It's Not a Penalty

The landscape of search engine optimization has changed drastically in the last 3-4 years. Even as it changes, a lot stays the same. It has been very challenging to see a multitude of friends and colleagues approach me with problems that often seem beyond repair with clients that they have worked with for years. Read more



WordPress Sites Now Support Google’s AMP To Make Mobile Pages Load Much Faster

Google has some big plans when it comes to making the web faster on your mobile phone. The company just added AMP-enabled pages in its mobile search results... Read more