Azure Text Analytics sentiment analysis with North52

For the last several months I've been working on an enterprise Dynamics CRM project where one of our goals is to minimize the amount of custom code we write by using North52's Business Process Activities. I had not been exposed to North52 before working on this project, but I have been pleasantly surprised with how much it has allowed our mostly functional resources to achieve without needing technical assistance.

While looking through North52's documentation a while back, I noticed it could be used to call a REST web service. This got me thinking about how I could rework my Sentiment analysis in Dynamics CRM using Azure Text Analytics sample using North52 instead of a custom workflow activity.

I found I was able to replace the custom workflow activity with a North52 Process Genie. It executes a Smart Flow to call the Azure Machine Learning Text Analytics API and then return the result to the calling CRM dialog.

Here's the formula I used in my Process Genie:

  SetVar('jsoninput', CreateJObject( 
                           CreateJProperty('Id', '1'),  
                           CreateJProperty('Text', [account.texttoanalyze]) 

      SetRequestActionPass(SetVar('result', GetVarJsonValue('SentimentBatch{0}.Score'))),
      SetRequestActionFail(SetVar('result', 'ERROR' + GetVarJsonValue('Errors{0}.Message')))


Here's a screenshot of my CRM dialog:
CRM sentiment analysis dialog

To execute the Process Genie, you use a North52 N52 Process Genie step like this:
Process Genie step

The Formula ShortCode value is the short code of the North52 Process Genie. The Formula Parameter Xml value contains the text to analyze from the dialog input in the format expected by the formula:

<account><texttoanalyze>{Response Text(Get text)}</texttoanalyze></account>

If were going to use this in real solution, I would not hardcore the Azure ML API key directly in the formula. Other than that I think this is a production-ready approach.

What do you think? Would you consider using something like this as an alternative to writing your own custom code?

comments powered by Disqus