Bringing Social Feeds into a SharePoint Intranet is something a lot of people need. I've put together a solution to show a Twitter Feed. If you are looking for a Facebook feed see Facebook Web Part for SharePoint 2013/2016/Online.

  • git clone
  • cd sp-clientapps\PowerShell
  • .\Release.ClientApp.ps1 -siteUrl -username "" -clientApps "C:\Repos\sp-clientapps\Client Apps\Common","C:\Repos\sp-clientapps\Client Apps\Twitter"
  • Signup as a Twitter developer and register an app
  • Run the Get-Tweets.ps1 PowerShell script to get the Auth Token and populate the Twitter Cache list.
  • Add the web part to a publishing page, click Add Web Part -> Client Apps - > Facebook Web Part
  • Click the Gear icon to configure
  • Publish your page
  • Setup a Scheduled Task to keep the Twitter Cache list up to date


The Twitter Web Part displays a Twitter feed of a single account. It has configuration to support refresh and page size as well as the account name and a title for the Web Part.

Here's one I've configured to bring in the feed from

How it works

The design of this solution is different to the Facebook Web Part. This is primarily because the Twitter Rate Limits are a lot lower, and it would be easy to hit those limits if all the users went direct to the Twitter API. This solution uses a list as a centrlised cache, which can scale easily.

Here's how the solution looks in a high level diagram:

Web Part Communication Process

The Twitter Web part only interacts with SharePoint and uses the SharePoint Client Side Object Model (JavaScript). Data is retrieved from a list “Twitter Cache”. If the Refresh option is set in the Web Part configuration, then an automatic refresh from the Twitter Cache occurs on the specified interval.

Solution Requirements

This solution runs with:

  • SharePoint 2013
  • SharePoint 2016
  • SharePoint Online

The Web Part uses:

  • jQuery
  • MomentJs
  • Bootstrap Grid Styles

The Get-Tweets Server Solution uses:

  • A scheduled task
  • SharePoint CSOM
  • PowerShell 3 or higher

You could run this in other ways, I've outlined a Scheduled Task because its quite easy. It requires a server that you control. This part of the solution cannot run directly within SharePoint.

User Security Requirements

Users must have READ access to the Twitter Cache list at the root of the Site Collection. For security reasons only administrators and the Get-Tweets process account should have write access to this list.

Deploying the Web Part

When you deploy this web part, the PowerShell release process will import some sample Twitter Feed items into the Twitter Cache list which originally came from the feed. This is just to help get up and running quickly. Once you run the Get-Tweets.ps1 script, this sample feed will be overwritten.

Grab the source from my GitHub repository sp-clientapps
Either download it, or use GIT

git clone
cd sp-clientapps

Run the deployment which uses the SharePoint Client Side Object Model:
Deploy to SharePoint Online - Example

This example deploys the Common and Twitter Client Apps to a Site Collection in SharePoint Online.

cd PowerShell
.\Release.ClientApp.ps1 -siteUrl -username "" -clientApps "C:\Repos\sp-clientapps\Client Apps\Common","C:\Repos\sp-clientapps\Client Apps\Twitter"

Note: Check your paths, as this assumes you have cloned to C:\Repos\sp-clientapps

Deploy to SharePoint 2013 - Example

This example deploys the Common and Twitter Client Apps to a Site Collection in SharePoint 2013.

cd PowerShell
.\Release.ClientApp.ps1 -siteUrl -username "mydomain\myuser" -clientApps "C:\Repos\sp-clientapps\Client Apps\Common","C:\Repos\sp-clientapps\Client Apps\Twitter" -spOnline:$false -csomVersion 15

Note: Check your paths, as this assumes you have cloned to C:\Repos\sp-clientapps

Client Apps are deployed to {SiteCollection.URL}/Style Library/Client Apps/[Client App Name].
Typically they are html pages hosted within a Content Editor Web Part, or perhaps a Script Editor. This allows the ability to still use the "Add Web Part" function in SharePoint by a user, here's an example:

Configuring the Web Part

After you've added the Web Part to a page, in Edit Mode you will see a Gear Icon, click it and the Configuration Panel should be shown:

The only thing I've updated there is the Read More Link Url, and set it to which is source of the Feed.
Remember that the web part doesn't go direct to Twitter, it just fetches the feed data from the Twitter Cache list in SharePoint.

Setting up to run the Server Process - Get-Tweets

The Twitter API requires applications to be registered prior to accessing the API as the API does not allow anonymous access.
The process involves:

  • Sign up as a Twitter User
  • Register as a Twitter App Developer
  • Register an App
  • Configure App with Consumer Key and Consumer Secret (Keys and Access Tokens)
  • Get the Bearer Token value by a one-off execution of the get-tweets.ps1 (See: Determining Configuration)
  • Configure a scheduled task to repeatedly call get-tweets.ps1 (See: Creating a scheduled task)
    Note: The access level for the app should be Read-only.

