Redesign the events and actions mechanism
Requirement
As a component administrator, I would like more flexibility in the definition of ‘events’ (how the component reacts to an incoming HTTP request) and ‘actions’ (how the component reacts to an incoming XMPP message) so that I can create richer and more complex interactions.
ce38b0fc)
Present state (as of commitEvents
These are defined at two levels:
- a function under
/lib/WebhookHttpApi/middleware
tries to detect an incoming webhook's type and if a match occurs, it despatches a message containing the type identifier and relevant information about the request, such as its payload; - a YAML file contains EJS templates that define, for each event type identifier, different aspects of the XMPP message to be produced, such as body, subject, various XMPP features, etc.
Actions
Actions are defined in YAML or JSON objects that are then uploaded to the component by an administrator. The specification of those YAML / JSON objects has a number of limitations, such as supporting only one HTTP request per ‘command’ (incoming XMPP message); another limitation is not being able to keep state, which makes it impossible to build progressive dialogues or more complex workflows.
Proposed solution
Use a plug-in, subprocess or remote procedure call (RPC) mechanism (or any combination thereof). In either case, an API must be defined for argument and response passing.