Messenger bots are hot. So, as part of our community activity, we created a Ruby gem for them. As always at Netguru, we focused on quality and ease of use.
We wanted to create the easiest and fastest way to integrate FB bots with RoR apps. Why? Because the existing solutions lacked:
- wrapping payload data sent back to Facebook
- automating the bot verification process (subscription)
- full documentation
- full test coverage
- parsing payloads fetched from Facebook
- having made a first (v1.0.0) release!
We decided to start this little project as part of our internal “give back to the community” program. Two developers were involved on a part-time basis. Together, we spent about 40 hours creating this gem, which has 160 commits. Initially it worked quite well, but was buggy, so we added additional time to polish it.
We used the traditional Agile method. First, we just wanted to make it work and it took us one full day to create the first iteration. Then we looked at Facebook’s documentation and started implementing the next key features. We’ve created full, complete README documentation.
To be honest, during development, we were surprised about several limitations of the Facebook API. For example, you are not allowed to send more than 3 buttons in a button template. If ‘timestamp’ is not in timestamp format, the Facebook API throws out a ’Temporary send message failure’ error.
We discovered that sometimes an FB bot gets stuck if you forget to send a ‘successful response’ code after each POST request sent to Facebook. The best solution is just sending a ‘subscribe (verification)’ request.
Our solution: we’ve created (in our opinion) the best open-source RoR gem for the Facebook Messenger Platform. Version 1.1.2 has all the key features proposed by the Facebook API, has full documentation and 100% test coverage.
That’s not all - we’ll soon publish an end-user oriented implementation of our gem. Stay tuned!
- 160 commits
- 100% test coverage
- Code Climate 4.0
- 6 releases
- Loads of fun