Wednesday, October 15, 2014

MifosX Messenger - automated SMS notification app

As mentioned in my previous blog post, the architecture of MifosX makes it play very nicely with heterogenous technologies using the REST API and Webhooks to communicate. To fulfill my client's requirement, I started working on a SMS sending application to notify group members about financial transactions like loan repayments, and deposits and withdrawals to savings accounts.
I used the Sinatra framework of the ruby programming language because of it's simplicity. Though not as famous as Rails, it's elder brother, Sinatra is perfect for quickly writing great applications without enforcing a directory structure on the programmer. A simple application in sinatra can be as few as 5 lines. Your hello world in sinatra would look like (you won't believe this):

require 'sinatra'

get '/hi' do
  "Hello World!"
end

Having several years experience developing Web Applications, I've used several kinds of frameworks for different tasks. MVC frameworks like perl-Catalyst, ruby-on-Rails and python-django are great for developing modular applications. However, as the above code snippet shows, it's possible to get cracking with a much leaner and meaner application with a intuitive block for each request path and request type. I had the joy of using another microframework like Sinatra before: perl's Dancer framework. Dancer proved great for implementing a webhook handler app. With the help of CPAN's great array of libraries and modules, I could quickly develop an application with a few lines of code.

Having emphasized the simplicity and speed of developing with microframeworks like Sinatra, it's flexibility with directory structure shouldn't deter those looking to write maintainable applications. Since ruby itself is object oriented and provides neat ways to organize a growing project, it's possible to write a perfectly modular and well organized and maintainable application with Sinatra. In fact, MifosX Messenger uses a handful of classes which specialize in the different functionalities required to get the app working. The workflow starts when a financial transaction is recorded in MifosX.



As the above sequence diagram shows (click for full size view), MifosX Messenger gets notified when any financial transaction it has subscribed to is performed. It parses the JSON in the POST request data received and uses the clientId, loanId and resourceId to fetch information from Mifos via the REST API. Once it has collected the necessary information, it uses a MessageTemplate class to construct the SMS and sends it to the mobile number of the client.





4 comments:

  1. Having several years experience developing Web Applications, I've used several kinds of frameworks for different tasks Android Spy Software Without Physical Access

    ReplyDelete
  2. we can send Promotional SMS and Transactional SMS India by using these bulk sms services so its important for business.

    ReplyDelete