How to use Context with Dialogflow when users spoil your punchline (Part 3: Knock Knock Jokes)

Deborah Kay
Chatbots Life
Published in
3 min readOct 14, 2018

--

(This is a the third tutorial in a four-part series on using Context with Knock Knock jokes. You can find Part 1 here and Part 2 here.)

Some users are smarty pants. They may attempt to ruin your punchline by delivering it before you do.

Here’s an example.

Top 3 Most Popular Bot Design Articles:

1. Emotionally Intelligent ChatBots — Part 1: Getting emotions from user’s face

2. Emotionally Intelligent ChatBots — Part 2: Getting emotions from user’s voice

3. How To Conduct User Research for Chatbots?

4. AI & NLP Workshop

🙄🙄🙄 See how that destroyed your punchline?

So what do you do? Create a response that calls the user out for ruining your joke.

How it’s Done

1. Create a new intent to handle “cows go moo’

2. Add input context = whosthere. Why? We only want to trigger this if it was in response to “who’s there”.

3. Craft an appropriate, snarky response

Viola! Your bot can now recognise when users attempt to spoil your punchline.

Train your bot to respond to all punchline killers

4. While still in the same intent, you can add all your knock knock joke punchlines to the training phrases.

5. Add a variety of responses just to mix things up.

This is how things will play out!

In the next tutorial

In the Part 4 of the Knock Knock jokes tutorial series, learn how to respond when users say “knock knock” to your bot!

Here’s a sneak peak!

You can find Part 4 here.

Download the Dialogflow agent

You can download the Dialogflow agent here!

Other tutorials In this series

Part 1: How to use Context to build simple Knock Knock Jokes

Part 2: How to use Contextual Fallback to handle errors

Part 3: How to use Context when users try to spoil your punchline

Part 4: How to use Context and Entities to respond to users’ Knock Knock Jokes

The examples in this tutorial are from Sammy the Sailing Bot, the world’s first AI chatbot by the Singapore Sailing Federation.

--

--

Head of Digital Transformation | Chatbot Evangelist | Speaker | 21 All Star Twitter | 3X School Builder | Top Medium writer in AI 2018 | Digitaldiscovery.sg