Issue #6786 in Rocket.chat repo is an issue covering this general topic. We have an urgent need to add FB Messenger style rich chatbot messages and plan to do it in our fork but want to make sure our approach is at least somewhat aligned with the overall team vision for this. Our immediate need is Android support but of course we’d like to see the features implemented in web and IOS as well. The issue for tracking Android support is #1027 in Rocket.chat.android repo.
Our requirement is to support a subset (not clear which we need yet) of the following rich messages (https://developers.facebook.com/docs/messenger-platform/send-messages) as well as persistent menus, https://developers.facebook.com/docs/messenger-platform/send-messages/persistent-menu.
I’d like to discuss here some aspects of the design to see if we can implement an approach that will align with the upstream Rocket.chat team thinking/approach.
First, we are using a modified version of hubot-apiai adapter to direct message a bot that is implemented in dialogflow/api.ai. This bot will send back rich messages to the hubot adapter which will send them to the Rocket.chat server, which will send them to the Rocket.chat client. Our initial version will be Android (IOS and Web to follow).
Design question #1: Can we simply add a new attribute (“customResponse” or something) to the message object that is passed through the Rocket.chat server and sent to the Android client? Would this require a modification to the Rocket.chat server or would it simply pass the attribute through to the client? And, would this break IOS and web clients?
Note: if a server change is required we understand that it should probably be implemented as a Rocket.chat.app but that feature is not yet ready so we’re guessing we’ll need to fork the server code and modify it.
Design question #2: For persistent menu support, should this be an attribute associated with the user that the bot is associated with? Is it possible to extend the user object with attributes that would include the data needed to describe these persistent menus?