Dialogue Cloud

How to configure a simple Chat Bot in Dialogue Studio

In this article we how to build a Chat Bot with Dialogue Studio. A chatbot can be used to handle dialogue before contacting an agent or to be self-serving. In this scenario, we have prepared a simple chatbot that responds to specific keywords.

Preview

Prerequisites

Configure

Follow the steps below to configure a simple Chat Bot in Dialogue Studio:

  1. Login to your Dialogue Studio environment

  2. Open or Create a Tab where you want to add the Simple Chat Bot

  3. From the menu in the top right, select “Import” and add the following JSON.

    Copy
    JSON
    [{"id":"6b0b8046.48e77","type":"incoming-message","z":"4a4f1586.66fb0c","name":"","key":"","x":790,"y":500,"wires":[["8c358d84.1d699","f44e0c5e.f919"]]},{"id":"8c358d84.1d699","type":"switch","z":"4a4f1586.66fb0c","name":"Check for channel","property":"payload.channelId","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":6,"x":1230,"y":500,"wires":[["3095a7b0.271df8"],["89ea2479.88b168"],["89ea2479.88b168"],["89ea2479.88b168"],["89ea2479.88b168"],["89ea2479.88b168"]]},{"id":"3095a7b0.271df8","type":"enqueue","z":"4a4f1586.66fb0c","name":"","flowid":"1234","x":1500,"y":340,"wires":[]},{"id":"39eed966.124fc6","type":"comment","z":"4a4f1586.66fb0c","name":"Readme for Channel Id's","info":"With the Channel Id's you can easily route customers based on the channel they are using:\n\n0\tEmail\n1\tSms\n3\tWhatsApp\n4\tWebChat\n5\tGeneric\n\nThis example shows how all channels, except Email, can be routed to the chatbot.","x":1250,"y":420,"wires":[]},{"id":"5801fac2.db9094","type":"say","z":"4a4f1586.66fb0c","name":"","text":"\"Welcome to the Anywhere365 ChatBot. \\nHow can I help you today?\"","dataType":"jsonata","x":1910,"y":440,"wires":[["89eef8da.0499e8"]]},{"id":"89ea2479.88b168","type":"switch","z":"4a4f1586.66fb0c","name":"Check Flow ID","property":"payload.flowId","propertyType":"msg","rules":[{"t":"null"},{"t":"eq","v":"1","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1500,"y":500,"wires":[["5801fac2.db9094"],["63527b4.5f34f84"],["dd9e2e88.2083"]]},{"id":"e440225e.49cbc","type":"comment","z":"4a4f1586.66fb0c","name":"Readme for information about FlowID","info":"This is to check which stage of the conversation the customer is currently engaging in. The following values indicate the different stages: \n\nNULL        = This is the initial message.\n1           = Customer has been greeted and is responding to the greeting.\nOtherwise   = Any other stage that is not expected.\n\nTip: Always include an 'otherwise' option to ensure the customer does not get stuck.","x":1570,"y":440,"wires":[]},{"id":"8ebb4c5.24355b","type":"comment","z":"4a4f1586.66fb0c","name":"Email sessions will not be routed to the chatbot","info":"","x":1620,"y":300,"wires":[]},{"id":"5ba40723.c5aa08","type":"comment","z":"4a4f1586.66fb0c","name":"New sessions will start with a greeting","info":"","x":2010,"y":400,"wires":[]},{"id":"89eef8da.0499e8","type":"wait-for-message","z":"4a4f1586.66fb0c","name":"","flowid":"1","x":2570,"y":440,"wires":[]},{"id":"b049cd87.6cf9","type":"comment","z":"4a4f1586.66fb0c","name":"Update the FlowId","info":"","x":2570,"y":400,"wires":[]},{"id":"63527b4.5f34f84","type":"switch","z":"4a4f1586.66fb0c","name":"Check customer feedback","property":"payload.message","propertyType":"msg","rules":[{"t":"regex","v":"(talk|agent)","vt":"str","case":true},{"t":"regex","v":"(website|site)","vt":"str","case":true},{"t":"regex","v":"(question|faq)","vt":"str","case":true},{"t":"regex","v":"(bye)","vt":"str","case":false},{"t":"else"}],"checkall":"true","repair":false,"outputs":5,"x":1970,"y":580,"wires":[["7254d8ef.4cf288"],["c6e5afae.0122e"],["7989b945.e6bd48"],["25a15e9b.bea3a2"],["d62cc413.69ed18"]]},{"id":"a80086eb.cc8cc8","type":"enqueue","z":"4a4f1586.66fb0c","name":"","flowid":"1234","x":2600,"y":560,"wires":[]},{"id":"8ddfeed6.52e6d","type":"comment","z":"4a4f1586.66fb0c","name":"Readme for information about feedback","info":"Check the customer's response and route the conversation using regex to identify multiple keywords. Additionally, ensure to add an \"otherwise\" option to avoid leaving the customer stuck.","x":2010,"y":520,"wires":[]},{"id":"7254d8ef.4cf288","type":"say","z":"4a4f1586.66fb0c","name":"","text":"I will connect you with an Agent.","dataType":"msg","x":2410,"y":560,"wires":[["a80086eb.cc8cc8"]]},{"id":"caf7f096.7919a","type":"comment","z":"4a4f1586.66fb0c","name":"ToDo add API Key","info":"","x":790,"y":460,"wires":[]},{"id":"c6e5afae.0122e","type":"say","z":"4a4f1586.66fb0c","name":"","text":"Visit <a href=\"https://anywhere.now/\">Anywhere.now</a>","dataType":"str","x":2410,"y":640,"wires":[["1539ef49.4906d1"]]},{"id":"dd9e2e88.2083","type":"enqueue","z":"4a4f1586.66fb0c","name":"","flowid":"1234","x":1500,"y":580,"wires":[]},{"id":"f6385655.9ed678","type":"enqueue","z":"4a4f1586.66fb0c","name":"","flowid":"1234","x":2660,"y":860,"wires":[]},{"id":"1539ef49.4906d1","type":"wait-for-message","z":"4a4f1586.66fb0c","name":"","flowid":"1","x":2630,"y":640,"wires":[]},{"id":"9009542d.4a9628","type":"comment","z":"4a4f1586.66fb0c","name":"Inform the customer and enqueue the session","info":"","x":2530,"y":520,"wires":[]},{"id":"36f0e110.82652e","type":"comment","z":"4a4f1586.66fb0c","name":"You can also add hyperlinks in the response","info":"","x":2530,"y":600,"wires":[]},{"id":"7989b945.e6bd48","type":"say","z":"4a4f1586.66fb0c","name":"","text":"Visit our <a href=\"https://golive.anywhere.now/faq/faq.html\">FAQ</a>","dataType":"str","x":2410,"y":680,"wires":[["6bccd5ec.c9f20c"]]},{"id":"6bccd5ec.c9f20c","type":"wait-for-message","z":"4a4f1586.66fb0c","name":"","flowid":"1","x":2630,"y":680,"wires":[]},{"id":"d62cc413.69ed18","type":"say","z":"4a4f1586.66fb0c","name":"","text":"Sorry, I didn't understand that. Let me route you to an agent.","dataType":"str","x":2410,"y":860,"wires":[["f6385655.9ed678"]]},{"id":"91b285e2.31f6f8","type":"comment","z":"4a4f1586.66fb0c","name":"Always make an escape so the customer doesn't get stuck","info":"","x":2570,"y":820,"wires":[]},{"id":"25a15e9b.bea3a2","type":"say","z":"4a4f1586.66fb0c","name":"","text":"Glad to help, hope to talk to you again soon.","dataType":"str","x":2410,"y":760,"wires":[["66bdb4b2.beecbc"]]},{"id":"66bdb4b2.beecbc","type":"disconnect","z":"4a4f1586.66fb0c","name":"","flowid":"1","x":2610,"y":760,"wires":[]},{"id":"f44e0c5e.f919","type":"debug","z":"4a4f1586.66fb0c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":320,"wires":[]},{"id":"8a0c7fa0.3a297","type":"comment","z":"4a4f1586.66fb0c","name":"Thank the customer and disconnect the session","info":"","x":2540,"y":720,"wires":[]}]
  4. Open the Incoming Message node and enter the API key you configured in the Plugin Settings

  5. To test your chatbot, initiate a Text Channel in the Dialogue Manager and enter a message containing one of the keywords. You should then receive a response from the chatbot.

  6. If you need to customize or extend the chatbot, you can open the Tab, modify the nodes and responses as needed, and save your changes.

  7. Test the chatbot again to make sure it works.

  8. Congratulations, you have now successfully configured a simple Chat Bot in Dialogue Studio!

Explanation

Below we will explain specific parts in the flow.

Check for Channels

This part of the flow will check which channel the customer is using (e.g. Email, SMS, WhatsApp, WebChat, Generic).

With the Channel Id's you can easily route customers based on the channel they are using

  • 0 Email

  • 1 Sms

  • 3 WhatsApp

  • 4 WebChat

  • 5 Generic

This example shows how all channels, except Email, can be routed to the chatbot.

Check for Flow ID

This part of the flow will use a Flow ID to determine which part of the conversation the customer is in.

This is to check which stage of the conversation the customer is currently engaging in. The following values indicate the different stages:

  • NULL = This is the initial message.

  • 1 = Customer has been greeted and is responding to the greeting.

  • Otherwise = Any other stage that is not expected.

Tip: Always include an 'otherwise' option to ensure the customer does not get stuck.

Responding and waiting for a message

This part of the flow will respond to the customer with a greeting and wait for their response.

At the say node, you can type the message you would like to send to the customer. Adding linebreaks can be done with the /n command. To ensure the conversation can continue, it is important to insert a flowId. To make it easier to extend the chatbot for future scenarios, make sure to use a logical naming convention for the flowId.

Check for customer feedback

This part of the flow will check the customer's response for keywords and route the conversation accordingly.

Check the customer's response and route the conversation using regex to identify multiple keywords. Additionally, ensure to add an "otherwise" option to avoid leaving the customer stuck.

Responding and enqueue the session

This part of the flow will respond to the customer and enqueue the session to be connected with an agent.

Once the enqueue node is chosen, the Plugin Flow Settings will dictate the session's subsequent logic.

Responding and disconnecting the session

This part of the flow will respond to the customer and disconnect the session if the customer has indicated they are done.

Once the customer indicated they were satisfied with the assistance, thank them for using the chatbot and disconnect the conversation.