We Now Support Notifications Via Webhooks

Quick Summary

Because all good blog posts start with a meme…

We now support webhooks on our Enterprise Plan.

You can define a url that NfR will send an http post request to with the data in json format of the request body. Below is the current format that you can expect from an NfR:

For reddit posts and comments you can expect the following json to be in the body of the http request you will receive:

    "type": "post",
    "text": "Hello Reddit World!",
    "subreddit": "nfr_test",
    "url": "https://reddit.com/r/nfr_test/comments/kcqtvf/test_post/",
    "title": "Test Post" 

Let us know if you need any changes to this format.

Video Tutorial

Written Tutorial

A lot of our users have requested that we support receiving notifications via Webhooks and not just emails. We now have support for that functionality and let me run you through a quick example of exactly that works.

On my localhost, I have a simple flask application running that just going to print the json of an HTTP post request that it receives through the terminal. Also at the same time, I have ngrok running and it’s mapping a publicly accessible URL to my localhost application running on port 5000.

Shows a flask application running configured to receive the notification

Now I’m going in and type inside the Notifier for Reddit dashboard. You can click on Add Searcher.

  • Search String: We’re going to do just a simple string match of Hello Reddit World!
  • Posts/Comments: We want to find posts and comments.
  • Case Sensitivity: No case sensitivity.
  • Notification Interval: Notification interval needs to be instant for Webhooks.
  • Notification Type: Here instead of email, I’m going to select webhooks
  • Webhook URL: I’m going to enter in the URL http://472132f276cf.ngrok.io, the public URL that ngrok has given me that maps to my localhost
  • Include/Exclude Subreddits?: none
Add Searcher page on Notifier for Reddit dashboard showing how to set up to receive notifications via Webhooks

Now we’re going to click on Add so it’s ready and the Searcher is running live. So we proceed to our test Reddit and type in Hello Reddit World! and submit the comment. This is going to find a match and we should expect to receive a post request with the JSON results in just a few seconds. There it is and as you can see below and as you know:

  • type: comment
  • text: Hello Reddit World!
  • subreddit: of course, is nfr_test
  • url: https://reddit.com/r/nfr_test/comments/kcqtvf/test_post/gfvxxqo/ that you can click on to get to that exact post.
  • title: Test Post. Also, one important thing to remember is that for comments, what you see under the title, that’s actually the title of the parent post. If this was a post, it will the title of the actual post itself.
Shows the notification one will received after a comment was made using the Search String Hello Reddit World!

And that is essentially how this all work. What you can do with your own web server that you have running somewhere or maybe some endpoint running in AWS that you have set up, you can take this data, this Webhook that we’ve created, and you can push that in your own systems, do whatever you will with it.

Let us know if you have any questions. Or if you need any additional functionality around this, maybe a change of the format of the Webhook, just let us know.

Leave a Comment