GeekTrainer / botframework-routing

3 stars 0 forks source link

Bot Message Routing (component) [Typescript]

This project is a message routing component for chatbots built with Microsoft Bot Framework Node SDK. It enables routing messages between users on different channels. In addition, it can be used in advanced customer service scenarios where the normal routines are handled by a bot, but in case the need arises, the customer can be connected with a human customer service agent.

For an example on how to take this code into use, see botframework-handoff.

(TODO) Possible use cases

This is a Typescript solution, but don't worry if you prefer the C# SDK; in that case check out this sample!

Implementation

(TODO) Terminology

Term Description
Aggregation (channel) Only applies if aggregation approach is used! A channel where the chat requests are sent. The users in the aggregation channel can accept the requests.
Connection Is created when a request is accepted - the acceptor and the one accepted form a connection (1:1 chat where the bot relays the messages between the users).
Party A user/bot in a specific conversation or can represent a channel (e.g. specific conversation channel in Slack) itself.
Conversation client A reqular user e.g. a customer.
Conversation owner E.g. a customer service agent.

(TODO) Interfaces

IRoutingDataManager

An interface for managing the parties (users/bot), aggregation channel details, the list of connected parties and pending requests.

(TODO) Classes

MessageRouterManager class

MessageRouterManager is the main class of the project. It manages the routing data (using the provided IRoutingDataManager implementation) and executes the actual message mediation between the parties connected in a conversation.

Properties
Methods

(TODO) Other classes

AbstractRoutingDataManager implements the IRoutingDataManager interface partially and is the base class for both LocalRoutingDataManager and AzureTableStorageRoutingDataManager. It contains the main logic for routing data management while leaving the storage specific operation implementations (add, remove, etc.) for the subclasses.

AzureTableStorageRoutingDataManager implements the IRoutingDataManager interface. The constructor takes the connection string to your Azure Storage.

LocalRoutingDataManager implements the IRoutingDataManager interface. Note that this class is meant for testing and provides only an in-memory solution. Do not use this class in production!

Party holds the details of specific user/bot in a specific conversation. One can think of Party as a full address the bot needs in order to send a message to the user in a conversation. The Party instances are stored in the routing data.

MessageRouterResult is the return value for more complex operations of the MessageRouterManager class and methods of the IRoutingDataManager implementation. You are responsible to handle these in your bot code.

For classes not mentioned here, see the documentation in the code files.

Contributing

This is a community project and all contributions are more than welcome!

If you want to contribute, please consider the following:

Please do not hesitate to report ideas, bugs etc. under issues!

Acknowledgements

Special thanks to the contributors (in alphabetical order):

Note that you may not find all contributions in the change history of this project, because all of the code including this core functionality used to reside in the botframework-handoff project.