TIP TwitterPlugin is not installed on Foswiki.org.


Access Twitter via Foswiki

Setting up connectifity to Twitter

In order to be able read information from twitter, you will need to grant access using an api key. Head over to https://developer.twitter.com/en/apps, create an "app" and secure the required information into the plugin's configuration.


%TWITTER{"<method>" [...parameters ...]}%

The plugin tries to make all parameters of the public twitter rest api available to wiki applications. The most common ones are:

Parameter Description Default
<method> known actions are

  • account_settings
  • favorites
  • friends
  • folowers
  • following_timeline
  • retweets_of_me
  • get_lists
  • home_timeline
  • list_statuses
  • mentions_timeline
  • rate_limit_status
  • search
  • user_timeline

... explained below.
header="..." header string to be prepended to the timeline
<ul class='twitter'>
format="..." format string to be used for every tweet of a timeline
<li class='tweet'>$avatar <span class='screen_name'>
  <a href='$profile_url'>$name</a></span> - $time $retweet
  <div class='text'>$text</div> $media
separator="..." separator string between every tweet of a timeline being rendered  
footer="..." footer srting to be prepended to the timeline
avatar_format string to render the user of a tweet, i.e. it's avatar
<a class='avatar' href='$profile_url'><img src='$profile_image_url' height='48' width='48' title='$screen_name' /></a>
retweet_format string to render a retweet differently
<span class='retweet'>%MAKETEXT{"retweeted [_1]" args="<a href='https://twitter.com/$orig_screen_name'>$orig_screen_name</a>"}%</span>
time_format string to render the tweet's time stamp
<a href='$url' class='time'>$relative_created_at</a>
photo_format this string is used to rendere a photo part of a tweet
<a href='$display_url' class='photo'><img src='$url' width='$width' height='$height' /></a>
raw="on/off" use this switch to return the raw json result of an action; all above format string won't be used then off
count="<int>" number of tweets to return 20

For additional parameters see https://dev.twitter.com/rest/public.

Identifiers that can be used in a format string are:

  • $avatar: expands to the result of the avatar_format string
  • $time: expands to the result of the time_format string
  • $url: status url
  • $profile_url: link to the profile of the user that tweeted this status
  • $retweet: expands to the result of the reteweet_format
  • $media: expands to the result of the photo_format string
  • $profile_image_url: link to the user's avatar image
  • $text: text of this tweet
  • $created_at date when this tweet was created
  • $relative_created_at
  • $screen_name: user's screen name
  • $name: user's name
  • $orig_screen_name: screen name of the user that created the original tweet
  • =$orig_name: name of the user that created the original tweet
  • $id: id of this tweet


TODO: this list is not complete yet. See additional methods at Net::Twitter.


Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter.


  • user_id
  • screen_name
  • count
  • since_id
  • max_id
  • include_entities




Returns a list of users following the specified user.


  • user_id
  • screen_name

Additional identifiers available when formatting results:

  • $created_at
  • $description
  • $favorites_count
  • $followers_count
  • $friends_count
  • $id
  • $lang
  • $listed_count
  • $location
  • $name
  • $profile_background_color
  • $profile_background_image_url
  • $profile_background_image_url_https
  • $profile_background_tile
  • $profile_image_url
  • $profile_image_url_https
  • $profile_link_color
  • $profile_location
  • $profile_sidebar_border_color
  • $profile_sidebar_fill_color
  • $profile_text_color
  • $profile_use_background_image
  • $protected
  • $screen_name
  • $status
  • $statuses_count
  • $time_zone
  • $url
  • $utc_offset
  • $verified


Returns all lists the authenticating or specified user subscribes to, including their own. The user is specified using the user_id or screen_name parameters. If no user is given, the authenticating user is used.


  • user_id
  • screen_name
  • reverse

Additional identifiers available when formatting results

  • $id
  • $name
  • $slug
  • $mode
  • $subscriber_count
  • $member_count
  • $full_name
  • $description


   format="   * slug=$slug, id=$id"


Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends.


  • since_id
  • max_id
  • count
  • exclude_replies
  • contributor_details
  • include_entities
  • trim_user




Returns tweet timeline for members of the specified list. Historically, retweets were not available in list timeline responses but you can now use the include_rts=true parameter to additionally receive retweet objects.


  • list_id
  • slug
  • owner_screen_name
  • owner_id
  • since_id
  • max_id
  • count
  • include_entities
  • include_rts


   owner_screen_name="<screen name>"


