Deploy Chatbots Unit5
Deploy Chatbots Unit5
When creating a chatbot, you design the logic of a chatbot. To then bring it to life so your
users can interact with it, you must deploy it on one of the media, which include Web
pages, Facebook Messenger, WhatsApp and Twilio phone numbers. A key advantage of
SmartBot360 is that you can deploy the same bot to multiple media to meet the users on
their favorite medium.
The easiest way to deploy a bot is to follow the prompts right after creating a bot. First, go
to CHATBOTS page and load your bot. Then click on “Save&Deploy” button as shown
below.
View fullsize
Then, follow the prompts to choose the medium you want as described below.
After you deploy the bot the first time to a medium, if you make changes to the bot logic
you don’t have to repeat all steps of the Save&Deploy wizard. After clicking Save&Deploy,
instead of selecting again the medium to deploy to, just click “ok”, as shown below, and
your bot logic will go live to all previously deployed media.
View fullsize
If you later want to change some non-logic attributes of a deployment (hashtag, presentation
colors and so on) you don’t have to start the Deploy&Save wizard again. Instead, go to the
CHATBOTS page, and select the deployment you want to edit on the right panel.
View fullsize
If the bot has already been deployed, you can go straight to step 4 and copy the snippet
from the right panel of the CHATBOTS page. Else, if you deploy for the first time:
Here are more details on Step 4 in the above list, if you use one of the popular Web site
hosting tools.
Wix:
4c. Paste the snippet, and select all pages or the page to deploy the bot on as shown
below. Make sure you select “Body - end” and “Load code once”. For more
information, also see instructions from Wix.
View fullsize
Squarespace:
4a. Go to the page where you want to add the chatbot.
WordPress:
There are many variants of Wordpress, so instructions to insert HTML snippets may
vary. The easiest way is to use a plugin that allows inserting HTML snippets, such as
Scripts n Styles or Embed Code. Other ways are also possible as described in
https://www.godaddy.com/garage/3-ways-to-insert-javascript-into-wordpress-pages-
or-posts/.
TIPS
1. Some features are not available on bot preview, so it is recommended that you test
your bot on an actual Web page that you create.
2. To test your changes to the flow diagram to a live web page, first follow the above
instructions to deploy the first version of the bot to a page. Then, when you edit the
diagram, click on “Save&Deploy” and then click “OK” (not “Deploy on Web”). This
updates the already deployed bot, so you can go again to the same web page (open a
new browser tab) and test the updated bot version.
3. If you want to change the presentation (e.g. title, colors) or functionality of a Web bot
you don’t have to redeploy it using the deployment wizard (by clicking
“Save&Deploy”), as this will create another HTML snippet, so by doing so several
times you will end up with several snippets, which will lead to confusion. Instead,
select the chatbot in the CHATBOTS page, and on the right panel edit the
deployment attributes.
SmartBot360 can easily deploy a bot on a Twilio phone number. You must first create a
Twilio account and link it to SmartBot360. Then, load a bot, click Save&Deploy, select
SMS and then select the phone number where the bot will be deployed.
View fullsize
Deploy to Whatsapp
The instructions are identical to deploying on SMS. You need to first create a WhatsApp
account in Twilio, link it to SmartBot360, and then deploy the bot.
Messenger can be tricky to work with, due to the several privacy and anti-spamming
measures that Facebook takes to protect its users. SmartBot360’s goal is to shield you from
all this complexity and provide a super-easy interface to deploy your bots on Messenger.
To deploy a bot on one of your Facebook Pages (you may not deploy a chatbot on your
Facebook homepage, you must create a Facebook Page for that), follow these steps:
Press Save&Deploy, then select “Deploy Facebook” in the deployment wizard, click on the
button to login to your Facebook account. Grant any requested permissions when prompted.
Then, all your Facebook Pages will be displayed. Select the page where you want to deploy
the bot.
View fullsize
See more details on Facebook chatbots and considerations.
Hashtags
Sometimes you may want to deploy more than one bot on the same medium. For example,
in the below image, we deploy two bots on the same Facebook Page. If the user types #stop
at any time (even during the execution of another bot), the stopWellness bot starts (which
unsubscribes the user from all scheduled bots). Else, the default bot, wellnessBot, is active.
There can only be one default bot per medium (e.g. per Facebook page), that is, only one
bot with empty hashtag.
View fullsize
SMS, WhatsApp and Facebook Messenger are not HIPAA-compliant (click for more
information). To facilitate HIPAA-compliant chats over SMS/WhatsApp/Messenger, the
bot can start on these media and display a hyperlink which will hand-off to a Web bot, that
is, when the user clicks on the link they will switch to a Web bot.
To achieve that, load the bot from the CHATBOTS page, then click “Save & Deploy”,
select “Deploy to Web”, and in the “Web Bot Deployment Advanced Options“ screen select
the medium you want the bot to initiate from (SMS, Messenger or Whatsapp) and follow
the instructions.
For example, if you want to deploy wellnessBot on the Web but start from SMS, load the
wellnessBot, click on Save&Deploy, then select Web, and in the next screen select “Start as
SMS Bot” as shown below, and follow the instruction in the next page.
View fullsize
Advanced note: Following this process, a new bot is created with name
wellnessBot_smsintro, which starts with a welcome message followed by a link that takes
the user to a Web-bot deployment of wellnessBot. This means that if you want to create a
Schedule Pattern for this handoff bot, you should select wellnessBot_smsintro instead of
welnnessBot in SETTINGS→Scheduling.
Now our bot needs some interface to chat with the user and for that we chose Slack. In this
final part, we will focus on deploying our bot over slack and use its interface to chat with the
bot and train it more.
What is Ngrok?
Ngrok is multiplatform tunneling, reverse proxy software that establishes secure tunnels
from a public endpoint such as the internet to a locally running network service while
capturing all traffic for detailed inspection and replay. In short, It is a tool that allows you to
create a “tunnel” from your localhost to the internet with one simple command. So basically
the app running on our local would be available via the internet publicly.
If everything goes well then you will see below on the screen ( I used the port 5004 for our
bot integration)
ngrok
· Create a workspace or use an existing workspace if you have any on Slack. I created a new
Workspace ‘Bots’
· Create an app via https://api.slack.com/apps to deploy the bot as shown below. The name
of my app is Wall-E
Slack setup
As shown above, make sure to add i) the bot user and ii) upload the picture, provide a brief
description and a background color
Save all the changes and finally, before installing the app into the workspace, click on event
subscription, add the ngrok URL https://------.ngrok.io/webhooks/slack/webhook to request
URL and subscribe to Bot events as shown below.
Now install the app on the workspace and get the Bot User OAuth Access Token which
would be required in our bot application to connect with Slack.
Deploying the Bot on Slack
a) First, create a credentials.yml file in the project root directory i.e wall-e
$ cd wall-e
$ touch credentials.yml
Now pass this slack token to dialogue_model.py created in the last part and add below lines
of code in run_core (Check the port ‘5004’ here. It's the same port which while firing the
ngrok above)
input_channel = SlackInput(slack_token)
agent.handle_channels([input_channel], 5004, serve_forever=True)
dialogue_model.py
Time to chat
Now its time to run the code and chat with bot over the slack interface.
## make sure ngrok is already up and running on port 5004## Train and Run CORE
$ python3 dialogue_model.py## In the new terminal run custom action
$ python3 -m rasa_core_sdk.endpoint --actions actions
In case you landed up to this article directly, I would highly recommend going through the
earlier articles on Rasa NLU and on Rasa Core.
How to Build a Chatbot for Your Website
It’s time to give the consumer what they want (quick and personal service), and also give
your website a fighting chance of meeting your website visitor’s expectations. Let’s build a
chatbot!
Here are the 9 steps we'll cover to help you get a chatbot up and running for your website:
#1 Decide what type of chatbot is best for your business
#2 Determine your chatbot KPIs
#3 Understand user needs
#4 Give your chatbot a personality
#5 Plan your chatbot flow
#6 Design your chatbot
#7 Preview and test your chatbot
#8 Target your chatbot
#9 Measure and optimise chatbot performance
1. Decide what type of chatbot is best for your business
Before starting to build your chatbot, it’s important to decide what type of chatbot your
business needs.
What purpose will your chatbot serve? Are you trying to increase conversions and lead
generation or looking to serve your customer better around the clock?
Of course, your customised chatbot can be multi-purpose as well.
The benefits of a customer service chatbot
Chatbots for customer service allow you to provide 24/7 support by helping your website
visitors self-serve and find solutions to their questions swiftly. It can help decrease the
number of incoming customer contacts via email and save your team's time for more
complex issues.
Customer service chatbots can also direct customers to additional services based on their
data and extend an offer based on your current campaign or client data.
To outline your chatbot KPIs you can ask yourself the following questions:
• How will you know if the chatbot is a success?
• What are you going to measure?
• What results do you want to track?
For the most part, your KPIs will reflect the goal of the chatbot interaction, i.e what action
you want the user to take.
These types of KPIs could be the number of CTAs clicked, button or link clicks, forms
completed, or completed online purchases through the chatbot.
To help define your chatbot user persona, you can think about what the user’s goal is when
they first interact with the chatbot, and how the chatbot helps that user.
Try to condense your user profile into a one-sentence summary. You can tack on an
additional short sentence to further describe the chatbot use cases.
Here is an example:
A working professional, visits her Energy provider's website on desktop during office hours,
to find out how to make her first payment. Using the bot, she can find out how to do it
within minutes, without interrupting her workday.
Once you know these aspects of the user persona, you can brainstorm with your team on
how to influence the user’s decision and customer satisfaction.
Think of your chatbot as a representative of your company, you’ll want to have a good
balance of focusing on brand consistency and giving users what they want.
How to create a chatbot personality? Consider designing your chatbot with these personality
traits:
• Casual language, maybe even industry slang
• On-brand emojis
• Inviting images or gifs to accompany the text
• Friendly avatar image
• Creative name for your bot
You want to organize your chatbot flow by thinking of the questions the user wants
answered by interacting with your bot.
Picture this conversation flow like a decision tree. Create a diagram of as many message
options as possible, you can do this on post-it notes or digitally.
Once you have your main opening messages, then choose your multiple-choice response
options that will guide the user to the next prompt or desired page.
When you have the fundamental text outlined for your chatbot conversational flow, you can
then look towards design.
What do you want each view within the chatbot to look like?
Will your chatbot views include buttons, typing fields, links, images, videos, dropdown
menus or something different?
In the end, make sure the chatbot conversation flow suits your company image well and has
a clear purpose in guiding the user.
6. Design your bot
Now it’s time to get your hands dirty, or at least the dirtiest they’ll get while building a
chatbot for the first time.
You can finally put your plan into action and start designing your bot!
When you build a chatbot with a built-in design platform, you have the option to either
design a bot from scratch with drag-and-drop elements or by using a bot template.
Before publishing your bot for the world to see, you’ll want to preview it and test it out first
for yourself.
While previewing your chatbot, you should test out all possible variations of your chabot
flow.
This means testing each button or input option and following that path until the end result to
make sure there are no hiccoughs. There may be a handful of different combinations of
buttons and paths to follow, but each is well worth testing.
It is also important to preview what your chatbot will look like on different devices and to
adjust appearances accordingly.
8. Target your chatbots
So far we’ve covered the who (your company + the website visitor), what (chatbots), where
(on your website), why (to guide the visitor) but not exactly when and how.
Setting up your target rules for your chatbot will help you answer the when and how parts
of the building-a-chatbot formula.
There’s a wide range of automatic triggers that can activate your chatbot. It’s up to you
whether you want to target your bot based on multiple criteria or just one.
Need some ideas on what chatbot targeting options to use for your website? Steal a few of
these ideas to base your chatbot triggers on:
• Which page the visitor is on
• Where they came from i.e previous page, campaign URL, traffic source
• The geographical location of the visitor
• What device they are using (desktop, mobile or tablet)
• The number of times they have visited your website
Once you determine your chatbot targeting rules, your bots will be smarter in who they
target and which automated message to send.
Not only is it important to track quantitative results that directly impact your business, but
it’s also worth gathering bot performance feedback from its users:
• What do chatbot users think about your chatbot?
• Are they satisfied with the service it provides?
• Are they taking full advantage of the tool?