DEV Community

Cover image for How to refactor your creepy Halloween bot... into a Christmas elf bot!
Linda Nichols
Linda Nichols

Posted on

How to refactor your creepy Halloween bot... into a Christmas elf bot!

There's room for everyone on the nice list.

In October, I made a Halloween bot based on the movie Scream. And it ended up getting a little creepy.

For the holidays, I decided that I wanted turn my creepy Halloween bot into a jolly Christmas bot, based on the movie Elf.

Santas coming

Elf greeting

         
Now, you should make a jolly (and a little bit creepy) Christmas bot too!


Create a knowledge base for your Buddy-bot

Meet Elf

To give your Buddy-bot the ability to answer questions, you'll need to create a QnA Maker service and a knowledge base. You can fill the knowledge base with personalized answers and fill in the conversation gaps with some pre-made "chit-chat."

  • Sign into QnA Maker Portal using your Azure credentials.
  • Create a new QnA knowledge base or import an existing elf knowledge base.
  • When you're done tweaking the question and answers for your bot and training the model, select "PUBLISH."
  • Once your QnA Maker app is published, select "SETTINGS" and note the values from the "Deployment details" section. You’ll need these later.
POST /knowledgebases/<knowledge-base-id>/generateAnswer
Host: https://<yourqna>.azurewebsites.net/qnamaker
Authorization: EndpointKey <resource-key>
Enter fullscreen mode Exit fullscreen mode

Scream-bot becomes Buddy-bot

For detailed instructions on creating an Azure Bot Service, you can find the steps here. Instead of downloading and making changes to the sample bot code, can also clone and deploy my sample bot code.

Note: Use the keys from the QNA Maker knowledge base that you just made to set the environment variables in the application settings of your bot's App Service instance.

QnAKnowledgebaseId=<knowledge-base-id>
QnAAuthKey=<resource-key>
QnAEndpointHostName="https://<yourqna>.azurewebsites.net/qnamaker"
WelcomeText='Buddy the Elf!'
UnknownText='So, good news—I saw a dog today.'
Enter fullscreen mode Exit fullscreen mode

You might also want to upload your own custom Buddy icon in the setting of your bot to make it more... cheerful.
         

Icon


Now, test your bot using the "Test in Web Chat" option under "Bot management."

Santa!

Settings

Congrats! You now have a more cheerful and slightly less creepy holiday bot!

Color

Bye

Resources:

Top comments (1)

Collapse
 
cdthomp1 profile image
Cameron Thompson

So fun! Thanks!