Returns the 20 most recent mentions (statuses containing @username) for the authenticating user.


  • since_id
  • max_id
  • count
  • trim_user
  • include_entities
  • contributor_details

See also https://dev.twitter.com/rest/public/search


  • q (required)
  • count
  • lang
  • locale
  • rpp
  • since_id
  • max_id
  • until
  • geocode
  • include_entities


Returns the remaining number of API requests available to the authenticated user before the API limit is reached for the current 15 minutes window.

Additional identifiers available when formatting results:

* $limit(<resource>) * $remaining(<resource>)

<resource> is the name of the resource that a rate limit appies to. See https://dev.twitter.com/rest/public/rate-limits for a list of available resources.


   format="| *Resource* | *Limit* | *Remaining* |
           | /application/rate_limit_status | $limit(/application/rate_limit_status) | $remaining(/application/rate_limit_status) |
           | /statuses/lookup | $limit(/statuses/lookup) | $remaining(/statuses/lookup) |
           | /statuses/home_timeline | $limit(/statuses/home_timeline) | $remaining(/statuses/home_timeline) |
           | /statuses/user_timeline | $limit(/statuses/user_timeline) | $remaining(/statuses/user_timeline) |
           | /favorites/list | $limit(/favorites/list) | $remaining(/favorites/list) |
           | /lists/list | $limit(/lists/list) | $remaining(/lists/list) |
           | /lists/statuses | $limit(/lists/statuses) | $remaining(/lists/statuses) |
           | /followers/list | $limit(/followers/list) | $remaining(/followers/list) |
           | /search/tweets | $limit(/search/tweets) | $remaining(/search/tweets) |


Returns the 20 most recent statuses posted by the authenticating user, or the user specified by screen_name or user_id.


  • user_id
  • screen_name
  • since_id
  • max_id
  • count
  • trim_user
  • exclude_replies
  • include_rts
  • contributor_details



Installation Instructions

First, you need to create a twitter app. Log in to your Twitter account and go to https://apps.twitter.com/. Click on "Create New App" and fill out the details, i.e. insert the URL of the new Foswiki website that you've installed this plugin on. After clicking on "Create your Twitter application" you will get to a screen allowing you to manage and configure details as required. Click on the "Keys and Access Tokens" tab and collect the information needed to configure TwitterPlugin using configure correctly

  • $Foswiki::cfg{TwitterPlugin}{APIKey}
  • $Foswiki::cfg{TwitterPlugin}{APISecret}

Next click on "Create my access token" and record these keys in:

  • $Foswiki::cfg{TwitterPlugin}{AccessToken}
  • $Foswiki::cfg{TwitterPlugin}{AccessSecret}

Make sure that you do NOT share this information with anybody else and that these keys are not readable by unauthorized people inspecting the LocalSite.cfg file on your Foswiki server.



Change History

05 May 2022: added docu about how to connect to twitter
21 Oct 2020: rewrite of caching code
24 Oct 2017: fixed use of uninitialized value; added proxy support
30 Nov 2016: added account_settings, friends, following_timeline, retweets_of_me apis; fixed encoding on Foswiki-2.x; added rest hanlder purgeCache and clearCache to maintain the cache
16 Dec 2014: added followers and rate_limit_status api
20 Nov 2014: initial release

PackageForm edit

Author Michael Daum
Version 4.01
Release 05 May 2022
Description Access Twitter via Foswiki
Copyright © 2014-2022 Michael Daum
License GPL (Gnu General Public License)
Home Foswiki:Extensions/TwitterPlugin
Support Foswiki:Support/TwitterPlugin
Repository https://github.com/foswiki/TwitterPlugin
ExtensionClassification Interface and Visualisation
ExtensionType PluginPackage
DemoUrl http://
SupportUrl TwitterPlugin
ModificationPolicy CoordinateWithAuthor
I Attachment Action Size Date Who Comment
TwitterPlugin.md5md5 TwitterPlugin.md5 manage 162 bytes 05 May 2022 - 15:10 MichaelDaum  
TwitterPlugin.sha1sha1 TwitterPlugin.sha1 manage 186 bytes 05 May 2022 - 15:10 MichaelDaum  
TwitterPlugin.tgztgz TwitterPlugin.tgz manage 11 K 05 May 2022 - 15:10 MichaelDaum  
TwitterPlugin.zipzip TwitterPlugin.zip manage 15 K 05 May 2022 - 15:09 MichaelDaum  
TwitterPlugin_installerEXT TwitterPlugin_installer manage 4 K 05 May 2022 - 15:10 MichaelDaum  
Topic revision: r6 - 05 May 2022, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy