In the previous blog of this series, Wayne Rowley detailed the ups and downs of working with Chatfuel. This week it’s Dialogflow’s turn, as our Client Services Developer Sam Davidge walks through the pros and cons his team encountered with the framework.
What is Dialogflow?
Owned by Google, Dialogflow is a natural language processing platform powered by artificial intelligence. Mercedes, The Wall Street Journal, Hubspot are just some of the worldwide organisations using the framework, so it made perfect sense for Redweb to learn more about it as part of our Development department hack day.
Before launching into the build of our chatbot, there were a few basics we needed to understand and master first:
- Agents – ‘natural language understanding modules’ that interpret user requests and return actionable data
- Invocation – the way the conversation between user and agent is started (e.g. ‘Hello!’)
- Intent – a collection of logic and information that helps the agent recognise what the user would like to achieve from an interaction, e.g. if the user interacts with the bot with the goal of playing music, the intent would be “play music”. The many forms of requesting music, such as “play some music”, “put some music on” or “play music”, can then all be mapped to the one intent
- Entities – pieces of important data that will help the agent answer the user’s request, e.g. when requesting music, an entity could be “artist”. Mapping “Arctic Monkeys” to the artist entity can then help ensure that “play Arctic Monkeys” results in music, and “play Monopoly” results in something else entirely
- Fulfilment request – the agent sends information to a set webhook to fetch the data required to answer the user
Got all that? It’s time to get stuck in and see what Dialogflow is really capable of.
What’s so great about Dialogflow?
As well as being free, the first major plus we noticed was just how easy Dialogflow is to use. You don’t need a wealth of technical knowledge to start creating simple conversations (although this will only get you so far, of course). Google has done an excellent job in making the whole process of getting up and running very straightforward – for such a powerful tool, that’s quite a credit to its creators.
The platform is easily integrated with a large variety of external services, from Facebook Messenger and Twitter, to Slack and Skype (among many others). It’s also possible to send different responses to different integrations. Linking up with your own web service is pretty simple too – you receive a POST request and reply with a JSON object.
We also found that you can provide an array of replies for one message – so one intent is not limited to one response. This is a major contributor to helping the conversation feel more natural, softening the ‘artificial’ feel that you may find with other chatbots.
As well as being great for end-users, it feels welcoming as a developer. You merely provide an webhook and you’re well on your way. Authentication is up to the developer and can be implemented via headers in the HTTP(S) request made by Dialogflow. This approach allows complete freedom in how you deal with fulfilment.
The downsides of Dialogflow
At a basic level, the managing and creation of conversations seems to work fine – a user has an intent and you handle it, no big deal. Thinking at a more advanced level though, an organisation may have a huge number of intents and conversations, so being able to group them would be nice. This is technically possible with follow-up intents, but simply categorising/colour coordinating each intent would contribute to making it feel more manageable. As we added more intents, organising them felt a bit messy and clunky. I can imagine it becomes quite the headache when you have well over 100.
One of the other more notable downsides of Dialogflow is that you can only provide one webhook. It would have been nice to provide more and choose which one to use on an intent-by-intent basis. This means only one application is able to deal with external fulfilment. Although, you could have one application as the webhook, which delegates intents to other web services (if you really needed to).
To help with this, you could use Firebase functions as your ‘intent manager’, which would save the need to host it yourself. Firebase is another of Google’s services, providing the ability to run hosted Node scripts. Google has integrated the two with an inline editor, meaning you may never need to host/configure your own web services.
What did we learn?
Dialogflow is a great platform if natural language processing is a priority and you want to get up and running with minimal programming. The fact that integration with different platforms is as easy as simply enabling it and following instructions is a big bonus.
In spite of Dialogflow being a Google platform, it’s also relatively ‘agnostic’ in that you aren’t forced to adopt Google’s services for everything – Amazon’s Alexa being a prime example of this. Of course, it will try and push its own services (such as Firebase) over others, but you aren’t restricted to them.
It did have its downsides – managing intents could get cumbersome very quickly. It’s also possible to train your agent by reviewing users’ interactions and fine-tuning intents accordingly – but like managing intents, this comes with quite a bit of admin and manual work.
Overall, it’s an impressive framework – no wonder it was used by our Drupal team for a mince pie rating chatbot back in December!