You are here:

ActiveXperts.com > Twitter Toolkit

ActiveXperts Twitter Toolkit Add Twitter capabilities to any Windows or .NET application

Quicklinks


Add Twitter capabilities to your Windows or web applications

The ActiveXperts Twitter Toolkit enables any Windows or web application to integrate Twitter functionality.

  • Easy to use API
  • Send Tweets
  • View different time lines
  • Find users and follow
  • 32-bit ActiveX and 64-bit ActiveX included
  • Samples available in C#, VB, ASP.NET, HTML, PHP, Javascript, Delphi and more
How to use Twitter toolkit Visual Studio.NET Web Application GUI Application Console Application
Startup screen MS Visual Studio .NET web application .NET GUI application Console application

The ActiveXperts Twitter Toolkit supports the following:

  • Post your Tweets on Twitter using your own software
  • Easy browsing through your own Tweets or the Tweets on any other time line
  • Easy browsing through friends and followers
  • Integrated OAuth (Open Authorization) supports both Client and Web use cases
  • Authenticate users in only two API calls
  • Access all of the functions that are publicly available on Twitters REST interface
  • Proved an interface to send custom, OAuth signed, requests to the Twitter REST interface
  • ActiveXperts Twitter Toolkit is an ActiveX/COM component that can be integrated in virtually any Windows development environment

System Requirements

ActiveXperts Twitter Toolkit is available as a 32-bit component and as a 64-bit component (both part of the product):

  • twittertk.dll - 32-bit component;
  • twittertkx64.dll - 64-bit component.

ActiveXperts Twitter Toolkit runs on the following Operating Systems:

  • Windows 2008 (32 and 64 bit);
  • Windows 2003 (32 and 64 bit);
  • Windows 2000 Server and Professional (32 bit only);
  • Windows 7 (32 and 64 bit);
  • Windows Vista (32 and 64 bit);
  • Windows XP (32 and 64 bit).

Code Snippets and Sample Applications (VBScript)

For most of these samples you will need to have a consumer key and an access key. Use this wizard to get both a consumer key and an access key.

The following code sample illustrate OAuth authorization for a client application using the Twitter Toolkit.

  Option Explicit

  Dim objTwitter, objIE
  Dim strUrl, strVerify

  ' Create the twitter object
  Set objTwitter = CreateObject( "ActiveXperts.Twitter" )

  ' Set the consumer key
  objTwitter.ConsumerKey = "..................."
  objTwitter.ConsumerSecret = ".........................................."

  ' Request an authorization URL
  strUrl = objTwitter.RequestAuthorization 
  TestSuccess

  ' Navigate to the Authorization URL
  Navigate strUrl

  ' While on the Authorization URL, ask the user to input the verification code
  strVerify = inputbox( "Enter verification code", "Enter value", "" )

  ' Trade the verify token with an access token
  objTwitter.RequestAccessToken strVerify
  TestSuccess

  ' Tweet about our success !
  objTwitter.Tweet "I'm Tweeting with ActiveXperts Twitter Toolkit !"
  TestSuccess

  ' Print the access token so it can be used again.
  WScript.Echo "Access token: " & objTwitter.AccessToken
  WScript.Echo "Access token secret: " & objTwitter.AccessTokenSecret

  ' *************************************************************************************

  ' Navigate to a specific URL
  Function Navigate( strUrl )
    Set objIE = CreateObject("InternetExplorer.Application")
    
    objIE.Navigate strUrl 
    objIE.Visible = 1

    Do While objIE.Busy
    Loop
  End Function

  ' Test if a function call on the Twitter Toolkit object succeeded
  Function TestSuccess()
    Dim strDescription
    
    If objTwitter.LastError <> 0 Then
      strDescription = objTwitter.GetErrorDescription(objTwitter.LastError)
      WScript.Echo "Failed, error: " & objTwitter.LastError & "; " & strDescription
      WScript.Quit 1
    End If
  End Function

