Contexts contribute substantially to any human conversation, and human-to-chatbot conversations should not be an exception. There are situations when similar utterances can mean completely different things – depending on the topic of the conversation before that utterance was used.
Let’s consider a chatbot that can do two things – tell the weather or current time in any city on Earth, for example. The conversation with this chatbot can look like this:
- USER: Hey, what’s the weather in London now?
- BOT: It’s hot and sunny in London!
- USER: How about New York?
- BOT: It’s raining there
- USER: And the time is?
Notice that at this point in the conversation the user does not specify which city she would like to check the time in, but based on the previous conversation history, most probably, it’s New York.
- BOT: It’s 4 pm in New York.
- USER: And in London?
Again, the utterance does not give any clue on what the user would like to achieve – check time or weather. But the context tells us that most probably the question is about time.
- BOT: It’s 9 pm in London.
To be able to distinguish between “check_time” and “check_weather” intents, your chatbot will have to store the current conversation context somewhere. The easiest way to achieve this in Activechat is with user attributes.
Let’s check another example – a restaurant chatbot that can calculate prices for food delivery and for table reservations. There could be two skills in this chatbot – one to calculate the delivery cost, and another to calculate the reservation cost. Both can be triggered with “How much will it be?” utterance, but the correct choice of the intent (and thus skill) will depend on the context of the conversation.
When using native Dialogflow integration in Activechat, you can set a context before sending the user’s message to the NLP engine, and specify which contexts a specific intent is associated with. In this case, even if two intents have the same utterances defined, the context will define which one will be triggered. We’ll get deeper into this in the Connecting Dialogflow agents manual.