How to use Mule Twitter Connector

Home > Search > How-to
  by

Twitter

 

Create a new project in Mule

  1. In Mule, select File > New > Mule Project.
  2. Name the project TwitterConnector and select Finish.

 

Install the Twitter Connector

  1. Near the upper left-hand corner of Mule, select the Open Exchange icon.
  2. Install the Twitter Connector.

 

Create the Canvas

  1. Drag the HTTP connector from the right-panel of Mule to the canvas.
  2. Connect the Twitter connector to the HTTP connector.
  3. Connect the Logger connector to the Twitter connector.

 

Configure the HTTP connector

  1. Hightlight the HTTP connector. Under HTTP, click the green plus icon and select OK. Connector Configuration should now display HTTP_Listener_Configuration.
  2. Select Path to gettweets.

 

Configure the Twitter connector

  1. Hightlight the Twitter connector.
  2. Next to Connector Configuration, select the green plus icon and enter your Twitter Access Key, Access Secret, Consumer Key, and Consumer Secret.
  3. Select Test Connection to ensure the connection can be established.
  4. Set Operation to Get user timeline by screen name.
  5. Set Screen Name to #[message.inboundProperties.'http.query.params'.sname].

 

Configure the Logger connector

  1. Hightlight the Logger connector.
  2. Set Message to #[payload.text]‚Äč.

 

Run the application

  1. In the top menu, select Run Run As > Mule Application and select OK. The Console should display the name of your project and a status of DEPLOYED.
  2. Navigate to http://localhost:8081/gettweets?sname=john_doe, and John Doe's last 20 tweets should be displayed.


Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments