Google Cloud Natural Language
The Google Cloud Natural Language node allows you to automate work in Google Cloud Natural Language, and integrate Google Cloud Natural Language with other applications. Robbot Automation has built-in support for a wide range of Google Cloud Natural Language credentials, including analyzing documents.
On this page, you'll find a list of operations the Google Cloud Natural Language node supports and links to more resources.
!!! note "Credentials" Refer to Google Cloud Natural Language credentials for guidance on setting up authentication.
!!! note "Examples and templates" For usage examples and templates to help you get started, take a look at Robbot Automation's Google Cloud Natural Language list.
Basic Operations
- Document
- Analyze Sentiment
Example Usage
This workflow allows you to analyze the sentiment of feedback received via a Typeform submission and send a message on Mattermost if that feedback is negative. You can also find the workflow on Robbot Automation. This example usage workflow uses the following nodes.
1. Typeform Trigger node
This node will trigger the workflow when a feedback form is submitted. Make sure to create a feedback form for your event.
- Select 'Access Token' from the Authentication dropdown list.
- Enter the credentials for the Typeform Trigger node. You can find out how to do that here.
- Select the event feedback form from the Form dropdown list.
- Click on Save to run the node.
2. Google Cloud Natural Language node (analyzeSentiment: document)
This node will analyze the sentiment of the feedback that we got from the previous node. We will pass the analysis score to the next node in the workflow.
First of all, you'll have to enter credentials for the Google Cloud Natural Language node. You can find out how to enter credentials for this node here.
Click on the gears icon next to the Content field and click on Add Expression.
Select the following in the Variable Selector section: Nodes > Typeform Trigger > Output Data > JSON > What did you think about the event? You can also add the following expression:
{{$node["Typeform Trigger"].json["What did you think about the event?"]}}
. If you want to analyze the sentiment for a different question, select that question instead.Click on Save to run the node.
3. IF node
This node will check if the score we got from the previous node is smaller than 0
. If the score is smaller than 0
, it will return true otherwise false.
- Click on Add Condition and select 'Number'.
- Click on the gears icon next to the Value 1 field and click on Add Expression.
- Select the following in the Variable Selector section: Nodes > Google Cloud Natural Language > Output Data > JSON > documentSentiment > score. You can also add the following expression:
{{$node["Google Cloud Natural Language"].json["documentSentiment"]["score"]}}
. - Select 'Smaller' from the Operation dropdown list.
- Click on Save to run the node.
4. Mattermost node (post: message)
This node will send the feedback and the analysis score to the Feedback
channel in Mattermost. If you have a different channel, use that instead.
Create a Mattermost node connected to the 'true' output of the IF node.
You'll have to enter credentials for the Mattermost node. You can find out how to enter credentials for this node here.
Select a channel from the Channel ID dropdown list.
Click on the gears icon next to the Message field click on Add Expression.
Enter the following message in the Expression field:
You got a new feedback with a score of {{$node["Google Cloud Natural Language"].json["documentSentiment"]["score"]}}. Here is what it says:{{$node["Typeform Trigger"].json["What did you think about the event?"]}}
.Click on Save to run the workflow.
5. NoOp node
Adding this node here is optional, as the absence of this node won't make a difference to the functioning of the workflow.
- Create a NoOp node connected to the 'false' output of the IF node.
- Click on Save to run the node.
!!! note "Activate workflow for production" This example workflow uses the Typeform Trigger node. You'll need to save the workflow and then click on the Activate toggle on the top right of the screen to activate the workflow. Your workflow will then be triggered when a new form is submitted.