The Twitter activity can be used to send a tweet from within a build workflow.  In this example we aim to show the the basic steps that are required to get the activity integrated into a build.

Before you can make use of any of the TFS community build activities you have to make sure they are available for the build system and on your development PC. Instructions for this process can be found in the ALM Rangers build guide or in the StyleCop page of this wiki. This page assumes the Twitter activity is available in the developers build process workflow toolbox.

Configuration of Twitter

To allow TFS build to be able to send a Tweet you need to register an application on your Twitter account.

  1. Go to http://dev.twitter.com and login with the Twitter account details you wish to be able to send Tweets from
  2. Select the My Application from drop down on the top right
    image
  3. Press the Create new application button
  4. On the resultant form enter the following information and press the create button
    • Name – the name of your application e.g. TFSBuild
    • Description – which has to be 10 characters or more
    • Website – this is the URL that will shows as link in a Twitter client as the sending application. If clicked the URL will be opened, this could be used as a link back to your build status reports. You have to enter a URL so if you are not going to use it, either enter a fake URL or just your default company site
    • image
    • CallBack URL – not needed for the this activity
  5. IMPORTANT before you generate the tokens you need, you must set the access level for your new application. If you generate the tokens before making this change you will not be able to send Tweets.
  6. On the new applications select the settings tab and select the Read, Write and Access direct messages access level and save the changes
  7. On the Details tab press the Create Access Keys, you should now have the four tokens you needs

image

Configuring the activity

Using the Twitter activity is very straight forward, once it is dropped onto the build process design surface only the message and token properties have to be set to send a Tweet.

The activity can be used at any point in the build process you wish to Tweet.

image

  • AccessToken – from your application on the Twitter
  • AccessTokenSecret – from your application on the Twitter
  • ConsumerKey – from your application on the Twitter
  • ConsumerSecret – from your application on the Twitter
  • Message – The message you wish to Tweet, this will usually be a built depending the success or failure of the build

Running the activity

When you run the build you should see the Tweet sent.

If you have the tokens wrong, or did not set the access level you will see a ‘System.Net.WebException: The remote server returned an error: (401) Unauthorized.’ error.

Last edited Mar 29, 2012 at 9:19 PM by rfennell, version 2

Comments

No comments yet.