Understanding Your Customers With Connectors

DZone 's Guide to

Understanding Your Customers With Connectors

Organizations should understand what customers are saying about them and their products, and turn those insights into meaningful actions for their organization.

· Integration Zone ·
Free Resource

The amount of data in the world is growing exponentially. IDC predicted in 2014 that the amount of data on the planet would grow 10-fold in the next six years to 2020 from around 4.4 zettabytes to 44 zettabytes. Additionally, the majority of the recently generated data–like the comments you just made on Facebook–are unstructured or unmanaged.

Luckily, with more leading enterprises, such as Amazon (Alexa), Apple (Siri), and IBM (Watson), are investing in AI, machine learning, and natural language processing these unstructured data have the potential to be transformed into meaningful, informative data for enterprises. They’re developing a new educational platform and products that can adapt to individual preschoolers’ learning preferences and aptitude levels, using data, pattern recognition, and natural language processing for personalized learning experiences.

Among many players, IBM Watson has been driving the adoption of cognitive computing in enterprises, which is believed to become a $2 trillion opportunity over the next decade. For example, Sesame Workshop, the nonprofit educational organization that produces Sesame Street, is developing a new educational platform and products that can adapt to an individual preschoolers’ learning preferences and aptitude levels. In healthcare, many hospitals are using or planning to use IBM Watson to find cures for rare diseases.

To help more organizations explore the possibilities in machine learning and natural language processing, IBM opened its services through APIs in its developer cloud. To help MuleSoft’s ecosystem to participate in this opportunity, Admios developed the MuleSoft Certified IBM AlchemyLanguage Connector, leveraging IBM’s APIs that enable text analysis through natural language process. Using this connector, organizations can understand what customers are saying about them and their products, and turn those insights into meaningful actions for their organization.

Using the Connector for IBM® Watson AlchemyLanguage

The following example shows how to analyze tweets with AlchemyLanguange.

First, set up your mule project by taking the steps below:

  1. Make sure you have the latest version of Anypoint Studio (i.e., 6.x.x).
  2. Since the app will use MuleSoft’s connector for Twitter, please find the following information from your Twitter account.
    1. twitter.access.key=
    2. twitter.access.secret=
    3. twitter.consumer.key=
    4. twitter.consumer.secret=
  3. In order to use the AlchemyLanguage Connector, you need to get an API Key from IBM BlueMix. If you don’t have an IBM BlueMix account, you can create one here.

Once you complete the instructions above, please create an empty Mule project in Studio and download a Twitter Connector and AlchemyLanguage Connector.

Copy and paste the following XML in “Configuration XML” of your Mule project, and put connector configurations for Twitter Connector and AlchemyLanguange Connector in mule-app.properties.

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:twitter="http://www.mulesoft.org/schema/mule/twitter" xmlns:batch="http://www.mulesoft.org/schema/mule/batch" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:watson-alchemy-language="http://www.mulesoft.org/schema/mule/watson-alchemy-language" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/watson-alchemy-language http://www.mulesoft.org/schema/mule/watson-alchemy-language/current/mule-watson-alchemy-language.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/twitter http://www.mulesoft.org/schema/mule/twitter/current/mule-twitter.xsd
http://www.mulesoft.org/schema/mule/batch http://www.mulesoft.org/schema/mule/batch/current/mule-batch.xsd">
    <watson-alchemy-language:config name="Watson_AlchemyLanguage_Service__Configuration" apiKey="${watson.apikey}" doc:name="Watson AlchemyLanguage Service: Configuration"/>
    <twitter:config name="Twitter__Configuration" accessKey="${twitter.access.key}" accessSecret="${twitter.access.secret}" consumerKey="${twitter.consumer.key}" consumerSecret="${twitter.consumer.secret}" doc:name="Twitter: Configuration"/>
    <batch:job name="AnalyseTweetsBatch" max-failed-records="-1">
            <poll doc:name="Poll">
                <fixed-frequency-scheduler frequency="60" timeUnit="SECONDS"/>
                <twitter:search config-ref="Twitter__Configuration" query="@mulesoft" doc:name="Get Tweets" />
            <dw:transform-message doc:name="Get Tweets Array">
                <dw:set-payload><![CDATA[%dw 1.0
%output application/java
            <batch:step name="Batch_Step">
                <batch:set-record-variable variableName="tweet" value="#[payload]" doc:name="Set Tweet"/>
                <dw:transform-message doc:name="Build Request">
                    <dw:set-payload><![CDATA[%dw 1.0
%output application/java
	source: payload.text
} as :object {
	class : "org.mule.modules.watsonalchemylanguage.model.SentimentAnalysisRequest"
                <watson-alchemy-language:sentiment-analysis config-ref="Watson_AlchemyLanguage_Service__Configuration" doc:name="Get Sentiment Analysis"/>
                <dw:transform-message doc:name="Transform Message">
                    <dw:set-payload><![CDATA[%dw 1.0
%output application/java
	tweet: recordVars.tweet.text,
	screenName: recordVars.tweet.user.screenName,
	sentiment: payload.sentiment
                <logger message="#[payload]" level="INFO" doc:name="Logger"/>


After these steps, you will see the following flow in your message flow view. When you run this flow, it polls 15 tweets containing @mulesoft every 60 seconds and uses the AlchemyLanguange Connector in the batch flow to analyze the sentiment of each tweet.


Here are some results of sentiment analysis I performed with this flow:

  tweet=Details about @MuleSoft at #Dreamforce! See you at our #cloud expo., 
    "score": 0.624717,
    "type": "positive"

  tweet=RT @MuleSoft: Visit us at #DF16 to learn how to create your application network!, 
    "score": 0.561539,
    "type": "positive"
  tweet=RT @DeloitteOnTech: Every company today is a #technology company. Join @wdbthree and @MuleSoft's webinar to learn more. Register here:,
    "score": 0.589637,
    "type": "positive"

Replace @mulesoft with your company’s Twitter handle, or the Twitter handle for your products to quickly and easily assess the sentiment of the tweets you are receiving. Of course, you can also replace the Twitter Connector with Facebook or any other social media platform.


For new users, try the above example to get started, and for others, please share with us how you are using or planning to use Watson AlchemyLanguage or other natural language processing services! Also, feel free to check out MuleSoft Certified Connectors or visit the connector certification program page to learn more and be a part of MuleSoft ecosystem.

alchemylanguage ,apis ,connectors ,integration

Published at DZone with permission of Nathan Nam , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}