In this lab we will create a logic app that triggers on finding feedback from twitter, analyze the tweets sentiments using Azure Cognetive Services and send the results to a slack channel.
- Active Azure account portal.azure.com
- Active twitter account
- Active slack channel
Create a Text Analytics API in the Azure portal
- Follow the steps in this walkthrough, make sure to select Text Analytics API
- Wait a few minutes for the API keys to get ready. You should see the following message under Quick Start tab
- Take a note of the Account Name, Key and Endpoint. We will use them later:
Now we will create a Logic Apps that triggers on twitter feed, and posts them to a slack channel after a sentiment analysis on the content.
-
From the main Azure menu, choose Create a resource > Enterprise Integration > Logic App
-
Under Create logic app, provide details about your logic app and click Create once done.
-
After Azure deploys your app, the Logic Apps Designer opens and shows a page with an introduction video and commonly used triggers. Under Templates, choose When a new tweet is posted.
-
Set up the trigger to listen for tweets based on a keyword or hashtag. On polling-based triggers, such as the Twitter trigger, the recurrence property determines how often the logic app checks for new items.
-
Now we will start analyzing the tweet text. In Logic App Designer, under the trigger, choose New step. Find the Text Analytics connector and select the Detect Sentiment action.
-
Under Request Body, select the Tweet Text field, which provides the tweet text as input for analysis.
-
After you get the tweet data and insights about the tweet, we will post all into a slack channel. Click on Next Step and search for Slack and select Post Messages. You will need to signin to your slack account and allow the logic app to post in your behalf.
- Select the slack channel yo post to, and the message text. In this example we will post the tweet sentiment analysis score, the twitter handle and the tweet text.
- Click on Save and Run. Tweet with the hashtag you set in step 5, you should see the sentiment score and text in your slack feed.