Setting up your Chatbot | Chatbot Library
Skip to main content

Setting up your Chatbot

Get started by Creating our chatbot Throught Dialogflow and Connecting to Zaroc.

Or Look at these 2 Tutorials in Spanish with Mizar Tutorial 1 Tutorial 2.

1.- Create a Chatbot on Dialogflow

First Lets Create our Chatbot on Dialogflow HERE

  • When entering you should Create an Account on Google (If you don't have), after that you'll be moved to the Dialogflow Platform
  • If you are new in Dialogflow I recommend this Youtube Channel that have good to know Tutorials from zero to Hero HERE
  • Then you Should create an Agent (Chatbot)
  • Type a Simple Hello on the Console (Right panel) and Wait for the response

If you got your Chatbot responded you Let's go to the next part!

2.- Setting Zaroc & Bot Templates

Ask Zaroc bot (The moon icon at the right down corner) to Download Zaroc Library, try something like (I Wanna Download the library) Or Click HERE for 1.4

==================================================

On your root folder, Unpack the file, and you will have a folder named Chatbots with Zaroc and Sion(a chatbot template)

.

Keep in Mind

Remember that you need a PHP/Nodejs server Running online

.

After that, your folders should have this order

root

└───Zaroc-1-4
β”‚ Zaroc
β”‚ test-bot

Now, lets check that test-bot (chatbot template) is requiring Zaroc

Inside of the Folder of your ChatbotExample you should see some folders and some files, open the file named chatbotExample.php

If you imported successfully Zaroc and ordered as shown before, you should see that this Chatbot is requiring Zaroc, if you changed the routers/folders hierarchy, remember to change the path.

require_once("../zaroc/zaroc.php");

3.- Connecting Chatbot with Dialogflow

Once you imported successfully, right now your ChatbotExample knows how to handle Dialogflow, so we are going to Connect our ChatbotExample Backend with Dialogflow.

  • Go to Dialogflow, and in the option Fulfillment
  • Enable Webhook
  • In the URL path you should put the Chatbot core file, this should be
    'https:// rootDomain.com/chatbots/chatbotExample/chatbot.php'
  • We are going to use basicAuth so we need a Key and Password Values, move to your ChatbotExample Folder
  • Inside of the core folder you should see a file named variables.php Open It!
  • At the top there are two variables named chatbotName and chatbotPassword, these values are the key and the password
  • So you can type in the basic Auth, then press the Blue Save button at the bottom of the Page.

4.- Testing Zaroc on Current Chatbot

Right now Zaroc is connected to our Chatbot that is connected to Dialogflow, we just need Test the connection and we'll be done

Dialogflow Section
  • Create a Intent named test
  • On Training phrases put 'test'
  • On Responses let's create a default response of 'Test πŸ’₯'
  • Then go down and open the section of Fulfillment and click on Enable Webhook Call for this Intent
Server Section
  • Go to your Chatbot Template folder and open the Intents Folder
  • Right here we should have all the Intents ordered by Category and other stuff that you can check on Documentation πŸ˜‰
  • Open the file named test.php, you should be able to see some code like this.
<?php
if(intent('test')){
triggerError([],['Message from the backend']);
}
?>
Testing on Dialogflow

In order to test we should go right now to Dialogflow and type on the console the word 'test'

If we got the response of 'Message from the backend' Congratulations.

Errors

Keep an Eye

If you got haven't got anything, or an Error.

What's next?

  • Check all the Tutorials, lets Create our First Intent!