Represent all the modules about bot's answers and its specific types with an intention already given
messageTypes
--> Represent the answers typecommon.js
--> Manage the responsesutils.js
--> Utility function
-
Create new file in the corresponding directory:
-
if your intent is an answer to a message send by the user add a new file in
messageTypes/message
- This new file must export a class with a static function with this prototype
static action(senderId, message, entities, res)
and return a promise (see below). - In the exported object, the name of the key must be the intent name
- This new file must export a class with a static function with this prototype
-
if it's a response from a postback action button so create a new file in
messageTypes/postback
.- This new file must export a array of objects containing this two properties:
regx<String>
: the pattern the regex should be matching.action (senderId, postback, regx, entities, res)<function>
: the function which is going to be called and return a promise (see below).
- This new file must export a array of objects containing this two properties:
-
-
The return structure must be an object containing this properties:
feedback
: a boolean indicating if a request for feedback is neededresponses
: an array of objects (or promises) from generics