Routing
Route an incoming message or event to a specific context of the conversation.
Last updated
Was this helpful?
Route an incoming message or event to a specific context of the conversation.
Last updated
Was this helpful?
It's a very useful feature when it comes to decentralizing the handling of incoming messages or events and thus to achieving a more distributed code.
A payload can contain a path to a context, in addition to the information that the payload normally carries.
The click event on "Create an Account" button will be handled by the ProfileContext
which will receive the payload without the context path information.
In order to implement this type of routing. In the NLP engine, just create an intent whose name starts with the name of an existing context in the project, followed by an underscore and the intent's own information. For instance: profile_sign_up
, where profile
is the context and sign_up
is the intent.
The profile_sign_up
intent will be handled by the ProfileContext and this will be able to capture the "sign_up"
intent, without path information.
In both examples, the click events will be be handled by ProfileContext
and param value will be "sign_up"
, without path information
In order to routing , just edit the config.routes.commands
field in , adding a line with the format :command => :context_name
for each command that we want to route.
Commands that have not been configured will be handled by the .
A click event on a can contain a path to a context, if the value of the params: ref
(Messenger) or start
(Telegram), starts with the name of an existing context in a given project.