Inspiration

We(Loveneesh & Palash) have been coding for close to 5 years. From our early days as a student to employees of this very wonderful passionate for tech organization called ThoughtWorks, we've been making our way through typical exceptions, existing libraries, pondering over tonnes of documentation and getting our hands dirty with open source software. This process, however enticing it may sound to other developers, certainly isn't that straightforward. Our usual approach is to search(read Google) documentation or errors and being greeted with some 20 odd links and finally, after checking each one out do we receive an answer to our questions. We wanted to save time of other developers, by giving them exactly what they're looking for. Why go through the tedious task of searching through data, when you can just get the work done with a couple of words using your new buddy “coDoc”. With the ever-growing number of chatbots and people's growing interest and ease to use them, we decided a chat with our very own coDoc bot would be much more time saving and would cater to your specific needs. Our mantra is - don't just search and spend your entire day staring at your monitor, instead hit up Facebook and chat with coDoc - your guide to code documentation.

What it does

coDoc is a ChatBot highly equipped for helping the developers and making their lives less miserable. It's a one-stop shop for everything. You don’t have to ponder upon different websites and search for what you want. coDoc equips you with everything. We thought Facebook messenger would be the best place for the bot, as it would also allow us to promote the bot and make direct contact with our target audience. A Facebook page would be a great place to build the community, asking for reviews and feedback. You can search for errors, stack traces, documentation, etc. using keywords provided by coDoc. Use our simple conversational UI, search via @help, @sof , @dd. You will receive recommendations with links. Let's get going, coders!

Now you must be wondering why should you use FaceBook, let me tell you why? Firstly it is used by close to billion of people every day every hour every second so accessibility is something which will allow maximum people to use it. Secondly, there’s no separate platform required for our Chat Bot as FaceBook provides a super cool platform which the developer can use very easy to develop a ChatBot.

Annotations :
@help : This helps the developer to find various annotation and command present in the bot .
@sof : StackOverFlow annotation is used for making search on StackOverflow site and allow users to do advance searching .
@dd : This annotation is useful to find documentation of any syntactical fragment like classes, methods or even constants.

How We built it

coDoc is built on Messenger Platform and we are using Node JS as our backend. We first designed how the bot will really look like, In our bot there are mainly 4 parts :

  1. Engine
  2. Parser
  3. Renderer
  4. Webview

All the four components are connected to the Core of the Bot.

  • Core gets the message and delegates to all other components i.e Renderer, Parser, Engine.
  • Engine deals with all the external entities (like StackOverflow) and provides the fetched result to the Core.
  • Renderer knows about the look and feel of the bot, so whatever message the renderer receives, it edits those into a JSON object and sends it, which the send API understands.
  • Parser processes the message decides the respective Engine the message came from and sends it to the Core.
  • The webviews are basically to display search results in a more efficient way by utilizing messenger_extensions

Challenges We ran into

  • Testing: Testing plays the most important role in the development process of any application, and our biggest challenge was to make sure our application is smooth and bug-free. In order to do so we needed a better testing environment, test suites, and real and simulated scenarios.

  • Our Major concern while testing the application was to get an environment to deploy the application to test it, as testing in local was a bit tricky. We overcame this challenge by using the fb-local-chatbot, which allowed us to run the chatbot locally and simulate the exact behavior of the application. But the working of the fb-local-chatbot differed from the actual messenger in terms of functionalities and limitations, to outrun that problem we created a staging environment.

  • Testing on real messenger app as well as keeping the actual bot bug free, an automated pipeline to maintain two environments : All set and now we have two different environments to handle, which created a lot of ruckuses as deploying, maintaining was taking a lot of time. To knock this manual problem down we came up with our own automated pipeline, which will deploy the code hassle free.

  • We faced problem regarding gathering data from devdocs.io. Since they have no rest API to search for a keyword, so we built our own manual scraper to do the job for us.

  • StackOverflow gave us a tough time to get the search results as their API documentation lacks proper formatting due to which we have to filter out the keywords and messages to get more accurate results.

What We Learned

  • Messenger Api: We came to know about send API and how chatbot works based on webhook. We have realized the end to end flow from user message to an automated reply to the chatbot.
  • ES 6: So the bot backend is totally written in ES 6. Which gives me readable, powerful and robust syntax. we have use a lot of frameworks over ES 6 and even the async-await feature is really impressive to use.
  • Pipeline: Initially testing and maintaining a production-ready chatbot was difficult since the only way of testing is via messenger itself so we have created an automated pipeline for continuous delivery using gitlab-ci. And it helped us to smoothly manage 2 deployment environment i.e. Testing, Production.
  • StackOverflow Api: StackOverflow provides a very good API to search and customise your search on the basis of various parameters.
  • Messenger Extension: Although sendApi provides a lot of Templates for the user interface inside bot, but it is not sufficient to portrait our imagination about UI. so we have learned and use messenger extension to enrich UX. And made our bot more user-friendly .

Accomplishments that We are proud of

We incorporated all the good coding principles while developing the bot - readability, extensibility, modular programming. We have tested with numerous test suites for all our components. We’ve created(which we feel proud of) a deployment pipeline which gives us the advantage to deploy our flow in two different environments (testing & production). As a developer, we love agile coding and wanted to follow the same so we also created a trello board to track our progress. Ensuring that we are following all the good programming practices helped us to define the code quality of our bot. We kept the code modular and designed it in a better way so that it can be extended to a great extent. In a very short period of time, this project has taught us a lot. We are proud that we have built a tool, that can benefit the others in our community.

A bot which can search through 254 languages in a second and give you best replies. This is one of the best accomplishment that we are proud of, apart from this we have also included the small talk feature that allows coders to talk to the bot which is really fun, isn’t it ?

What's next for coDoc

We want to build on top of the capabilities coDoc already has, new annotations like @get which can bring all the open source software download link so that one can get all the download link at one place. We are also thinking of creating our first ‘two-way-information-flow’ feature in which we will store solutions of a particular stack trace of an exception given by developers, and share it with others when they face the same stack trace. Better NLP feature so that the bot can understand the intent of the user and on the basis of the saved intent it can give a better search result.

Demo Video

Built With

Share this project:
×

Updates