messengers API integration with Google natural language using API Chains
Google natural language is a unique and powerful text analysis tool. It is used in a number of areas, such as machine translation, chatbots, spam filters, as well as search engine optimization (SEO). In search engine optimization, the most interesting elements are the tonality of the text (sentiment), entities and salience (significance/salience).
We strongly recommend that you familiarize yourself with the service more closely, you can do it here. You will immediately be offered a demonstration of the service's capabilities:
Where you can make an independent analysis of the text:
API chains provide the ability to configure 2 types of analysis: Entities and Sentiment.
An entity is a word or phrase representing an object that can be identified, classified and categorized, for example, people, goods, events, numbers, organizations, etc.
Sentiment is an analysis of the emotional coloring of the text: positive, negative, neutral.
Customization
In the initial setup, you will need a Google key. We wrote more about creating a key here.
Next, we need to configure the dynamic document parameter, regardless of whether we request.
https://cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeEntities
or
https://cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeSentiment
the document must contain at least "content" and "type" parameters (https://cloud .google.com/natural-language/docs/reference/rest/v1beta2/documents#Document ), therefore, it is necessary to use additional text processing using custom NodeJS code to create the object we need.
Response
You will also find the answer options in the documentation:
https://cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeEntities
or
https://cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeSentiment