In this guide, you'll learn how to automatically distinguish topic-specific customer messages and route them to the right agents from your team using the Recognize Intent step in Flow Builder.
How is it possible to automatically categorize text?
To automatically categorize text, we’ll use machine learning. We’ll also take away all the complexity involved in building and deploying a machine learning model and make this work perfectly just by providing examples that describe the use case. From these examples, our machine learning algorithm also picks up the right category (what we refer to as intent) for messages that are slightly different. In other words, it automates intent recognition.
- A MessageBird account
- WhatsApp for Business account or any other channel from MessageBird's offering
- A workflow to handle the messages—Flow Builder
- An Inbox account (optional)
Step 1: Create a dataset
1. Log in to your MessageBird Dashboard and go to Knowledge Bases
2. Click Create new data set
3. Select the Intent dataset type and name it Sales or Finance
4. Select English
5. Hit Next and choose Input manually
Step 2: Populate and publish the dataset
1. To determine the intent of an incoming message, you need to provide example phrases for each intent you’re trying to detect. In this case, we will define 5 example phrases of both Sales and Finance messages for now, but keep in mind that the more examples, the better. You can add more phrases later on.
- Have at least 2 intents per dataset.
- Try to come up with example phrases that are mutually exclusive (don’t strongly overlap).
- Choose intents that are easy to distinguish. If you feel your intents might be very similar and difficult to distinguish (e.g. ‘Finance’ and ‘Payments’), then the machine learning algorithms will probably find it difficult too!
- The more example phrases per intent, the better.
This is how a populated data set looks like:
2. Did you fill in the intent examples? Awesome! Time to publish the dataset. Press the Publish dataset button in the upper-right corner.
Keep in mind that depending on the size of the Knowledge Base, it can take a few minutes for the algorithm to learn the data. After 5-15 minutes, the published changes will be updated and your new dataset will be available and ready to use!
You can see an indicator of that process in the Datasets overview page. Once your dataset Available, the publishing process has been completed!
Pro-tip: You can update an existing dataset by clicking View & Edit. After you make your changes, don’t forget to publish your dataset again. The older version will be active until a new version is published.
Step 3: Connect it all in the MessageBird Dashboard
1. Log in to your MessageBird Dashboard and go to Flow Builder.
2. Select a flow (or create a new one). For this example, we are going to create a new custom flow with WhatsApp as a trigger.
3. Add the Recognize Intent step from the Steps menu on the left. Drag and drop it in the flow and set the following configuration:
- Dataset: Select the Sales or Finance dataset from the drop-down menu.
- Content to recognize: drag and drop the incoming message variable from the Available variables list on the top
- Fallback intent: we can set a default intent here in case a message comes in and none of the intents we’ve defined was found. Set that to default.
- Output variable: leave as intent for now.
4. Add a Branch step from the Step menu on the left. Drag and drop it in the flow after the Recognize Intent step we just made.
From the options, create 2 branches that check for the value of our intent variable. One branch should be checking if it equals Sales and the other if it equals Finance.
5. For this use case, we want to notify our sales team with the sales-related messages and our finance team with finance-related messages via email. To do this, add a Send an Email step in each of the branches that forwards these messages to the right team. All the messages that are not categorized as Sales or Finance, fall under the else branch.
Step 4: Connect to Inbox
1. All uncategorized messages will be forwarded to our support agents in Inbox. To do that, go back to your communication flow and add a Create Inbox ticket step below the Else branch.
Done? Awesome! The final flow should look like this:
2. Publish your flow in the top-right corner of your screen, and you're good to go!
3. To try the flow, initiate a conversation with your WhatsApp or chosen channel. Different messages (sales, Finance or other) should be categorized accordingly. Check out this demo video to see them in action!
And that’s it! 🎉 Now you know how to automatically distinguish topic-specific customer messages and route them to the right people on your team using Flow Builder.
Improving Intent Recognition
Once the Intent recognition workflow is live, you can optimize how well it is able to recognize intents by adding more examples to the knowledge base. If intents are not recognized or incorrect, you can check the incoming messages and add them to the examples in your knowledge base or manually correct the intent.
Intent recognition is key in building a chatbot. To add more functionality to your workflow you can also introduce a question answering mechanism with the FAQ step. This step will learn to answer questions, similar to how it learned to recognize intents using a knowledge base. Learn how to do that in our step-by-step guide.