List your home time-line

  Option Explicit    
    
  Dim objTwitter, objTweet, objUser

  ' Create the twitter object
  Set objTwitter = CreateObject( "ActiveXperts.Twitter" )

  ' Set the consumer key
  objTwitter.ConsumerKey = "..................."
  objTwitter.ConsumerSecret = ".........................................."

  ' Set the user key
  objTwitter.AccessToken = ".................................................."
  objTwitter.AccessTokenSecret = ".........................................."

  ' List tweets and the users who posted them
  ' The tweets are from a specific time-line. The following time-lines are possible:
  ' "public", "home", "friends", "mentions", "retweeted_by_me", "retweeted_to_me", 
  ' "retweeted_of_me" or either a user id or screen name
  Set objTweet = objTwitter.FindFirstTweet("home")
  While objTwitter.LastError = 0
    WScript.Echo "Id: " & objTweet.Id
    WScript.Echo "Created at: " & objTweet.CreatedAt
    WScript.Echo "Text: " & objTweet.Text
    WScript.Echo "Source: " & objTweet.Source
    Set objUser = objTweet.User
    WScript.Echo "By:"
    WScript.Echo vbTab & "Id: " & objUser.Id
    WScript.Echo vbTab & "Created at: " & objUser.CreatedAt
    WScript.Echo vbTab & "Name: " & objUser.Name
    WScript.Echo vbTab & "Screen name: " & objUser.ScreenName
    WScript.Echo vbTab & "Location: " & objUser.Location
    WScript.Echo vbTab & "Description: " & objUser.Description
    WScript.Echo vbTab & "Profile image: " & objUser.ProfileImage
    WScript.Echo vbTab & "URL: " & objUser.URL
    WScript.Echo vbTab & "Protected: " & objUser.Protected
    WScript.Echo vbTab & "Followers: " & objUser.NumFollowers
    WScript.Echo vbTab & "Friends: " & objUser.NumFriends
    WScript.Echo vbTab & "Tweets: " & objUser.NumTweets  
    Set objTweet = objTwitter.FindNextTweet
  WEnd

List your followers

  Option Explicit

  Dim objTwitter, objStatus, objUser

  ' Create the twitter object
  Set objTwitter = CreateObject( "ActiveXperts.Twitter" )

  ' Set the consumer key
  objTwitter.ConsumerKey = "..................."
  objTwitter.ConsumerSecret = ".........................................."

  ' Set the user key
  objTwitter.AccessToken = ".................................................."
  objTwitter.AccessTokenSecret = ".........................................."

  ' Get all of your followers
  Set objUser = objTwitter.FindFirstFollower
  While objTwitter.LastError = 0
    WScript.Echo "--"
    WScript.Echo "Id: " & objUser.Id
    WScript.Echo "Created at: " & objUser.CreatedAt
    WScript.Echo "Name: " & objUser.Name
    WScript.Echo "Screen name: " & objUser.ScreenName
    WScript.Echo "Location: " & objUser.Location
    WScript.Echo "Description: " & objUser.Description
    WScript.Echo "Profile image: " & objUser.ProfileImage
    WScript.Echo "URL: " & objUser.URL
    WScript.Echo "Protected: " & objUser.Protected
    WScript.Echo "Followers: " & objUser.NumFollowers
    WScript.Echo "Friends: " & objUser.NumFriends
    WScript.Echo "Tweets: " & objUser.NumTweets
    Set objUser = objTwitter.FindNextUser
  Wend

Make a custom API call

  Option Explicit

  Dim objTwitter, objXML, objNodeList, strResult, i

  ' Create the twitter object and an XMLDOM object
  Set objTwitter = CreateObject( "ActiveXperts.Twitter" )
  Set objXML = CreateObject( "Microsoft.XMLDOM" )

  ' Set the consumer key
  objTwitter.ConsumerKey = "..................."
  objTwitter.ConsumerSecret = ".........................................."

  ' Set the user key
  objTwitter.AccessToken = ".................................................."
  objTwitter.AccessTokenSecret = ".........................................."

  ' Make a custom API call
  strResult = objTwitter.APICall("statuses/home_timeline", "xml")

  ' Display the results
  objXML.LoadXML(strResult)
  Set objNodeList = objXML.selectNodes("//statuses/status/text")
  For i = 0 To objNodeList.length
    WScript.Echo objNodeList(i).text
  Next

More information

To read more about ActiveXperts Twitter Toolkit, use one of the following links: