Integrating Twitter feed to your Drupal site

Twitter API can be a major PITA sometimes, but luckily there are modules for Drupal that makes integrating it to your website easy.

Required items:

  • Twitter module (this tutorial uses 7.x-5.8 version)
  • Oauth module (this tutorial uses 7.x-3.2 version)
  • A Twitter account

Steps for installation:

  1. Download the above modules
  2. Enable Twitter and Oauth modules
  3. Go to https://apps.twitter.com/
  4. Click 'Create New App'
  5. Give Name, Description and Website for this integration
  6. Under Callback URL, input 'http://yourdomain.com/twitter/oauth'
  7. Click 'Create'
  8. In your Drupal site, go to http://yourdomain.com/admin/config/services/twitter/settings
  9. In OAuth Consumer key and OAuth Consumer secret, input your app credentials (it's under 'Keys and Access Tokens' tab in Twitter)
  10. Click 'Save configuration'
  11. Go to Twitter tab in your Drupal site
  12. Click 'Go to Twitter to add an authenticated account'
  13. Authorize the app with your Twitter credentials
  14. Your Drupal site should now have your Twitter profile icon displayed! In that line, tick Tweets checkbox and click 'Save changes'

That's it, your site is now integrated with your Twitter feed! The tweets can be integrated with Views to your site. The Twitter module creates a View automatically that displays the tweets, the default url is http://yourdomain.com/tweets. You can edit this view or create completely new.

You can see the result on this site, the tweets on the right are pulled from my Twitter feed and displayed as a View.

If you don't see any Tweets coming up, remember to run cron in your Drupal site.

Comments

Arnaud's picture
Arnaud
Wed, 01/07/2015 - 10:58

Note that for consuming streaming APIs, the twitterstream module (https://www.drupal.org/project/twitterstream) is a development attempt at doing that. Just leaving it there in case somebody would be interested.

Kristian Polso
Wed, 01/07/2015 - 11:29

Thanks, that's really helpful! I had no idea you could integrate the new Streaming API to Drupal.

Thank you for introducing twitterstream. That helps me. Thanks again!

Martin's picture
Fri, 01/09/2015 - 18:04

Thanks for explaining how to set it up.

Is there away of limiting the number of tweet that are displayed, You have 5 tweets displayed mine has 20 and its making the sidebar really long?

john's picture
Thu, 09/22/2016 - 21:18

Hi, how did you finally solve the number of tweets to show?

svarc's picture
Tue, 03/10/2015 - 10:57

Thanks for the tutorial.
I was looking for a way to implement twitter feeds to Drupal for more than a month but i was trying to implement OAuth+Feeds to create tweets content.
Is there any way that i could incorporate this with Feeds module?
Thanks in advance.

Daniel's picture
Daniel
Mon, 05/04/2015 - 15:35

Hi, Great how-to. Thanks!

I am having some issues though. My Twitter feed isn't updating, even if I manually run cron. I have done some basic troubleshooting with no joy. Do you have any suggestions?
Things I have tested. I went to twitter and checked that oauth is working and it appears to be.
I have disabled and enabled the module.
Thanks

Mici's picture
Mici
Wed, 06/24/2015 - 15:30

Hi, many years ago integrating a twitter account caused the account to be shut down by twitter because the integration was seen as "suspicious" by twitter, this was solved by contacting Twitter and getting some certain "status" - is this still an issue these days?
Can I select only tweets with a certain # to appear in the feed? -> I could have different feeds on different webpages from the same Twitter account?

in my website i did all configuration but it is not showing any message

Sophie Payne's picture
Sophie Payne
Fri, 04/29/2016 - 13:01

This is such a helpful article, thank you. I've referred to it again and again when adding twitter feeds.

Ulrike's picture
Mon, 07/11/2016 - 02:23

Thanks a lot, really helpful and clear description.

Valerie's picture
Valerie
Mon, 10/31/2016 - 04:36

Thank you for the clear instructions!

Drupal's picture
Wed, 04/12/2017 - 18:14

Greetings to all, giuys! Thanks for the article, and here’s a question for you straight away – does integration with Instagram way go in a similar way?

Add new comment