Loading...

Follow PragnaKalp Blog on Feedspot

Continue with Google
Continue with Facebook
or

Valid
PragnaKalp Blog by Pragnakalp Techlabs - 3d ago

Nowadays emojis are being integral part of text-based chat conversations. People love to use it ever now and then to express their emotions better.

But what if a user is communicating with a chatbot and send an emoji as response? Mostly bots fail to understand it and come back with default response. In Dialogflow, there is no direct support for emoji handling. If a user respond with emoji then agent will respond back with generic reply ‘Can you say that again?’, ‘Sorry, what was that?’, ‘I didn’t get that. Can you repeat?’ set in Default Fallback Intent.

Instead of going to Default fallback intent, Dialogflow should be able to detect that there is an emoji input and respond accordingly.

General Solution

A simple solution is to create one intent and add all the emojis one by one as training phrase. So that when user gives input with emoji then that intent will be triggered and you can perform action or reply accordingly.

But there are more than 1500 emojis so adding them as training phrase one by one will be a cumbersome task. Also, Dialogflow allows 1000 training phrases per intent (on their official document it is mentioned that an intent can have maximum 2000 training phrases but as per our testing, it was giving error for 1000+ intents.). So, you will need to create multiple intents for that.

Our Solution

To get rid of this emoji issue, we have created intents for emoji handling. These intents support all the emojis that we use in conversation and it can be imported in any existing Dialogflow agent.

After importing these intents, if Dialogflow agent receives emoji input then it will trigger the appropriate intent where you can set an appropriate response or perform any action you would like.

Fill up the form below to download your emoji intents for Dialogflow.

* indicates required
Name *
Email Address *

We are providing zipped file of emoji intents with same responses for any emoji input. You can change response as per your need in each intent.

How to import emoji intents in your bot

To import emoji intents, extract zipped file you downloaded. You will find 7 JSON files:

  • Activity_emoji.json
  • Flags_emoji.json
  • Nature_emoji.json
  • Objects_emoji.json
  • People_emoji.json
  • Symbols_emoji.json
  • Travel_emoji.json

Each file contains intent with the different emojis as training phrases.

Flags_emoji.json file would have all the flag emojis as training phrases, People_emoji.json would have all the people emojis as training phrases and so on.

Now, to import these intent, open your Dialogflow agent. And click on 3 vertical dots menu on right side of Create Intent button.

You will see 2 options. Click on “Upload Intent” menu.

You can see Choose file button to upload intent. Select intent from extracted zip file and upload it.

As soon as you will upload file, Dialogflow will automatically create an intent from it and you will get to see the message “File FILE_NAME.json uploaded successfully.” on right bottom of your screen.

Upload all the intents one by one and check in intents list.

All uploaded intents are displayed in list. These intents cover all popular emojis.

Now you can try to input emoji in conversation with bot. It will display custom response for emoji input instead of default fallback response.

Hope you find this useful. If you have any other idea to make this better then do leave your feedback in the comment section. We’ll improve it further.

Disclaimer

Using these intents you can not create specific response for each emoji. If you would like to do that then you can try Emojibot. It’s not free but the money you spend will go in charity. So, we encourage it.

The post Emoji Handling in Dialogflow appeared first on Pragnakalp Techlabs.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

If you are looking to get started with building Speech Recognition / Audio Transcribe in Python then this small could be very helpful and will provide basic insights to get started.

Why Python?

Python has rich libraries to offer which will make your life fairly easier while developing complex applications. Many of the things you will find pre-built and you can build your functionality on top of it.

For speech recognition too, Python has many libraries to make your development process easy and faster.

And one more thing, if you are familiar with C/C++ or PHP or any other basic language then learning Python becomes pretty easy. It has got easy learning curve.

Usage of Speech Recognition

Speech recognition could be very useful in number of applications. Especially in personal assistant bot, dictation, voice command based control system, audio transcriptions, quick notes with audio support, voice based authentication, etc.

Let’s Get started

Install Python

It is good if you are little familiar with Python. If not, then no worries. It will take little longer but you should be able to reach to the end successfully with some extra efforts.

For this tutorial, we’ll be using Python 3.x. Let’s start from level 0 by installing python. If you have Python already installed on your system then you can skip this step and jump on to next one.

Now, to install Python there could be multiple ways. Either you can install Python standalone or install distribution like Anaconda which comes with Python.

You can download Python from: https://www.python.org/downloads/ (latest version as of writing this tutorial is 3.7.3) and follow instructions given on https://www.youtube.com/watch?v=dX2-V2BocqQ

Or if you select to use Anaconda, then you can follow the instructions at https://conda.io/docs/user-guide/install/index.html

Install required libraries

There are some excellent libraries available which you can use to build your speech recognition. For this tutorial, we are going to use

  • SpeechRecognition
  • pyaudio

Install packages using following commands:

pip3 install SpeechRecognition

Now, before installing pyaudio for your audio input/output stream, make sure you install portaudio with the following command

sudo apt-get install portaudio19-dev

“portaudio” is a python independent C library, so it cant be installed using pip). If you dont have portaudio installed, you might encounter the following error:
ERROR: Failed building wheel for pyaudio

pip3 install pyaudio

Now, your general setup is ready.

In SpeechRecognition library, there are different methods for recognizing speech from an audio source using various APIs. Various methods use various third party speech detection services. We are going to explore:

  • recognize_google(): Using Google Web Speech API (this API comes by default upto some functionalities)
  • recognize_sphinx(): Using CMU Sphinx – requires installing PocketSphinx
  • recognize_wit(): Using speech recognition service provided by wit.ai
  • For IBM Speech to Text: SpeechRecognition’s method (recgonize_ibm()) didn’t work due to credential issue as IBM has udpated the credential system. So we made our own method to make calls to IBM speech recognition.
1. GOOGLE WEB SPEECH API

If you are using the default Google Web Speech API, then you don’t need to install any extra packages/libraries apart from the ones mentioned above.

Below is the code for Speech to text with input of audio by Microphone:

import speech_recognition as sr

r = sr.Recognizer()
speech = sr.Microphone(device_index=0)
for recognizing speech
with speech as source:
print("say something!…")
audio = r.adjust_for_ambient_noise(source)
audio = r.listen(source)
Speech recognition using Google Speech Recognition
try:
recog = r.recognize_google(audio, language = 'en-US')
# for testing purposes, we're just using the default API key
# to use another API key, use r.recognize_google(audio)
# instead of r.recognize_google(audio)
print("You said: " + recog)
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))

If you want to transcribe speech from an audio file then you can do it easily by providing audio file and process it through Google API. Below is the sample code for that.

import speech_recognition as sr
r = sr.Recognizer()
file = sr.AudioFile('FILE_NAME.wav')
for transcripting audio
with file as source:
    audio = r.record(source)
Speech recognition using Google Speech Recognition
try:
    recog = r.recognize_google(audio, language = 'en-US')
    # for testing purposes, we're just using the default API key
    # to use another API key, use r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")
    # instead of `r.recognize_google(audio)`` 
    print("You said: " + recog)
