Google Vision derive insights from your images in the cloud or at the edge with AutoML Vision or use pre-trained Vision API models to detect emotion, understand text, and more.
And in this tutorial we will cover a basic tutorial how to use google vision with facebook messenger bot, but you can also use in other types of bots like telegram, slack, whatsapp etc.
First we need to have prepared messenger bot and adjust it a little bit https://tekos.co/flows/facebook-messenger-bot-with-dialogflow/
Import the google_vision_subflow.json file attached to this tutorial and paste it bellow the facebook messenger flow.
By default data from messenger is passed straight to the dialogflow, we need to add switch node to detect if the message type between "photo" & "message". Add switch node and insert properties as bellow, then attach first output to the dialogflow and the second one to the google vision subflow.
You also need to double click on the google vision subflow to insert google api key.
How to get it?
1. Go to https://console.cloud.google.com/apis/credentials
2. Click on the "create credentials" button in the header
3. Select Api Key option
4. Now you will see a popup message with your Api key copy it and paste into the subflow configuration
5. Remember to always restrict your key.
6. After you are in the key restriction tab scroll to the bottom of the page and select API restrictions to "restrict key"
7. In the list search for "Cloud Vision API" select it and save the changes.
8. You also can change the name of your key.
note: Don't worry about the key you saw in the gif, it doesn't exist anymore ;)
All you need to do now is to connect google vision subflow to the facebook sender and that's it.