DEV Community

Nitesh Sawant
Nitesh Sawant

Posted on • Updated on

Facebook messenger bot that displays latest IT jobs in Goa, India

TL;DR

View source code on github

This weekend as a side project I created a simple Facebook chatbot, that notifies latest jobs posted on starupgoa.org

Goa is a land of Sea, Sand and Startups and starupgoa.org is one place where most of the IT jobs are posted.

The jobs on starupgoa.org are displayed like below.

startup go jobs

After looking in the network tab in chrome, I found the Ajax call that fetches jobs.

startup goa ajax

To get the experience in javascript,es6, and MongoDB, I chose to build this bot with Javascript.

I found this awesome article on Hackernoon on
How to Build a Facebook Bot App Using Node.js

The post will be very big if I start to explain the code line by. So I will quickly tell how the bot works.

How bot works in general

  1. Initially, I have fetched the latest 100 jobs from the website and have stored it in the database [used mlab as database].
  2. When a Facebook user clicks on Get Started button, Bot captures that user's id and store it in the database. It is used to send the push notification.
  3. When user types latest jobs in chat, bot fetches the latest five jobs from the database and displays it to the user.
  4. I Wrote a cron job using node-schedule that runs every day at 1 AM and fetches the latest jobs from the website and stores it in the database.
  5. If during cron job new jobs are fetched then bot send the push notification to the user with new Job.

Technology Stack

  • Backend : Node JS
  • Database : MongoDB mlab
  • Server : Heroku

Major Node Packages Used.

Demo

Currently the bot is in development mode and is not available for everyone.

Suggestions are welcome

If you have suggestions to improve the bot please do comment.

Need Help

I want to write unit tests for this bot, but I am not getting how to start with writing unit tests. If someone can help me with it,I will be really grateful.

Conclusion

This is a simple bot and I hope It will be helpful to the IT job seekers in Goa.

Top comments (4)

Collapse
 
mittalyashu profile image
Yashu Mittal

That's really awesome. Are you only going to keep it for Goa, or you have plans to extend it nation wide.

Collapse
 
ns23 profile image
Nitesh Sawant

As of now, I have not thought of extending it nationwide. Since the bot depends on startupgoa to fetch jobs in Goa. In case I find some API to retrieve Latest Jobs Nationwide, I will surely try to extend it Nationwide.

Collapse
 
mittalyashu profile image
Yashu Mittal

Can you create a seperate section in this post for the technology stack you are using?

Collapse
 
ns23 profile image
Nitesh Sawant

I have updated the post with technology stack used to develop the bot.