Integration with Twitter using Mule ESB

  • Written By WHISHWORKS
  • 31/05/2015


In this blog post, we are going to explain a step by step procedure to integrate with Twitter using Mule ESB Twitter connector.


In this blog post, we would be using

  • Twitter Connector 3.2.0
  • Anypoint Studio
  • Mule ESB Server 3.5.2


  • To use this application in your project, a Twitter account needs to be created for testing. We can create an account by the URL and register using an email address.
  • A new Twitter app has to be created under Twitter developer apps in order to communicate with the Twitter account from Mule ESB application.  We can also connect to an existing app if it is already created. In this blog post, we will create a new Twitter app.

Configuring Twitter App

  • Go to
  • Sign in and click on Create New App button
  • Fill the form and choose- Create the Twitter application button. A sample form is given below
Integration with Twitter using Mule ESB
  • Click on Keys and Access Tokens tab
  • Click on Create my Access Tokens
  • Make a note of Consumer Key, Consumer Secret, Access Token and Access Token Secret.
  • These keys will be used in Mule application to connect to Twitter
  • A sample screen is given below
Integration with Twitter using Mule ESB

Configuring MuleESB Twitter Connector

  • Create a new Mule Application
  • Click on Global Elements tab in the main flow
  • Click on Create Button
  • Select Twitter under Connector Configuration group
  • Add Consumer Key, Consumer Secret, Access Token and Access Token Secret in the corresponding text boxes
  • In the given example, the keys are read from a property file and the property file is loaded using PropertyPlaceholder global component
  • We can click on Test Connection button to verify connection to twitter before developing the main flow
  • A sample screen and XML configuration is given below
Integration with Twitter using Mule ESB, Configuring MuleESB Twitter Connector
location="file:${mule_home}/conf/" />
<twitter:config name="TwitterConfig" accessKey="${APIKey}"
accessSecret="${APISecret}" consumerKey="${consumerKey}"
consumerSecret="${consumerSecret}" doc:name="Twitter" />

Mule Flow to connect to Twitter and retrieve user details

  • Configure a flow as given below
Integration with Twitter using Mule ESB
<flow name="TwitterShowUserFlow" doc:name="TwitterShowUserFlow">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="3333" path="twitterconnect" doc:name="HTTP" />
<twitter:show-user config-ref="TwitterConfig"
doc:name="ShowUser" />
doc:name="Object to JSON" />

Testing and Observation

  • Deploy the mule application
  • Hit the following URL on the browser


  • If the authentication details are correct, it shows a JSON message back on the browser with logged in user account details.

If you would like to find out more about how Systems Integration could help you make the most out of your current infrastructure while enabling you to open your digital horizons, do give us a call at +44 (0)203 475 7980 or email us at

Other useful links:

Integration with LinkedIn using Mule ESB

Integration of Mule ESB with Microsoft Azure

Integration with Dropbox using Mule ESB

Latest Insights

Salesforce health cloud - healthcare

Healthcare in the Cloud

Salesforce Health Cloud is designed to improve patient satisfaction, deliver high-quality patient care, and deliver positive outcomes.

Cloud API integration strategy

Cloud API integration strategy – an introduction

It is simple, with the growing market of SaaS applications and cloud computing, point-to-point integrations with custom code are no longer good enough to provide seamless connectivity between these applications. […]

Data visualisation

Data Visualisation 101

Data visualisation is a careful and thoughtful process of combining both data and visuals to convey the right message.