The get-tweets.ps1 script allows for 2 modes of execution:

  • With a known Consumer Key and Secret, OR
  • An encoded bearer token

When using the known Consumer Key and Secret, 2 calls are made. Firstly to authenticate, then to request the twitter feed. However if the bearer/authentiation token method is used, only one call is ever made to Twitter. The ideal approach is to first run using the Consumer Key and Secret, copy the Bearer Token output, and then configure the scheduled task to use the Bearer/Authentication Token only.

The following example connects to Twitter, downloads the feed for TwitterScreenName then uploads it to SharePoint at https://mysharepointsite. The Username and Password are used to authenticate with SharePoint. The consumerKey and consumerSecret are used to authenticate with Twitter.

Note: The Get-Tweets.ps1 script is located in sp-clientapps\Client Apps\Twitter\Scripts

.\Get-Tweets.ps1 -siteUrl "https://mysharepointsite" -sponline:$true -username "" -password "password" -screenName "TwitterScreenName" -consumerKey "consumer key" -consumerSecret "secret"

Get-Tweets PowerShell Script Parameter Details

The following list indicates all the parameters and their meaning.

  • Site URL This is the URL to the root site collection in SharePoint
  • SPOnline The script is compatible with SharePoint online. Set to $true for Online, $false of on premise.
  • Username This is the user account that has write access to the SharePoint Twitter Cache list. (SharePoint access)
  • Password Password associated with the Username. (SharePoint access). In interactive mode you can leave this blank and you will be prompted. However in a scheduled task this value must be provided.
  • ScreenName This is the screen name for the Twitter account.
  • ConsumerKey This is provided in the Twitter App Developer area. It is an identify for an App. The get-tweets.ps1 script, will be the App in this case. (Twitter access)
  • ConsumerSecret The associated secret to the ConsumerKey. (Twitter access)
  • AuthToken This is an encoded token that is provided once authenticated. This will allow the app to communicate directly with the feed and avoid future authentication. To obtain the AuthToken you should first use the ConsumerKey and ConsumerSecret.

Note: You can specify AuthToken OR Consumer Key and Secret but not both. First run the script with the ConsumerKey and Secret, then copy the Bearer/Auth Token that will be output from the Script. If you configure a Scheduled Task to update the script, use the Bearer/Auth Token from then on.

Creating the Scheduled Task

The scheduled task should use the AuthToken method. To do this you specify the AuthToken parameter and omit the ConsumerKey and ConsumerSecret parameters.
For example:

.\Get-Tweets.ps1 -siteUrl "https://mysharepointsite" -sponline:$true -username "" -password "password" -screenName "TwitterScreenName" –AuthToken "AAAAAAAAAABBAAAAAAAAAPO70gAAAAAAwLAJsaJlYZ2C9gepscI9H7lv91s%3DLdEyfgspIBCxfl8IiMTwM44psFF6QxiX2trvUzL3tRKASdlYTb"

This command accesses the feed and uses the AuthToken to implement the OAuth 2.0 authentication. The above token is fake and been added for demonstration purposes. You will need to execute the script with the Consumer Key and Secret to obtain your own bearer token.
Scheduled Task settings:

  • Run in PowerShell 3 or higher
  • Recommend that this script runs every minute between 7am and 12 pm. (Although you can change it to any value you like and make it run continually).
  • It does NOT need to run elevated
  • It does need internet access
  • It does need access to SharePoint

Note: The script currently does not support specifying a proxy and will use the user account settings it is running under to access the internet. (You may need to login with the service account and configure the system proxy on the server you intend to run the script on)

How Secure is using Assemblies downloaded from GitHub?

Generally not secure at all and even though I've not messed with them, you can't be sure. I've left the assemblies in for convenience but if you are worried you can delete the assemblies and download the directly from:

Extract the Zip and put them in the corresponding folders /15 and /16.

One last thing

If you are installing this for your organisation and its larger than 5 people, you probably have a process to go through to validate solutions for Security, Robustness, Scalability etc. These are all good things and definitely worth some due diligence. You will find an additional document at sp-clientapps/Client Apps/Twitter/Scripts/Twitter Web Part - Configuration Guide.docx. I've placed similar details as this post that you can use in order for validating the solution within your company. The good thing is, none of the source is obscured, you can read the web parts source and the PowerShell script. The Microsoft Assemblies should be signed, but even still you can just download them from NuGet. The design that allows users to get the data from the list will help to show that the solution scales.

It's been a fun web part to build, and I hope its helpful to others out there in SharePoint land.