Twitterize your web app

I love this binary that makes it easy to do Twitter integration. http://www.twitterizer.net/

I’ll give a VB example here of how you might be able to use it.

1. Down the DLL or files or whatever works best for you and add a reference to in your project

2. Add the import

Imports Twitterizer

3. Go to Twitter developer and get your OAuth credentials. If you don’t know how to do that, it’s easy, it’ll walk you through setting up a new App. Just a couple of points here.

  • On the Application Type, make sure you select at least Read and Write if you want this example to work. If you select only Read and later want to change it, that’s fine, but you’ll probably need to regenerate new OAuth keys as the old ones probably won’t let you Write. I think I learned this the frustratingly hard way.
  • Now, the OAuth tool with the various access token consumer and secret keys are really what you’re after. I can’t recall if you need to setup an @Anywhere domain or not, but read up on that to be sure.

4. Once you’ve got your OAuth credentials, you’ll want to keep them secret to yourself, but you can use them in your code now

        Dim tokens As New OAuthTokens()
        tokens.AccessToken = "xxxx"
        tokens.AccessTokenSecret = "xxxx"
        tokens.ConsumerKey = "xxxx"
        tokens.ConsumerSecret = "xxxx"

5. Now, post an alert to Twitter! That’s it. You’ll notice the Twitterizer API also has a synchronous post if I recall, but not real sure what application would desire that blocking behavior.

                Dim asyncResult As IAsyncResult = TwitterStatusAsync.Update(
                    tokens,
                    "hello Twitter from App",
                    Nothing,
                    New TimeSpan(0, 1, 0),
                    AddressOf WhenUpdateIsCompleted)
Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: