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

WHISHWORKS-MuleSoft Advantages of API-led connectivity

5 customer advantages of API-led connectivity

In this blog post, we highlight five distinctive examples of how API-led connectivity can result in innovation and competitive advantage.

SFDC customer topic listener

Set up Salesforce PushTopics for real-time updates with Mule 4

Learn how a customer-related event from Salesforce CRM, is captured, processed, and synchronised with other business systems using Mule 4.

Salesforce CDC - MuleSoft integration

Salesforce CDC (Change Data Capture) integration using MuleSoft

This article discusses Salesforce CDC (Change Data Capture) integration with applications, databases or other SaaS platforms, using MuleSoft.