In this tutorial we will use Whatsapp bot as an example of dialogflow use case.
Remember that you can use other services like facebook messenger, telegram, signal etc.
Firsly you need to create dialogflow agent and get the creditentials (TUTORIAL).
To use dialogflow in tekos flow we need to understand how data is processed.
Dialogflow takes an input message for example "Hello" from whatsapp and passes it throught google NLP systems, deciding what user wants from our system. Soo we need to teach our dialogflow agent some intents.
For this example we have created an agents that does 3 things.
- Answers to hello type messages
- Answers greatings to tekos
- Send a link to a gif file with a dancing man
1. This default dialogflow intent that answers to our message with predifined responses.
2. We created intention "Tekos love" and trained it with phrases like
And it responses with predefined phrases like
3. Last one is a little more tricky example, because we also need to define dialogflow action.
We have named the action as "dance_off"
We need tekos switch node to fetch that action. In shortcut if the (msg._dialogflow.action equals dance_off) use switch node first output.
First output is connected to change node that changes msg.payload to the link https://i.pinimg.com/originals/ee/4f/67/ee4f6744f579bd9cbc25267ab3ed6d4e.gif
after that you need to provide the text node to fullfill message with parameters.
Everything is set, soo if in the whatsapp we send message similar to phrases we have trained our agent. for e.g. "I want to dance". Dialogflow will recognise our intent and send specific action in this case "dance_off" to the flow.