A Chatbot holds a sequence of steps where each step represents an interaction with a user. The user may navigate sequentially between the defined steps in the Chatbot.
ChatBots are stateless so the information of the chat for each user is kept in a {@link ChatbotSession}. Each {@link org.jivesoftware.xmpp.workgroup.Workgroup} will havea different Chatbot.
Currently the bot steps are hardcoded but a future version may let them be dynamic. The current step is kept in the ChatbotSession as an integer number. When filling out a data form a substep is used to register the current question that the user is completing. These are the current supported steps:
- step = -1 - The chat session was just created but no message was sent.
- step = 0 - The welcome message was sent to the user. Since the user will receive the join question after the welcome message then this position is changed immediatelly.
- step = 1 - The join question was sent to the user and an answer is expected.
- step = 2 - The user decided to join the workgroup so the dataform is presented to the user. Each field in the dataform will generate a new message for the user. After the question was answered then the next message is sent. The same step value will be used for all the dataform fields. For each question a substep is used to represent the current question that the user is completing. The user may go back or repeat the question by sending commands.
- step = 3 - The user completed the form and joined a queue. At this point only commands are accepted from the user.
- step = 4 - The user left the queue since a room invitation was sent to him to start a chat session with an agent. At this point the user may ask to receive the invitation again.
- step = 5 - The user accepted the invitation and is now having a chat with an agent. At this point only commands are accepted from the user.
- step = 6 - The user has finished the chat with the agent and is asked if he wants to receive the chat transcript by email.
- step = 7 - The user wants to get the transcript by email but hasn't specified an email address so ask him to enter an email address and then send the chat transcript by email.
The Chatbot allows the user to execute commands. Commands may help the user go back to previous questions so he can change an answer or repeat the last question in case the user closed his window accidentally. These are the supported commands:
- back - User is requesting to go back one step in the dialog and repeat the previous message
- repeat - User is requesting to repeat the last message
- help - User is requesting the list of available commands
- bye - User is closing the chat session no matter the if he already joined a waiting queue or not
- position - User wants to know his position in the waiting queue
Future ideas - Configure the chat bot with JIDs of agents or admin that are allowed to:
- obtain workgroup and queue statistics
- obtain current workgroup configureation
- change the chatbot configuration
- change the workgroup configuration, etc. etc. etc.
- After the user ends the chat session with the agent offer the user to fill out a QoS survey.
@author Gaston Dombiak