5 votes

uTweets

The uTweets package uses the new Twitter API (v1.1) to easily embed Twitter information on your umbraco site. The package contains some Razor macro’s which are ready to use.

The uTweets package is built upon the TweetSharp library and allows for a simplified interface. The TweetSharp library is really extensive, we tried to make our library easier to use by only exposing the most used Twitter functions.

Be aware that Twitter limits the requests made to the api. Therefore it is recommended that you cache your macro's.

Installation

Install the package.

The package will create some uTweets dictionary items where you must enter your Twitter consumerkey/secret and accessToken/secret. You can find or create these keys in your Twitter dev account (http://dev.twitter.com). All texts are also created as dictionary items, so that you can translate them to the appropriate language.

The package installs some default razor scripting files and macros. You can modify the installed scripting files to your needs. Or you can use the functions and classes described below to create your own scripts.

Public functions:

 

  • TwitterStatus GetTweet(long TweetId): Return the tweet specified by TweetId
  • IEnumerable GetTweets() : Returns a list of your tweets
  • IEnumerable GetUserTweets(string screenName): Returns a list of tweets of the specified user 
  • IEnumerable GetTweetsAboutMe(): Returns a list of tweets where you are mentioned. 
  • IEnumerable GetTweetsAbout(string hashtag): Returns a list of tweets with the specified hashtag. (Include # in the string) 
  • TwitterUser GetUser(): Returns information about the current user 
  • TwitterUser GetUser(string screenName): Returns information about the specified user 
  • TwitterUser GetUser(int userId): Returns information about the specified userId.

 

Public properties:

 

  • String ErrorDescription: Contains the error description if an error has occurred, empty otherwise. 
  • Int ListCount: Set the default number of tweets that is being returned in the list (default:200).

 

Public class TwitterStatus

 

  • Long Id: contains the Id of the tweet 
  • String Text: contains the tweet status 
  • String TextAsHtml: contains the tweet status as html text 
  • String Author: contains the screenname of the author 
  • String AuthorImage: contains profile image of the author 
  • DateTime CreatedDate: contains the date and time of creation of the tweet 
  • String RelativeTime: contains text when the tweet was created (x days ago, x minutes ago,…) You can change the text in the dictionary. 
  • Int RetweetCount: number of times that the tweet has been retweeted 
  • Long RetweetId: Id of the original tweet (0 if not retweeted)

 

Public class TwitterUser

 

  • String ScreenName: screenname of the user
  • DateTime CreatedDate: date and time of creation of the user
  • String Description: description entered by the user 
  • Int FavouritesCount: number of favourites 
  • Int FollowersCount: number of followers 
  • Int FriendsCount: number of friends 
  • Long Id: Id of the user 
  • String Language: language of the user 
  • Int ListedCount: number of public lists the user is member of 
  • String Location: location as entered by the user 
  • String Name: Name of the user 
  • String ProfileImageUrl: url of the profile image of the user 
  • Int StatusesCount: nr of tweets 
  • String Url: url to the user’s twitter account

 

Umbraco scripting files and macro’s:

 

  • uTweets.LatestTweet: returns the latest tweet 
  • uTweets.ListOfTweets: returns a html list with {nrOfTweets} tweets. The author, date and text is shown. 
  • uTweets.TweetsWithHashTag: returns a html list with {nrOfTweets} tweets with the hashtag {hashtag}. The author, date and text is shown. 
  • uTweets.UserInformation: returns information about the current Twitter user. You can even get the profile picture.

 

Example

var t = new uTweets.Tweets();
var user = t.GetUser();
@user.Name

Screenshots

Package owner

Nick Garrard & Davy Belmans

Nick Garrard & Davy Belmans

Nick has 142 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
8.5.x (untested)
8.4.x (untested)
8.3.x (untested)
8.2.x (untested)
8.1.x (untested)
8.0.x (untested)
7.15.x (untested)
7.14.x (untested)
7.13.x (untested)
7.12.x (100%)
7.11.x (untested)
7.10.x (untested)
7.9.x (untested)
7.8.x (untested)
7.7.x (untested)
7.6.x (untested)
7.5.x (untested)
7.4.x (untested)
7.3.x (untested)
7.2.x (33%)
7.1.x (100%)
7.0.x (100%)
6.1.x (untested)
6.0.x (100%)

You must login before you can report on package compatibility.

Package Information

  • Package owner: Nick Garrard & Davy Belmans
  • Created: 17/06/2013
  • Current version 1.1
  • License MIT
  • Downloads on Our: 2340

External resources