The Twitter API is no longer free to use. This module will continue to exist but it won't display anything unless you subscribe to at least the Basic plan (currently $100.00/month 😱)
This module provides blocks to display/embed tweets in Drupal.
It uses the Twitter API v2 with a custom service performing request from Drupal. When displaying embed tweets, the JavaScript library is automagically loaded from Twitter.
So to say, this module have no external dependencies except to the key module which is required to securely save your Twitter application's credentials.
If the Token module exists and is enabled, you can use tokens in your search query.
Configuration
Create a project with an application on Twitter and copy/paste credentials into a new key in Drupal (e.g. Admin > Config > System > Keys):
Usage
Create a Twitter block as follow:
- Go to Admin > Block layout
- Place a new Twitter search block somewhere
- Configure the search (e.g. see examples below)
- Save the block and enjoy your tweets!
Tweets and embed tweets are rendered with two editable templates:
tweets.html.twigtweet.html.twig
Examples
This module uses the powerful query parameter provided by Twitter API v2 giving us an infinite number of possibilities... but here are a few common use cases:
Display tweets matching word(s)
apple
apple chocolate
apple OR iphone ipad
manzana lang:es has:media -is:retweet
Display tweets for a specific #hashtag
#drupal
#drupal has:media
#drupal has:links -is:retweet
Display tweets in the current language
#drupal lang:fr
#drupal lang:[language:langcode]
Display tweets from a given user
from:drupal
from:[your-token-with-the-twitter-user-name]
Requirements
Twitter API Block Entity Reference depends on:
- Block (core)
- Key (contrib)
Complementary modules
- Token module if you want to create dynamic search query
- Block Visibility Groups module if you need to manage many Twitter blocks
Slack channel
Join me in Slack in the #twitter-api-block channel! Details on how to connect to Drupal Slack here
Project information
- Project categories: Content editing experience, Integrations
- Ecosystem: Twitter, Key
333 sites report using this module
- Created by matthieuscarset on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
No build if twitter app not connected