except sr.UnknownValueError:
    print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
    print("Could not request results from Google Speech Recognition service; {0}".format(e)) 

It is as simple as that.

But you must remember that the audio format for the audio is limited to .wav, AIFF, AIFF-C, FLAC only.

A very crucial advantage of the Google API is its accuracy. But it also has a disadvantage, i.e, not all its functionalities are available for free.

2. CMUSPHINX

So, another alternative to the Google API is CMUSphinx. It is an offline speech recognition API which is its USP. But it is lesser accurate than Google Web Speech API.

If you are using cmusphinx, you need to install the following packages or you will get a building wheel error due to missing swig file. To overcome this, use the command below.

sudo apt-get install -y python python-dev python-pip build-essential swig git libpulse-dev

then:

pip3 install pocketsphinx

pocketsphinx will be successfully installed.

The python script for the PocketSphinx API (Speech) looks something like this:

import speech_recognition as sr

r = sr.Recognizer()
speech = sr.Microphone(device_index=0)
for speech recognition
with speech as source:
print("say something!…")
audio = r.adjust_for_ambient_noise(source)
audio = r.listen(source)
recognize speech using Sphinx
try:
recog = r.recognize_sphinx(audio)
print("Sphinx thinks you said '" + recog + "'")
except sr.UnknownValueError:
print("Sphinx could not understand audio")
except sr.RequestError as e:
print("Sphinx error; {0}".format(e))

The python script for the PocketSphinx API (Audio) looks something like this:

import speech_recognition as sr
r = sr.Recognizer()
file = sr.AudioFile('FILE_NAME.wav')
for audio transcription
with file as source:
    audio = r.record(source)
recognize audio using Sphinx
try:
    recog = r.recognize_sphinx(audio)  
    print("Sphinx thinks you said '" + recog + "'")  
except sr.UnknownValueError:  
    print("Sphinx could not understand audio")  
except sr.RequestError as e:  
    print("Sphinx error; {0}".format(e))

Inaccuracy is a major drawback of the PocketSphinx API.

3. IBM Watson Speech to Text

The IBM Watson Speech to Text API is also a major speech recognition engine that can be incorporated in an application that requires speech recognition or audio transcription.

To begin with IBM’s API, you first need to have an IBM Cloud account. Once you have created your account, follow the following steps.

  1. from the top left navigation menu on the dashboard, go to Resources list.
  2. then, click on Create Resource.
  3. then, in the categories section, select AI and select Speech to Text. Create your service without changing anything.
  4. after your service is created, click on the service.
  5. select manage from the navigation menu and click on show credentials.
  6. copy the api key and url generated.

Run the following commands in the terminal.

pip3 install ibm-watson

The python script for the IBM Watson Speech to Text (Audio) looks as below. You will need to update your API key and URL.

import speech_recognition as sr
from ibm_watson import SpeechToTextV1
import json
r = sr.Recognizer()
speech_to_text = SpeechToTextV1(
    iam_apikey = "YOUR_API_KEY",
    url = "YOUR_URL"
)
with open('FILE_NAME.wav', 'rb') as audio_file:
    speech_recognition_results = speech_to_text.recognize(
        audio=audio_file,
        content_type='audio/wav'
    ).get_result()
print(json.dumps(speech_recognition_results, indent=2))

The python script for the IBM Watson Speech to Text (Speech) looks something like this:

import speech_recognition as sr
from ibm_watson import SpeechToTextV1
import json
r = sr.Recognizer()
speech = sr.Microphone()
speech_to_text = SpeechToTextV1(
    iam_apikey = "YOUR_API_KEY",
    url = "YOUR_URL"
)
with speech as source:
    print("say something!!…")
    audio_file = r.adjust_for_ambient_noise(source)
    audio_file = r.listen(source)
speech_recognition_results = speech_to_text.recognize(audio=audio_file.get_wav_data(), content_type='audio/wav').get_result()
print(json.dumps(speech_recognition_results, indent=2))
4. WIT.AI

Wit.ai is a natural language interface for applications capable of turning sentences into structured data. It is also quite accurate for speech recognition and audio transcription.

Follow the below steps to use wit.ai:

  1. on your browser access wit.ai
  2. login using your github account. if you dont have one, create one.
  3. click on the MYFirstApp directory, then go to settings.
  4. there you will find your Server Access Token or Client Access Token. Copy it, as it will be required for authentication in the python script.

Run the following command to install wit packages.

pip3 install wit

wit will be successfully installed.

The python script for speech recognition using Wit.ai will look something like this:

import speech_recognition as sr
r = sr.Recognizer()
speech = sr.Microphone()
with speech as source:
    print("say something!!….")
    audio = r.adjust_for_ambient_noise(source)
    audio = r.listen(source)
try:
    recog = r.recognize_wit(audio, key = "your key")
    print("You said: " + recog)
except sr.UnknownValueError:
    print("could not understand audio")
except sr.RequestError as e:
    print("Could not request results ; {0}".format(e))

The python script for audio transcription using Wit.ai will look something like this:

test
import speech_recognition as sr
r = sr.Recognizer()
file = sr.AudioFile("FILE_NAME.wav")
with file as source:
    audio = r.record(source)
try:
    recog = r.recognize_wit(audio, key = "your key")
    print("You said: " + recog)
except sr.UnknownValueError:
    print("could not understand audio")
except sr.RequestError as e:
    print("Could not request results ; {0}".format(e))

Conclusion: This is a pretty basic level of speech recognition, far from production ready. We have created this tutorial to get you started with Speech Recognition in Python. Many find it daunting when they start and they drop it altogether. But as you can see, it’s not that difficult.

Using this basic knowledge, we can now think of better ways to make it production ready and use it in real life application. Stay tuned for more tutorials I will be sharing to exhibit how I used this speech recognition in actual application.

The post Speech Recognition – Speech to Text in Python using Google API, Wit.AI, IBM, CMUSphinx appeared first on Pragnakalp Techlabs.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Chatfuel is one of the leading chatbot development platforms to develop chatbots for Facebook Messenger. One of the main reasons of Chatfuel’s popularity is easy to use interface. No knowledge of programming is required to create basic chatbot. People with non-technical background too can create bots using the platform and launch on their Facebook page.

If you start exploring the options/menus in Chatfuel then you should learn it easily. But to make your life easier, in this article we will take you through how to create a taxi booking bot on facebook messenger using Chatfuel.

By the end of the tutorial, you should be able to create a bot with taxi booking functionality. It is advised that you go through Getting started with Chatfuel for building Facebook Messenger Bots to get the basic idea about how platform works. And then check Chatfuel Cards and Plugins Examples for Facebook Messenger Chatbot to learn more about what type of response options are available in Chatfuel.

Now, let’s get started with taxi booking bot!

BOT CREATION

First of all, we need to create a blank bot.

Login to you Chatfuel Dashboard, click on “Create from Template”.

Then select the first option “Blank Bot”

Blocks

For basic flow of booking process, we have created nine blocks.

Two blocks are created by default when we create a blank bot:

  • Welcome message
  • Default answer

Other blocks, we need to create manually. In this tutorial we have created other blocks in “TAXI BOOKING” group. To create a group click on “ADD SEQUENCE OR GROUP” and select GROUP and provide group name.

Let’s go through each block in detail.

Welcome message

In welcome block we have added 3 text cards and 2 quick replies.

In the first text card we welcome user with greeting message which also includes user’s name. The {{first name}} attribute display user’s name from facebook.

We have added another text cards to start conversation with user. You can see quick replies in above screenshot. We are using two quick replies Yes & No and we have added target block with each quick reply. As per our flow if user clicks on Yes it will direct user to another block Booking.

Default Answer

As the name suggests, this block will be called when no other block is matched with user input. You can set the text in the block as per your liking.

Booking

For taxi booking we require user’s information. For that we are using User Input Plugin.

In this block we are asking user for their email and phone number and save it in variables named {{user_phone}} and {{user_email}}. Values saved in variables can be used later in conversation.

We can validate user’s email and phone with User Input plugin. So, if user doesn’t provide email or phone number in correct format then he will be asked to re-input.

Pickup-Date-Time

In this block we ask user for pickup date and pick up time using User Input.

Pickup-address

In this block we asks user for their pick up address using User Input.

Drop-address

In drop address block we asks user to enter drop address and any special instructions if he wants to send.

Booking – Confirm

In this block we display user’s information we stored in previous blocks. We asks user for confirmation.

Using Quick Reply we display two buttons Yes and No. If user clicks on Yes, bot will continue further booking process and redirect to booking confirmation. If user clicks on No then we’ll proceed to cancel his booking.

Send-email

In this block we are using Send-Email Plugin to mail user information to owner / driver of taxi.

After that we display confirmation message and asks user if he wants to do another booking.

We display two buttons Yes and No to continue conversation. If user clicks on Yes button we start booking process again for another booking. If user clicks on No then we redirect him to another block and display Thank you message.

Cancel Booking

On booking confirmation block if user click on No button, then we redirect him to this block.

Also, when user selects No for another booking then this same block is triggered.

In this bock we display text message and complete the conversation.

We are done with creating required blocks for taxi booking. But to move user from one block to another we need to add redirections to all above blocks. Let’s look at one example:

In Booking block, add Go To Block plugin and set “Pickup-Date-Time”. So, after booking block user will be redirected to Pickup-Date-Time block.

Similarly, add Go To Block plugin in other blocks and set redirection as below
In “Pickup-Date-Time”, redirect to “Pickup-Address”
In “Pickup-Address”, redirect to “Drop-Address”
In “Drop-Address”, redirect to “Booking-confirm”

Now, your bot is ready with proper flow. Time to test it out! To test the bot we need to connect it with a facebook page. That can be done from Configure page. Click on Configure menu on left side menu list.

Configure

In above screenshot you can see list of facebook pages. Connect your bot with any page you want to use with this bot.

Set Up AI

In setup AI section we can set phrases that user can enter. Our bot will understand that phrases and reply with some text or block.

You can see in above screenshot we have added many phrases and on right side of phrases, we have added responses or block. When user enters any of these phrases our bot respond with this text or redirect user to the set block.

For example if user say hi or hello, bot redirect user to welcome message block.

That’s it! We created the taxi booking bot for facebook messenger. Go to your page and check how it works.

Do let us know in comments if you have any confusion while following the tutorial.

The post Chatfuel Tutorial: Creating Taxi Booking Bot for Facebook Messenger appeared first on Pragnakalp Techlabs.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Chatfuel is one of the best choices available around for developing Facebook Messenger Chatbots. Using it one can build a simple chatbot within few minutes with no requirement of any technical knowledge or programming. It is kind of drag and drop platform where we can define the flow of our bot and integrate easily with our Facebook Page.

To get started with building bots in Chatfuel, we need to create blocks and add Cards or Plugins in the blocks. Blocks can contain muliple cards/plugins. Cards/Plugins are used to display output to user or carry out some background functions.

To get familiar with Chatfuel, you can refer our Getting started with Chatfuel for building Facebook Messenger Bots blog.

In this blog, we are going to explore most used Cards and Plugins of Chatfuel. It is assumed that you have already created a blank bot. If not, then login to chatuel and create a Blank bot.

Chatfuel Cards

Cards can be used to represent information as text, button or images.

Text

Text card is used to display information as text. Along with text, we can also set buttons.

It allows us to add maximum three buttons and there are 3 options to set action on clicking of button. When user clicks on this button added event with this button is triggered.

Redirect to another block

On clicking we can route user to another block to advance the conversation.

Open external website using URL

We can even take user to an external website by providing URL in the setting. This option can be useful for opening up company website or product page if you are building ecommerce chatbot.

Trigger a phone call

Using this option we can trigger a phone call on set number. For example, if you want user to call on your company phone number then you can set your number here and with a single click user can initial a call.

Typing

Typing card represents background process. It shows “Typing…” to user for selected duration before displaying next response.

Quick Reply

Quick reply is a hint for user to continue conversation.

Using Chatuel we can build Conditional Logic or Decision Tree based bots where we can define flow based upon User Input. So many a times, we need to make sure that user provides some specific inputs to continue conversation in the flow. In such cases Quick Reply is most Useful. We can add multiple quick replies with text/image/audio/video response.

The maximum character limits allowed for Quick Reply is 20 characters and we can add maximum 11 Quick replies at a time. It is advisable to keep the text of Quick Reply short and not to add many Quick Replies as user will need to scroll horizontally to view all the Quick Replies which is not very user friendly.

Image Card

This option can be useful when we want to display single image to user in a conversation. Image card supports multiple format of images like JPEG, PNG and also surpport GIF.

There aren’t any other configuration options available with Image Card. We can just simply display an image in a message.

Gallery

Gallery card can be used to display multiple images. It displays images in slider and allows up to 9 images in a slider.

We can display Heading and Subtitle/Short description of up to 80 characters with each image. There are 2 more options available with Image for user action. We can set URL or add button for the Image.

Setting URL will take user to the external URL while setting button we can define multiple actions. As explained earlier, for button, we can set Redirection to another block, open external URL or trigger a Phone call. Not only that, for Gallery, we get two more options for button. First is Share button which will open the Share Dialog or Buy button. Buy button has more options like setting the prices, tax, shipping settings, etc. Buy button can be useful to setup Ecommerce Chatbot.

In configuration of gallery card, Heading is compulsory field so we must provide some value for it. And along with Heading we must set either Image or Subtitle or Button.

The limitations of using Gallery are as below:

  • It allows up to 40 characters in heading.
  • Up to 80 characters in subtitle
  • Up to 3 buttons in each card
  • Up to 9 images in each slider
  • Images in galleries do not support gifs
Go To Block

Go to block card is used jump conversation from one block to another block. It allows us to add multiple blocks as target block. If multiple blocks are set then all those blocks will be invoked one by one.

We can even add multiple blocks separately by enabling Random option. It will redirect user to any block in the list randomly.

Subscribe To Sequence

In Chatfuel we can create Sequences where we can set messages to send to user after set interval. After creating sequences, we need to subscribe user to those sequences. To set up the subscription in block, this option can be used.

Chatfuel Plugins

Using cards we can display information to user and make them take certain actions but it might not be sufficient to build complex bots. Chatfuel Plugins are there to fix that. Using Chatfuel Plugins could get bit technical at some points but nonetheless if you go through the examples below, you should be able to use them in your bot.

JSON API

For some funcationalities like schedule appointment, hotel booking, weather info, etc we might need to fetch some information from our database or other websites. To achieve this, we can use JSON API which helps us send HTTP request to our server. We can pass parameters and values in GET or POST method. After receiving the request, we can process it and respond with JSON which will be used by chatfuel to display response to user.

We can also use JSON API to redirect user to another block or create postbacks.

JSON API can also be used to integrate other third party services. For example, it can be used to integrate Chatfuel with Dialogflow.

User Input

User Input card is used to collect input from user and save them in attribute. Say suppose, in hotel booking, we ask user about his details and his preference of room. We can save such user details in attributes using input card and use them in other blocks. We can send user collected data to email or display it back to user.

Send Email

Send email card is used to send notification email while user is in conversation. We need to set the Title of the email, then recipient email ids comma separated if there are multiple email recipients and body of the email. When the block is invoked we’ll receive email on set Email IDs.

Note that, we can’t send email to user’s email from bot.

Live Chat

This is another very important feature provided by Chatfuel. Many a times, when bot is not able to respond to user we may need to transfer control to human agent. Live Chat plugin is used to handover the chat transfer to human agent.

Once the control goes to human agent, bot will stop replying to the user. Both human agent or user can stop chatting with human agent and continue with bot by sending “Stop Chat” message. The message to stop conversation with human agent can be customized and set to anything else than “Stop Chat”.

There is a configuration option of “Chat timeout” in settings where we can set for how many hours bot will wait for user response and won’t interfer in the chat with human agent. After Chat Timeout has elapsed, the chat control will be returned to bot automatically.

We can also enable Facebook notification to admin when this Live Chat is started. So admin is aware of any such request.

Setup User Attribute

Setup User Attribute plugin is used to create multiple variables wherever we require. We can set the user attribute name and the value of the attribute. These attributes will save the set value and can be accessed in the chat later on. Multiple options are available to set attribute value. We can provide static value or user existing attribute or even arithmatic expressions are allowed.

Also, we can update the existing attribute value using this plugin. To do that we can select the existing attribute in “User Attribute” field and then provide it a new value.

Audio

Using “Audio” plugin we can display audio message to user. We can upload the file on our server or anywhere else and provide Audio file URL in the field. Supported file types are: MP3, WAV and OGG. And maximum file size should not exceed 20MBs.

Video

Similar to “Audio” plugin, we can display videos in a chat using “Video” plugin. Only MP4 files are supported currently with maximum file size of 20 MBs. If we want to display video from our profile or page then first need to upload the video and provide the link of the video. Or we have to provide the external video link in the field uploaded on dropbox or our server.

List Card

List card allows us to display information as list. It is almost similar to Gallery with difference that in Gallery the items are displayed horizontally while in List card the items are displayed vertically.

To set up list, we need to setup list items. For each list item, Title is compulsory. Along with Title, one more field is required it can be subitle or image or button. There is also an option to set URL using which we can take user to external URL. Or using button, we can define some action for user to advance conversation.

Also, there is an option to add list item with Cover image. This will be displayed at top.

List card has at least two items required.

Share Location

Chatfuel offers to collect user location automatically using Share location plugin. When we use this plugin, it will display option to user if he wants to share his location.

When the user sends this information to the bot, it divides the obtained data into several attributes and save them automatically. The available attributes are zip, city, state, country, longitude, latitude, address and map_url. So, we can use this saved location details at other place in subsequent blocks.

User Phone Number

User phone number plugin allow user to share phone number. It retrieves phone number from user’s facebook profile and display it as quick reply.

If the user doesn’t have phone number in his profile then Quick Reply will not be displayed, instead user will need to enter it manually.

Save to Google Sheet

This is another very useful plugin when we want to export the user conversation data and save it. Chatfuel’s Google Sheet integration lets us connect our Google Account and select a sheet where we want to save the data.

Upon connecting Google Account, it will create a Google Sheet automatically in our Google drive. Then “USER ATTRIBUTES” option will be displayed underneath where we can select which user attributes we want to save in the sheet. Now, whenever this block will be executed, the sheet will be updated with selected user attributes data.

User Email

Similar to User Phone Number plugin, there is User Email plugin too which allows user to share their email. It retrieves email id from user’s facebook profile and display it as quick reply. If user’s email is not publicly available or user wants to input it manually then they can do it manually. The value of email id will be saved in the attribute which we will define in “Save To” field.

Hope this explanation will provide better understanding of each Card and Plugin of Chatfuel. If you have any other question then do post it in comment. Contact us or send your requirement at letstalk@pragnakalp.com for paid chatbot development work in Chatfuel, Dialogflow or other platforms.

The post Chatfuel Cards and Plugins Examples for Facebook Messenger Chatbot appeared first on Pragnakalp Techlabs.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Dialogflow is a very robust platform for developing chatbots. One of the strongest reasons of using Dialogflow is its powerful Natural Language Understanding (NLU). You can build highly interactive chatbot as NLP of Dialogflow excels in intent classification and entity detection. It also offers integration with many chat platforms like Google Assistant, Facebook Messenger, Telegram, Viber, Kik, Line, etc. There is an option of web based integration too but the layout is not pretty attractive and also we can not display it on website as chat bubble straightaway. To use the bot in chat bubble we have to find some work around.

Snatchbot is another chatbot development platform which supports multiple messaging channels like Facebook Messenger, Skype, Viber, Line, and many others. Also, it offers web based interface including chat bubble. The intuitive UI of snatchbot helps you build flow of the chat conversation easily. Even if you are starting new, it won’t take much time to get familiary with the tool and setup basic chatbot. Another nice feature of snatchbot is email notification for set events. We can send notification to email when user takes particular action or respond with some particular answer. Adding to the feature list, another good one is handoff conversation from bot to human agent. And all this is available at no cost. The free plan of snatchbot has sufficient to offer for a moderate level of chatbot. One lacking point is NLP. It does have Natural Language Processing (NLP) but that is not as powerful as Dialogflow.

We wanted to put a chat bubble on our site but Dialogflow didn’t offer it and Snatchbot was falling short in NLP. Hence, to make use of best of both the platforms, we decided to create integration bridge between Dialogflow and Snatchbot.

It is a Flask framework based script developed in Python. The integration script uses Dialogflow SDK and JSON API of Snatchbot. It accepts request from Snatchbot, passes on to Dialogflow, get response from Dialogflow and pass it back to Snatchbot with Snatchbot compatible JSON.

We have open sourced the integration script which can be found on our github repository. If you want to use it for your purpose, follow the below steps.

If you haven’t created a Dialogflow agent then first you need to create it (here is a detailed Dialogflow tutorial on how to develop Resume Chatbot) or if you already have one then let’s get started.

Steps for integration

1. Download the script files from github repository and setup on your python hosting server or on your local system. You will need to install Flask if it’s not there already.

2. Get your Agent Project Id from Dialogflow console and enter it on line number 141 of app.py file.

3. Download Service Account Credential file from GCP and save it in your project directory.

3. Enter the GCP Credential file path in the app.py file on line number 16.

4. If you have setup the script on server hosting then you will get a URL to access the app. Copy it, we’ll need it in later step.

5. If you are setting up the integrator in local system then you will need to connect it using ngrok.

6. Now, go to your snatchbot account and create a new bot or if you have already created a bot then select existing bot.

7. In the bot create new interaction of JSON API type.

8. In the JSON API interaction set the API Address of your app obtained in 4th/5th step. Also, set the Error Message so that if snatchbot is not able to connect to your API URL then it will display this error message.

9. You’re done! Now, when this JSON API interaction is called in your chat flow, it will make request to Dialogflow and fetch response from there. Dialogflow will respond with JSON compatible to snatchbot, so snatchbot will display the response to user.

Demo

You can click on the chat bubble on right side of the page. The chat bubble on our site is displayed using Snatchbot. And the conversation flow is setup using Dialogflow agent.

Do let us know if you face any issue in setting up or using the script. We would be happy to help! Contact us or post your query in the comment section.

You are welcome to connect via email (letstalk@pragnakalp.com) or skype (live:letstalk_86) for paid chatbot development work or integration of this script.

The post Dialogflow Snatchbot Integrator using Python (Flask) appeared first on PragnaKalp Solutions.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

There are multiple chatbot development platforms available if you are looking to develop Facebook Messenger bot. While each has their own pros and cons, Dialogflow is one strong contender. Offering one of the best NLU (Natural Language Understanding) and context management, Dialogflow makes it very easy to create Facebook Messenger bot.

In this tutorial, we’ll see how to integrate your Dialogflow agent with your facebook page. If you haven’t created a Dialogflow agent then first you need to create it (here is a detailed Dialogflow tutorial on how to develop Resume Chatbot) or if you already have one then let’s get started.

Create Facebook Page

First of all, we need to create a Facebook page. Open https://www.facebook.com/pages/ and click on Create Page button.

On next page, select the page type and click on Get Started

Select the page name, page category and click on Continue to create page. Optionally upload profile picture and cover image for fb page.

Create Facebook App

To connect Dialogflow agent with Facebook Page, we’ll need a Facebook app. For that, go to https://developers.facebook.com/apps/ and create a new app.

Provide App name and Email id and hit Create App ID button.

Click on Skip button on the next step and App will be created.

Connect Facebook Page to the App

Our Facebook app is created, now we need to connect our Facebook page to the app. For that, we need to generate Page Access Token.

Clicking on PRODUCTS on left side bar will open a page with many options. Under “Add A Product” section, select “Set Up” for Messenger.

Now, select the page you want to connect from the Dropdown.

And our Page Access Token is generated. This will be required in next steps.

Enable Facebook Messenger Integration in Dialogflow

To publish Dialogflow agent on our Facebook app, we need to enable Facebook Messenger integration under Integration tab of Dialogflow.

Clicking on Toggle of Facebook Messenger will open up a popup. In this popup we need to provide the Verify Token which can be any random string. We also need to provide the Page Access Token of Facebook App which we generated in earlier steps.

After filling up Verify Token and Page Access Token click on “START” button which will activate the Dialogflow webhook for our agent.

Setup Webhook in Facebook App

We are done with configuration of Dialogflow agent. Now, we need to setup webhook in Facebook App which will communicate with Dialogflow Agent.

To setup webhook, open Settings page of Facebook App and click on “Setup Webhooks” button.

Clicking on Setup Webhooks will open up a popup window where we need to input Callback URL, Verify Token and select Subscriptions which we will require for our bot.

To copy Callback URL and Verify Token from the Dialogflow agent, open Integrations page and click on Facebook Messenger. That will provide us with the required values. Copy from there and paste it in the popup.

For Subscription Fields, “messages” and “messaging_postbacks” are sufficient to get started with basic bot. So, we select only those 2 for now.

Next step in Webhook Setup is selecting the Facebook Page to listen to the events. Select the page from Dropdown and click Subscribe.

Activate Facebook App

Now, last step in configuration is to Activate the Facebook App. To do that, browse to Basic Settings of the page (from left sidebar) and provide Privacy Policy URL.

Another mandatory setting is selecting category. Clicking on “Choose a Category” will open up a popup where we can select appropriate category of our app.

Minimum required settings of App is in place. Click on Save Changes to save the settings and then click on Status toggle of app to activate it.

We are done with all the settings! Time to test the bot on our page.

Setup Message Button Facebook Page

Open your Facebook Page and click on Add A Button.

It will open a popup. In first step, select “Send Message” and click Next

In second step, select “Messenger” and click Finish.

You will see “Send Message” button on the page now. Your visitors can click it and start chatting with your page. As you are admin, you will need to mouse over the “Send Message” button and click on “Test Button” option.

It will open up the chat window. Click on “Get Started” button and you should receive the Welcome message of your Dialogflow agent.

Awesome! The bot is working now!

If you don’t receive the message then make sure that Default Welcome Intent has Facebook Welcome added as Event. Also confirm that the Default Welcome Intent has proper training phrases to invoke the intent.

Bot is not live for visitors yet

Please keep in mind that this bot is not yet live for your page visitors yet. You can access it as you are admin of the page. To make it available for your visitors, you will need to go through Messenger Bot approval process of Facebook. We’ll cover that approval process in next tutorial.

Do let us know your feedback about this tutorial in comment section. Also, you can post your doubts in comments section if you have any question or get stuck anywhere. We would love to provide further help.

Do share the tutorial if you found it useful.

The post Dialogflow Tutorial – Create Facebook Messenger Bot Using Dialogflow Integration appeared first on PragnaKalp Solutions.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In our first tutorial we learned how to develop resume chatbot in Dialogflow using intents. We have created intents and added training phrases and responses. The bot is now ready to be introduced to the world! But we didn’t cover how to test the bot and publish on Google Assistant. In this part, we’ll cover those things.

In this tutorial we will show you how to test our bot in console, how to test in Simulator provided by Dialogflow, how to test in mobile device and what required things need to be done to make the bot ready for publishing.

1. Test conversation in console

We can test conversation at right side bar of intents page. This is the easiest and pretty handy testing tool while you are developing the chatbot. You can simply put the input on right side bar and it will show you the expected output. You don’t need to leave the development page. Let’s look at how the console works.

As you can see in below screenshot, it shows what user has entered as input text and what response is received. It also shows which intent is triggered for that user input.

Now, Dialogflow supports multiple chat platforms, so if you want to see how the response output will look on different platform, you can click on “DEFAULT RESPONSE” and select the platform. In our case, we have added response for Google Assistant only, so we see the option “ACTIONS ON GOOGLE”.

You can see how it will look in google assistant. You can also see suggestion chips below the response. Click on any of those suggestion chips to see how it extend conversation flow.

If you scroll down console, you will find “DIAGNOSTIC INFO” button there.

Clicking on the DIAGNOSTIC INFO opens up a popup with details about whole response in JSON format. Understanding JSON format is very useful when you are building webhook for Dialogflow to handle responses for the intent.

2. How to use simulator

In simulator we can check how conversation works in Google Assistant right from our browser. To use simulator click on “See how it works in Google Assistant” on right side bar.

Following the link you will land on Simulator page where you can perform testing of your bot. The benefit of using Simulator is that you can actually see how the response will look in Google Assistant.

To start testing bot in simulator you can write or click on “Talk to my test app”. That will open up your app in the simulator.

You will be greeted with the response you have set in Default Welcome Intent. That is the starting point of conversation for your chatbot.

Now you can input any text you would like to test. If you have set Suggestion Chips in welcome intent then you should see suggestion chips along with welcome message. To continue the conversation you can click on suggestion chips too.

On right side, you can see how it will look in Google Assistant of your smartphone.

To check Request/Response in JSON format click on REQUEST/RESPONSE tabs. If there is any error you can see error log inside ERROR tab.

3. Setup Invocation

Invocations are the phrases which users will use to start interaction with your bot. In invocation section you can set the bot name so bot name will become default invocation for your bot. Users will type or say “Talk to BOT_NAME” in google assistant to enter into conversation with your bot.

We have Provided “Resume Demo” name for our bot so invocation phrase will be Talk to Resume Demo.

Provide name to your bot. You can set voice type at “Google Assistant Voice” section. There are 4 options to select voice for your bot: Male 1, Male 2, Female 1, Female 2. Select any one as per your liking and click on SAVE button to save the changes.

4. Fill up Directory Information

Directory Information contains all the basic details about your bot. Let’s check them one by one.

Description

You can add short and full description about your bot.

Sample Invocations

In invocation section you can set invocation phrases for your bot. These invocations are phrases to trigger your bot in google assistant. You can enter up to 5 invocations here.

Images

In images section you can set small logo and large banner image with PNG format (scale is given). Small logo is mandatory so you will have to upload it.

Contact Details

Provide your email address.

Privacy and consent

Provide valid privacy policy URL. If you don’t have Privacy Policy created then you can find free privacy policy creator websites and create your privacy policy. You will need to host that privacy policy page somewhere so that you can provide that URL in this field.

Additional Info

Select category related to your bot. For our resume bot “Education & Reference” category is suitable. You can enter optional instructions for your bot and click on SAVE button to save your changes.

5. Language Selection

To select languages go to directory page and click on “Modify Languages” to view all the options available.

Select your languages and click on save button.

6. Target Locations

In target locations you can select in which countries you want your bot to be accessible. We have selected all 213 countries so it will be accessible worldwide.

7. How to test in Mobile (Smartphones)

You can now test your bot in your smartphone in Google Assistant application. To test conversation on your smartphone, open google assistant application. Make sure you are logged in with same google account you used to sign up for dialogflow.
Say/Type “Talk to Resume Demo” in google assistant. You will see response as below.

Assistant will open up your bot with greeting message set in Default Welcome Intent.

Now you can interact with your bot by giving some input. You shall receive the response as per your input. See in below screenshot when I entered “introduction” as input, it shows response what we have added in responses. You can see suggestion chips below.

If you select any suggestion chip it works as input and you get response for that. In below screenshot you can see example of rich response (Table Card).

Another example, if I select/enter project as input we get response what we added in project intent.

When you enter bye or goodbye, you opt out of conversation because when we enter bye it will trigger Exit intent and we have set Exit intent as End of conversation.

8. Submit Your App for Review

To publish your bot worldwide you will have to submit it for review. Your bot will not be accessible by other users until it is published on Google Assistant.

We will show you how to submit your bot for review.

Go to Actions on Google Console page and select release from left side bar.

Click on SUBMIT FOR PRODUCTION button.

You can see pop up “Submit for review in production”. Read and select checkboxes.

Choose your languages below and click on “SUBMIT FOR REVIEW” button.

You will see that your app is now Under Review.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Chatbots are gaining popularity. Numerous chatbots are being developed and launched on different chat platforms. There are multiple chatbot development platforms like Dialogflow, Chatfuel, Manychat, IBM Watson, Amazon Lex, Mircrosft Bot framework, etc are available using which you can easily create your chatbots.

If you are new to chatbot development field and want to jump into it, this tutorial could be very helpful. Today I will take you through a detailed Dialogflow tutorial to develop your Resume Chatbot for Google Assistant.

About Dialogflow

Dialogflow is a popular chatbot development platform by Google. It provides graphical interface to manage flow of chat conversation. The crucial part of any chatbot is NLP (Natural Language Processing). The system should be able to process the input provided by users and extract meaning/context out of it. And one reason to select Dialogflow for creating this chatbot is taking advantage of Google’s highly superior NLP.

Dialogflow supports voice assistants like google assistant and amazon alexa.

Also, another big benefit of Dialogflow is that, once we develop a chatbot, we can integrate it with messaging platforms like Facebook, Skype, Twitter, Telegram, Line, Kik, Slack, Amazon Alexa, etc.

Let’s begin the Resume Chatbot development.

1. Google signup

To start using Dialogflow you need to have a Google Account. If you are already using gmail, then you can login using that account. Or you can create a new Google account.

After logging in you will be redirected to account setting page. Where you can select your country and choose email preferences as per your choice. You have to check the terms of service checkbox and click Accept button to proceed further.

Now you will land on welcome page of Dialogflow to kickoff your journey in exciting world of chatbot development.

2. Agent creation

To start with a new chatbot development in Dialogflow, we need to create an agent.

Provide a name for your agent and select default timezone. Choose default language as per your preference.

3. Intents

Intents are basic building blocks of chatbot in Dialogflow. Intents map user input to responses. Dialogflow provides two default intents ‘Default Welcome Intent’ and ‘Default Fallback Intent’ for each agent you create.

Let’s have a look at what these default intents do.

a. Default Fallback Intent

When we create a new agent, Default Fallback Intent is automatically configured with various responses. Default Fallback Intent is called when user’s input does not match with any other intent.

We can change text responses in the Default Fallback Intent. When user enters input and that doesn’t match with any intent the

Default Fallback Intent select random response from the list of responses.

b. Default Welcome Intent

Default Welcome Intent is automatically configured with various training phrases and responses. This intent will be triggered when user starts interaction with our chatbot. Even when he hasn’t provided any input this intent will be invoked.

Now click on Default Welcome Intent. You can see Contexts, Events, training phrases, Action and parameters and Responses.

We can start building our bot by adding Training phrases and Responses

Training Phrases are used for matching with user inputs

When User’s input matches with any of these training phrases Default welcome intent triggers.

Response will be returned randomly from the list of responses.

4. Create New Intent

To create a new intent either click on + symbol next to intents menu on left sidebar or click on “CREATE INTENT” button on top.

Enter Intent name and click on save button.

Under Training Phrases section, we can see textbox “Add user expression”. Enter your training phrases and click save button.

You need to enter training phrases as per the intent. You need to decide what type of user input will invoke this intent. For example, for this Introduction intent, I have added “tell me about yourself” and “introduce yourself”.

Now scroll down to responses section. Every intent must have at least one response. In the Text response box, type a response and press Enter. We can add multiple responses. Intent use random responses from the list you have entered. Don’t forget to click on save button otherwise your changes won’t take effect.

5. Rich Responses

In Dialogflow there are multiple types of responses not just simple Text Response. You can use it for different purposes to show off your information in better way. For example, at times you might need to display some image or list of items or external links, etc. In those cases Rich responses come handy.

As per the chat platform (Google Assistant, Facebook Messenger, Kik, Telegram, Slack, etc) there are different options for rich responses as not all types are supported on different chat platforms.

Let’s explore the rich responses options provided for Google Assistant using different intents we need to create for resume.

Now in responses section click on + symbol next to DEFAULT and select Google Assistant from list.

Click on “ADD RESPONSES” button. You can see different types of responses.

SUGGESTION CHIPS IN WELCOME INTENT

Suggestion chips are used for hint to continue conversation. It indicates user what to do next.

Introduction, Experience, Projects, Contact

Create Introduction Intent

For this intent we can add training phrases like:
– Introduction
– Introduce your self
– Tell me about yourself

For response, you can use Simple Response/Basic Card/List/Carousel.

For this intent you can add simple response like below.

Create Experience Intent

For this intent we can add training phrases like:
– Experience
– Tell me about your experience

For response, you can use Simple Response and Table Card.

Table card is used to represent your data as table. It provides static data.

Note : At least one simple response is required with Table Card response.

Create Projects Intent

For this intent we can add training phrases like:
– Tell me about your projects
– Your academic projects

For response, you can use Simple Response/ Browse Carousel Card.

Browse carousel card can be scrolled horizontally. This card is used for opening selected external website links in browser.

Create Career objective intent

For this intent we can add training phrases like:
– Your goal
– Your career objective

For response, you can use Simple Response/ Suggestion Chips.

Create Area of interest intent

For this intent we can add training phrases like:
– Tell me about your interests
– What are your interests

For response, you can use Simple Response/ Suggestion Chips.

Create Educational Qualifications Intent

For this intent we can add training phrases like:
– Education
– Educational qualifications
– Tell me about your education

For response, you can use Simple Response and Basic card / Suggestion Chips.

We can display image, title subtitle, text description, link using basic card response.

Create Strengths & weakness intent

For this intent we can add training phrases like:
– What are your strengths
– Tell me about your strength and weakness

For response, you can use Simple Response and List.

In this response we can display multiple items as a list.

See Screenshots below I have added required values in list response. Option key in item is used as user input value, it means if user will click on particular item then key of that item will be next user input.

Create Contact intent

For this intent we can add training phrases like:
– Your contact detail
– How can I contact you

For response, you can use Simple Response/ Text Response/ Browse Carousel Card.

Create References Intent

For this intent we can add training phrases like:
– What are your references

For response, you can use Simple Response, Basic Card, Suggestion Chips and Link out suggestion.

Link out suggestion is used to link external website URL. The title will be Anchor text of the link.

Create Exit intent

For this intent we can add training phrases like:
– Bye
– Good bye
– Get lost
– Bye bye
– Farewell

For response, you can use Simple Response/ Text Response.

See in below screenshot. To make this intent as end of conversation select / turn on “Set this intent as end of conversation” switch/button/option.

When user enters bye, good bye as input then simple response will be displayed. And as we have marked this intent as “End of conversation” intent, the conversation will end and user will exit our app.

There you are! Your resume on chatbot is ready! In this tutorial we saw how to create the chatbot using..

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

If you want to use Dialogflow agent in facebook messenger then it can be done easily using Dialogflow integrations. But the catch is that you need to create a Facebook App and get it verified. The verification process not only checks for chatbot functioanlity but also requires Business Verification. In business verification process you need to upload proof of business registration. So it gets difficult to publish a chatbot without a registered business.

Solution Using Chatfuel

One work around to bypass business verification is to use chatfuel bot. Chatfuel bot doesn’t require verification on messenger. You can create a bot on chatfuel and simply connect your facebook page with it. The bot starts workings instantly.

But in our case the chatbot is developed using Dialogflow so we need to integrate Dialogflow with Chatfuel. We have created this simple script in Python using Flask which is an integration between Chatfuel and Dialogflow. It works as a bridge between Chatfuel and Dialogflow converting response from Dialogflow and turn it into chatfuel compatible JSON. So, now your chatbot can work on Facebook Messenger.

You can download the script from our GitHub Repository.

Steps to setup the script:

1. Get your Agent Project Id from Dialogflow console

2. Download Service Account Credential file from GCP.

3. Enter the file path downloaded above in the app.py file on line number 16.

4. Run your code using Ngrok if you are using this integrator from local machine and copy the Ngrok url.

5. Go to Chatfuel Dashboard and open your existing chatbot or create a new chatbot.

6. Go to the Default Answer block and remove all existing cards and add a new JSON API card. In the JSON API card URL textbox, enter the Ngrok URL.

7. That’s it, now you can test your NLU powered chatbot on messenger.

Demo:

Using this integrator we made our Railway Buddy chatbot work on Facebook Messenger without business approval. You can check the bot at Railway Buddy on Facebook Messenger.

Special Notes
  • There are already some free/paid services available which offers Dialogflow-chatfuel integration. Each has their own way of connection. Benefit of using this script is full control over your integration. Additionally, you don’t need to share your Service Account Credential File with any third party website.
  • Currently the script converts Text Response, Basic Card and Quick Replies into chatfuel compatible JSON. It doesn’t support Image and Custom Payload from Dialogflow yet. Feel free to contribute to the repository for Image and Custom Payload response conversion.

Do let us know if you face any issue in setting up or using the script. We would be happy to help! Contact us or post your query in the comments.

The post Chatfuel Dialogflow Integrator in Python for Facebook Messenger Bot appeared first on PragnaKalp.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

We (Humans) are constantly on the exploration mode looking out ways, which can simplify our lives and make it easier. And in that quest, we have come far from our preliminary stage.

From entering commands in an arcane language to fetch output to GUI to now we are developing bots that provides assistant to us by provide the freedom of entering any information. The Bots surrounding us today like Google Assistant, Apple Siri, Amazon Alexa are simplifying our life by automating mundane tasks, helping in our daily tasks and improving end-user experience. The demand of Chatbots has increased considerably and the predictions by Gartner are a testament to it

  • Over 50% Medium to large enterprises will have deployed product like chatbots in their services. [1]
  • Chatbots Market is expected to be worth 3.1 Billion USD by 2021 with a CAGR of 35% during 2016–2021. [2]
  • As per Juniper Research, the organizations will save up to $8 Billion in cost savings by 2021 with average time savings of 4 minutes per chat compared to traditional call centers. [3]
However, how does Chatbot work?

Chatbot is quite similar to a mobile Application. It has an application layer. API calls the server where it interacts with the database and gives back the answer. Conversational interface replaces user interface.

Chatbots work by extracting entities from the input by the end user, categorize it, cluster the information and map the relationship between the intent and the database to provide response.

It employs Intent Classification, Machine Learning Algorithms and Artificial Neural Networks into working.

Intent Classification

They classify the smallest unit of information i.e words into suitable categories and pulls back a response. Sometimes text classifier are also linked with external web reports to provide data to the user.

Example:

User: Who is Sachin Tendulkar?

Chatbot: Sachin Tendulkar is an Indian cricketer and the most number of run-scorers in International cricket.

Back-end processing: It assigned a category to the word “Sachin Tendulkar” and a response associated with the word was sent back to the user.

This technique works when the chatbot developer had specified Sachin Tendulkar with characteristics such as person, Indian cricketer, highest run scorer. Each such entities are trained so that it produces a correct response. However, this process is tedious and to reduce the work Ml algorithms are used.

Machine Learning Algorithms

Algorithms aids in processing of the input by the user. They adopt a reductionist approach to provide a more simplified solution to the above-mentioned structure. Words are counted for its occurrences and provided a score. Higher the score of a particular class or word the more likely it is the response with the input sentence. However, it does not guarantee if it is the perfect answer or not.

Artificial Neural Networks

Intelligent bots employ ANN into its working. They form a pattern during each conversation and learns from it. Words separated into different categories are fed as an input to the neural networks consisting of three inter-connected layers mainly input layer, hidden layers and output layer.

The bot maps relationship with each word (Class) and the most suitable response is given as an output to the user. The responses are saved and again trained with neural networks to learn more about the variations and prepare customized response.

It is necessary that the bots have been trained on different variations to avoid dead end that can frustrate the customer and hamper their experience over the platform.

How Chatbots are developed?

Chatbots are of two types mainly a Simple Question Answer based and an AI based conversationalist.

The Q/A based bot is hard-coded on the base of Manual Decision tree with limited functionality and capabilities. It works on the retrieval based model.

Examples:Wiki-Chatbot, Menu-based chatbot

Conversationalist bot also known as Dynamic bot or Intelligent bot works on Generative based model uses Natural Language Processing and deep learning to mimic the human based response. The bots learns from each conversations, it forms patterns, expands their variants and understands the nuances of different conversations and gives intelligent response to the user.

Examples: Siri, Alexa, Google Assistant.

Technology Stack behind the Bots

Bots are a mix of mobile and web- based and the technology stack depends on the application it is required. A combination of below mentioned stack is used for creating a chatbots

  • Scripts (Javascript, Ruby, PHP, Python, SQL, etc.)
  • JSON (JavaScript Object Notation) when specific data request are created by the browser example : Address of the store X This data format is structured and interchanged into text format by JSON and can be utilized by other programming languages. It basically improves the server to browser communications
  • A server to handle the API calls and HTTPS connections
  • Cloud service – It provides storage service (logs of each conversations) processing of the chats for better understanding of the intent and suitable response, Scalability.
  • NLP Framework – Intelligent bots make use of Machine Learning Algorithms and Natural language processing to have a deeper understanding of the syntax and semantics of the sentences.
Chatbot development platforms

Additionally Chatbot Development Platforms like Dialogflow, IBM Watson, Amazon Lex, Microsoft Bot Framework, Chatfuel, Manychat, wit.ai, Botsify, Flow XO, Beep Boop, Bottr, etc assist in creating basic chatbots without any need of technical knowledge. It consists of several functionalities which can be added via Graphical User Interface.

Chat/Conversation Platforms

In order to increase reach of the Chatbot and increase its effectiveness Chat Publishing Environment provides a perfect platform for the bots where user can interact with chatbot. Some of the such popular platforms are Google Assistant, Amazon Alexa, Facebook, Telegram, Skype, KIK, and many others.

Applications of Chatbot in different industries:

People today want on-time assistance, providing answers to their questions as they shoot. These has led to the rise in demand and need for organization to adopt a bot which can provide assistance and support whenever the end-user require.

Some of the areas where bots can be helpful are:

Specific Marketing: Organizations waste enough resources to divert the traffic to their website. The mantra to have a greater ROI of their investment has been simple to target the area where the customers are. With rise in the messaging platform such as Facebook Messenger, WhatsApp, KIK
Bots can leverage the reach of these platforms and spread awareness thereby reducing time, cost and effective coverage of their wide area

Customer Service Increased reach of the business leads to increased customer support for the end-user. Bots can be scaled as per requirement with little modifications it is possible to serve a large sector.

Healthcare: Personalized assistant to the patients, bridging the connection between the doctor and patients, Scheduling appointments and reminding patients for their routine check-up. Chatbot can also record health data, perform analytics which will help in decision-making. Examples: HealthVault, Izzy, Safedrugbot

E-commerce: How often it has been that customer after endless search has lost hope in finding the product that they are looking for. Bots trained with different characteristics of the product can act as a personal shop assistant and help them find the product that they are looking for.
This has dual advantage 1) Retaining the customer and increases customer satisfaction with on-time assistant. Example : TacoBot (Slack) & H&M (Kik)

Hospitality and Travel Agent: Hotel Industries can employ bots to update their inventories, process cancellation request and handle queries of the guest like availability of the rooms, room tariff. Bots when sufficient details provided to it can also prepare a complete travel itinerary and complete the process in quick time.

Fast Food chain: Bots via a conversational interface can convey varieties of the restaurant with pictures to the customers. Bots acting as a one-point contact can confirm the order, modify the order and receive payments. Automation of the complete process helps in speedy delivery and eliminates error in the complete process.

Stock Market Companies: Bots can learn from the history of different stocks, guide the users for the best possible investment option and help the users employ a effective investment plan without any hassle from the customers end. Bots can provide complete guidance of the stocks, update the value of the stocks and make/take payments on behalf of the customers.

Banking: 24*7* 365 banking services will be available to the customers. Freedom from manual KYC filling and auto-authorization of accounts. Besides assistance, chatbot also provides tools for analytics purpose that helps in targeting their service to the specific audience.

Chatbots are the next technological shift which every organizations is looking at and the advantages of it are clear visual indicator of its reach and effectiveness. If you are looking for more information or need guidance where chatbot can be helpful to you, feel free to drop us a message or an e-mail. We will be happy to guide you regarding the complete process.

References:

[1] https://www.gartner.com/smarterwithgartner/chatbots-will-appeal-to-modern-workers/
[2] https://www.marketsandmarkets.com/PressReleases/smart-advisor.asp
[3] https://www.juniperresearch.com/analystxpress/july-2017/chatbot-conversations-to-deliver-8bn-cost-saving

The post An ultimate guide to Chatbot, its Development & Industry Applications appeared first on PragnaKalp.

Read Full Article

Read for later

Articles marked as Favorite are saved for later viewing.
close
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Separate tags by commas
To access this feature, please upgrade your account.
Start your free month
Free Preview