D365 Social Analytics Solution
As promised! Demoed at our D365 Saturday Summer Boot Camp session on Replacing Dynamics workflows with Flow.
This solution gathers tweets matching a specified hashtag saving them into a custom entity in Dynamics. A second flow then uses the Cognitive Service api to extract useful information from the tweets such as sentiment, key phrases and also translate the tweet if it’s not in English. This blog post contains the two flows as well the solution used in Dynamics with brief instructions on how to put everything back together
Contains a Social Analytics custom entity with some magic in the background!
GetTweets.zip (Gets Tweets matching hashtags and creates records in social analytics entity)
DynamicsSocialAnalyticsV2.zip ( On create of a record in the Social analytics entity, use Text API to get sentiment, translation if not English, key words and update back into Dynamics)
Install the unmanaged or managed solution into your instance which ever floats your boat 🙂.
Text Analytics API Key
You will need an azure subscription on with a Cognitive Text Analytics API service .You can get a trial API key with t 5000 executions for 7 days ( A free azure subscription will not limit you to the 7 days). Go to https://azure.microsoft.com/en-gb/try/cognitive-services/?api=text-analytics
Make sure Text Analytics is selected and hit Get API Key – Choose guest and get started.
You should eventually end up with the your API key and endpoint as shown in the image below which will be needed later on in the flow.
Social Analytics Flow
Head to your flow environment https://flow.microsoft.com. Go to My Flows , you should see Import in the top right, hit that . Upload and import the flow DynamicsSocialAnalyticsV2.zip. You will need to fix the connections to your Dynamics instance. For Text Analytics, select “Select during Import” , Create a new connection, search for Text Analytics, select it and enter one of your Keys and your Endpoint URL. Come back to the import screen, refresh the list and select your new Text analytics connector. Do the same for the Translator connection, named “Microsoft Translator” you shouldn’t need an API key for that. Once all the connectors have been fixed import the flow.
Once complete you should be able to see the Dynamics Social Analytics flow. Edit the flow and point both the Dynamics triggers, at the start and the update action all the way at the bottom to your instance by clearing out the org name, selecting yours and then the Social Analytics entity provided in the installed solution.
Get Tweets Flow
Import GetTweets.zip flow. Fix the connections again by adding a twitter and your Dynamics connections.After upload , you will need to fix the create Dynamics record action at the bottom of the flow as before. Replace #D365Saturday to your favourite hashtag and bob’s your uncle, you can duplicate this flow if you wish to track multiple hashtags.