This tutorial shows how to create a simple but effective WhatsApp agent on the studio.
Your first conversation flow
Here's a quick breakdown of Studio. Once you open the production canvas you will be greeted with the ToolBar and the Canvas:
On the left side of your canvas you will be able to see the ToolBar which contains everything you need to access, build and run your agent.
In the center of the canvas, you will notice a node labeled START.
This is the starting point of the conversational flow. This node has to be attached to the rest of the conversational flow.
Note: Without having the START node connected to the rest of the conversation, the virtual agent cannot be used and will not execute your flow!
To start building, simply drag and drop the nodes from the ToolBar to the middle of the studio.
Tip: You can rename nodes by clicking on the default name of the node!
Step 1: Create a Greeting Message
For your first agent, once you've figured out an easy use case, start by adding a greeting statement to introduce your virtual agent and what it can do.
To do this you need to add a Send Message node.
Note: Make sure you connect all the nodes in your flow in the right order. The arrows indicate the direction of the flow, therefore, make sure the arrows are attached to the boxes correctly.
Tip: You can add a node by dragging and dropping from the toolbar or right clicking and selecting add a node.
Step 2: Gather Input from your user
At this stage, you’ll want to collect the intention of your user. To do this you need to add the Collect Input node.
WhatsApp Agents can accept various kinds of input and output messages including rich media (GIFs, videos, etc) text, image, audio, files and location. You also have the ability to include list messages and reply buttons.
First, you’ll need to include a Parameter under which the input will be collected. Each Parameter needs to be attached to an Entity. The Entities entail the various kinds of input your user will provide.
There are different entity types for example “sys.names” - to capture human names, “sys.phone numbers'' - to capture the phone number with country code and “sys.any” - which captures any kind of input from words, digits to serial numbers.
You can choose a pre-loaded system Entity or create your own. In this case we used “sys.any” which can collect any type of input.
Bonus Tip: If you need to create a custom Entity, we recommend you go to Entities first, create your custom entity and then add the collect input node.
You can then create prompts for the user with a question to answer here.
Note: We recommend that you name your Parameters in capital letters separated by an underscore.
To now give your user an adequate answer, you need to match their input to the correct place within the flow and knowledge base that you have created.
After Collect Input, there are various follow-up options. You can either use the Classification or the Conditions node to classify the user input depending on your use case.
The node that we are going to choose for this flow is called Classification. In this case we want to be able to differentiate between our desired user intent.
By using the Classification node to categorize the different ways your user can imply the same intent, the agent building process becomes more efficient.
To be able to use this node we will first have to create the different Intents our users might want to access.
Under each specific Intent, we need to provide training phrases, i.e different ways a user can ask for the same topic. We recommend you add at least 10 unique phrases in the training set.
We can then add the Classification node to classify between the created Intents.
Note: Be sure to use the right Parameter which you used to collect input!
Step 4: Decide the rest of the flow!
The rest of the flow depends on the Use Case you are trying to create.
Make sure to connect all the nodes in order, end your conversation with the End Conversation node and have a plan for fallbacks.
When we refer to fallbacks we mean cases where there are:-
No Inputs - No input from the users end
Missed Inputs - Perhaps your user said something that the agent wasn't able to catch?
Invalid Entries - Cases where the wrong kind of input was provided by the user, eg. the user provides a name instead of a phone number.
For each of these, we recommend completing the happy path (i.e ideal flow) of the agent first and then deciding the best course of action for the unfavourable entries or lack thereof.
Step 5: TEST TEST TEST!
Once you finish building your agent, be sure to test the flow using the inbuilt tester!
You can pre-fill Parameters you want to the agent to work with (by clicking on the settings icon) and also choose the mode of testing.
Make sure you publish your agent in order to be able to use it outside the testing environment as well!
This was an example of a bare bones agent. There's lots more you can accomplish with Studio!
If you need more information on the features available, the Studio Documentation dives deep into how to build a stellar agent. You can access it by clicking on the information symbol in any open node drawer.
In case you think you're stuck or want more information than what's listed in the documentation, we are also available on [email protected]