Table of Contents

    What Is A Chatbot?

    Chatbot is an artificial intelligence-based computer program that can simulate chat or conversation with users in natural language. This process is done through messaging or through the telephone. It means chatbot can through voice as well as text and can be sent over websites .applications such as hike, Twitter, Facebook messenger, or WhatsApp. ManekTech provides high-end chatbot development services & solutions to brands, startups & SMEs for every industry. Talk to our experts today!

    How do they work?

    Chatbot works on following two different tasks.
    1. User Request: In this task user or person request to Robot for the particular action.
    2. Return Response: in this task, the Robot robot gives a response to the user request.

    Following are some methods which are used by the chatbot to work:

    Pattern Matchers:
    As per this name in this method Chatbot uses the pattern to understand the user request and generate the best appropriate responses as per user request.
    These patterns are built in a standard structure which is “Artificial Intelligence Markup Language” (AIML).

    Example :
    <aim Version:”1.0” encoding = “UTF”>
    <category>
      <pattern>WHO IS NARENDRA MODI</pattern>
         <template>Narendra modi is the Prime Minster of India.</template>
    </category>

    In this pattern chatbot matches the name NARENDRA MODI in patterns and gives the answer.

    Algorithms:

    every sort of request, a unique pattern must be accessible in the database to give an appropriate reaction.
    With bunches of mix on the pattern, it makes various leveled structure. We use Algorithms to lessen the classifiers and produce a more reasonable structure.

    In this method assume a set of sentences are given which are belonging to a particular class.

    With new information sentences, each word is meant for its event and represents its shared trait and each class is doled out a score. The most elevated scored class is well on the way to be related to the information sentence.

    For example :

    class: greeting
    “How are you?”
    “good afternoon”
    “Whatsapp??”

    Types Of ChatBoat

    Rule-based chatbots:
    - This is predefine chatbot
    - Rule-based chatbots follow the predefined ways during discussions. At each progression during the discussion, the user should pick from express choices that decide the subsequent stage in the discussion.
    This chatbot is easy to use
    Suitable for answering common queries.

    Conversational chatbots:

    - This is AI-based chatbot
    - Conversational chatbots are likewise referred to as remote helpers or computerized partners. They are considerably more intuitive and customized than rule-based chatbots. The conversational chatbots banter with the clients as in a manner people speak and impart, in actuality, circumstances.
    -this chatbot learns from user behavior and gives the response.
    -understand the complex conversation and give a more relevant answer

    Live Chat

    - Live chat is customer support and sales teams respond to a customer’s question in real-time.
    - Teams can respond through a messaging app and help create a better customer experience on their website, or mobile app.

    Example of Chatbot

    1. World Health Organization (WHO)

    The World Health Organization (WHO) is one of the main wellsprings of confided data for the coronavirus (COVID-19) spread. WHO constructed a bot on WhatsApp called the WHO Health Alert to share data identified with the pandemic.

    2. National Geographic

    National Geographic created a conversational chatbot who spoke like Einstein would. While most companies blast promos into your chat window, they utilized Einstein bot to follow clients discussion and answer with data about the show and other fascinating bits.

    3. Hike

    The Hike is a social messaging app for chat. Natasha on a hike is your personal assistance on your hike. Technically, She is a female bot in Hike Messenger. It is a computer program that works as an intelligent personal assistant and knowledge navigator as a part of Hike Messenger. It's somewhat similar to Google Now in Android and Siri in Apple.

    4. Dominos

    The Domino’s chatbot can reorder previous orders, offer a full menu, and track deliveries all in Messenger.

    How to build your first chatbot?

    Chatbot Platforms

    1.Beep Boop
    Beep Boop is a simple hosting platform for your Messenger bots. Host, deploy and share your bot in seconds.

    2.Botkit
    includes a variety of tools, like Botkit Studio, boilerplate app starter kits, Botkit studio, and a core library.

    3.DialogFlow
    Dialogflow is a Google-owned framework.That enables users to develop human-computer interaction technologies that can support Natural Language Processing (NLP).

    Build a chatbot using DialogFlow

    So, here we are starting our first chatbot in the DialogFlow framework which is provided by Google.

    The following are the steps of developing your chatbot in DialogFlow.

    Setup in DialogFlow Account

    Following are the steps of setup in account
    - Go to https://dialogflow.com/
    - Go to console’ in the top right corner.
    - Click Sign-in-with Google


    Creating an agent in console

    - Start by clicking ‘Create Agent’ in the column menu to your left.
    - Give your Bot a name! We’re going to give “PizzaBot”.
    - Also, add language and Time Zone
    - Click ‘Create’.

    - Before starting the build the chatbot there are two words you have to know:
    1. Intents
    2. Entities

    -Intents means nothing but the intention of the user, what the user wants to do.
    For Example the user could ask any question and if these are words defined in the console then they will be detected.

    - Entity means term or object in the specific context in intents or in the user’s input.

    Add Entity for chatbot

    - In the column menu to your left you can read the tab Entities.
    - Our chatbot is for pizza ordering so related entities are like

    • Restaurant
    • Order
    • Payment

    - Click the ‘+’ button of the Entities tab.
    - Tap the create entity button and type the entity name and click the 1st row.
    - Users may use other names for restaurants so you should add some synonyms of restaurant.
    - As per the above steps create all three entities with their synonyms.

    .

    Add intents for chatbot

    - Click the ‘+’ button of intents tab and type Default welcome intent
    - This is welcome intent so users say something like Hii!, How are you? And other similar terms like that.
    - Add these terms in the Training phrases section.

    - Now scroll the page and you will find the response section.
    - In this section add some default responses with “what can I do for You?”

    so, here is done your welcome intents.

    - if you want to check your 1st intents then on the intents page at the right side there is one pane Type anything in this pane.
    For Example: Write Hii! And check if your agent gives an expected response or not.
    -Now Let’s create the second intent for order pizza
    - Same as above tap create intent button and type name of intent.
    - Now, the user wants to order pizza so he/she may be asking “I’d like to order pizza from restaurants”
    - Add some similar terms like as above for pizza order.

    - When you enter “I’d like to order pizza from restaurants” in Training phrases and enter agents recognize the entity “restaurants”.
    - Now in this intents agent should do give information about nearby pizza points and ask for what user would like to order?
    - so Here We add some static pizza points information for fake responses from agents.
    - Add terms like as below picture to the response section in this intent.

    - Save the intent and go back to the page.
    - Now take your cursor over the Begin order intent and click the “Add follow-up intent”.
    - Select custom intent and it will create Begin order-Custom
    - Click Begin order-Custom.
    - The last response of the agent was What would you like to order? ..So the user should respond with what he/she wants to order like “I would like to order one margarita with extra cheese.”
    - So you should predict what user might say, For this Demo filled some terms like as:

    - Now the Agent should respond with the price of pizza of user order and ask about payment methods.
    - So, Again add some dummy data for the response of the user as below.

    - Save the intent.
    - Now, Create the last intent “Payment” for what payment method the user would use for payment.
    - Now, it is easy to create intent as we did it twice above.

    - Finally Add the response of bot for confirmation of payment.
    - Save the intent and that is done.

    Create iOS Demo for this

    - I have already built the app ChatBot Demo and set the UI using text field and label and connect their IBOutlet in view controller file.

    - After this you can install the Api.Ai SDK using cocoa pods.


    Let’s begin with Appdelegate.swift

    - Type Following in AppDelegate

    port ApiAI

    - Now we have to configure with Client access token in didFinishLaunchingWithOptions method

    - If you don’t know how to get a client access token then don’t worry about that we guide you to get access token.
    - Go to the Dialogflow console and click the setting tab of PizzaBoat.
    - Under the general tab you can find client access token just copy it and paste in your appdelegate.

    - Now we create code in the view controller file for send messages to the agent and get a response from the bot.
    - First, add the following line to the view controller.swift

    port ApiAI
    port AVFoundation

    - To get connected our device to user add the following line to the view controller.

    - Here we import AvFoundation because this framework has AVSpeechSynthesizer an object that provides speech from a text and gives you control over ongoing access.
    - When the user types the message and sends the message the request should be sent to the bot as below.

    - The next step is this request is sent to the agent.
    - We get a response from the agent and might be we get a failure for the request so we have to handle this with a failure block.

    - At last we call the enqueue method and specify the request using the following code.

    - Finally, Your IBAction for send message looks like:

    Run your app and check your bot.

    GitHub Link:  https://github.com/manekdilip/ChatBot---DialogFlow

    Hire developers from a top chatbot development company to build your own chatbot. Manektech provides various chatbot development services and develops chatbots for Facebook, Telegram, Slack, and Microsoft. Chat bot development for a smarter and efficient workflow.

    About Author

    Manektech Team

    ManekTech Team

    ManekTech is a well-known software development and IT consulting company, providing custom software, website, and mobile app development services. ManekTech has own content writing and development team who writes content on various and trending technology that it serves currently.

    Subscribe to Our Newsletter!

    Join us to stay updated with our latest blog updates, marketing tips, service tips, trends, news and announcements!

    OUR OFFICES


    ManekTech's Global Presence

    USA

    4100 NW Loop 410, Suite 200, San Antonio, Texas, USA 78229

    UK

    7 Artisan Place Harrow, HA3 5DS

    India

    4th Floor, Timber Point, Prahaladnagar Road, Ahmedabad, Gujarat - 380015

    Germany

    Franz-Joseph-Strasse, 11,Munich, 80801, Germany

    South Africa

    The Business Centre No 1. Bridgeway Road, Bridgeway Precint, Century City, Cape Town, South Africa, 7446

    PREV
    NEXT