Using alternative URL shorteners with Twitter Notify plugin

14Jan09

Hopefully, folks who use both Windows Live Writer and Twitter know about the Twitter Notify plugin we released in December. Out of the box, it uses the venerable (but still awesome) TinyURL service to shorten the URL to your blog post.

However, if you prefer a different URL shortening service, like is.gd or snipr, you might be able to get the plugin to use that instead, with a simple registry tweak.

Under the following key:

HKEY_CURRENT_USER\Software\Microsoft
\Windows Live\Writer\Preferences\PostEditor\ContentSources
\CECF2903-51B3-4173-A932-76E4EE4C01CF

Add a String Value called UrlShortener. Here are some examples of known good values:

http://tinyurl.com/api-create.php?url={0}

http://is.gd/api.php?longurl={0}

http://snipr.com/site/snip?r=simple&link={1}

http://snurl.com/site/snip?r=simple&link={1}

http://cli.gs/api/v1/cligs/create?url={1}

The plugin will replace {0} or {1} with the URL of your post. ({0} will just drop the URL in, while {1} will URL-encode the URL first. The latter seems more correct, but TinyURL and is.gd both expect the former.) Then it will make a web request to the resulting URL, and assume that the entire response is the shortened URL.

Not all URL shortening services will work. For example, bit.ly has an API but it returns JSON or XML, not just the bare URL, so at best you’ll get a bunch of garbage in the post. Update April 1, 2010: See comment below by Max for bit.ly instructions.

You can also choose to skip the shortening step and just put the whole URL in there; just create the UrlShortener string value but leave it empty.

About these ads


18 Responses to “Using alternative URL shorteners with Twitter Notify plugin”

  1. 1 Roland Knight

    Great plugin. Are there any future plans to provide support for changing the Twitter account entered during setup?

  2. Roland, it sounds like you’re using the older version of the plugin. You can change the account by going to Tools | Options | Plugins | Twitter Notify | Options.

    With the new version of the plugin, you have the opportunity to change the account whenever you post. You can download it here:
    http://gallery.live.com/liveItemDetail.aspx?li=6b2b5ffe-936a-4cb3-869c-c01de29de176&pl=8&bt=9

    HTH!

  3. 3 Roland Knight

    Hm. The version I had was from Live Gallery, but I uninstalled it and installed the one above just in case. It’s still not quite behaving as you describe it should; I have to actually deselect the plugin from the last blog I used it with (I have four), close Live Writer, reopen it and reselect the plugin before publishing the next post in order to get Writer to execute the plugin and give me the signin popup. If I don’t do all that it says it’s executing the plugin, but it doesn’t give me the popup and Twitter doesn’t get updated. I’m using Vista Ultimate 64bit, fwiw. Thanks for the help, though.

  4. Hmmm. Well, here is the exhaustive list of things that can affect whether the Twitter plugin pops up.

    1) Is the plugin enabled? (Tools | Options | Plugins)

    2) Is the plugin enabled for this particular blog? (Blog | Edit blog settings | Plugins)

    3) If this post has already been published, have we already successfully tweeted? If so, don’t show.

    4) If this post has already been published, have we already shown the user the plugin UI and they hit Cancel? If so, don’t show, because I guess they don’t want to tweet about this post.

    5) Is this post currently being published as a draft? If so, don’t show.

    (It may seem that #3 and #4 just mean “if we’ve shown the Twitter plugin UI before, don’t show” but actually, if the user tried to submit a tweet but it failed due to e.g. Twitter being down, then that doesn’t count.)

    If you make sure #1 and #2 are enabled, then publish a new post, and it still doesn’t show the UI, then it sounds like a bug–let me know.

  5. 5 Roland Knight

    4) If this post has already been published, have we already shown the user the plugin UI and they hit Cancel? If so, don’t show, because I guess they don’t want to tweet about this post.

    Ah, I think this might be what’s throwing it. I do hit cancel if I want to tweet about a different blog, and that’s usually when the trouble starts. Notify then seems to get the idea that I don’t want to tweet about anything in that same session, new posts included, ending with me having to close and reopen writer. Thanks.

  6. 6 Jose

    Hi there, can you please email me back and tell me if its possible for me to write a plug in that will get activated when the user selected an inserted picture within the post so that my plunging can modify it?

  7. 7 Harry

    Hi,

    Sorry about the off-topic question. I’m actually looking for the Insert Horizontal Rule plugin. I see some reference on Google which points to something you posted to a MSN Group which doesn’t exist any more. Is it possible to add that plugin to the Writer Plugin Gallery?

  8. Would you happen to know the string format for the bit.ly url shortening service?

  9. Sorry Corvida, bit.ly’s API won’t work with this mechanism–the value returned by their API is a little too complicated.

  10. Standard URL shorterners are okay but you can get better results by cloaking with keyword subdomains like you.com-vip.info or other free domains at BrainyURL.

  11. Leaving the UrlShortener string blank does not return the original URL as suggested in your post under Windows 7 RC1. The other values (is.gd, etc.) work as expected. Any thoughts?

    Also, any plans to support bit.ly with API key in the near future?

  12. Nowadays, the bit.ly service can be used in the twitter plugin.
    For example,
    http://api.bit.ly/v3/shorten?%5Blogin=login%5D&%5BapiKey=key%5D&uri=http://example.com&format=txt
    where
    [login=login] – optional parameter. If you don’t have an account in http://bit.ly/, omit it
    [apiKey=key] – optional parameter. If you don’t have an account in http://bit.ly/, omit it. Two these parameters should (not) be used together.
    uri=http://example.com – url to shorten

    So, to use bit.ly, next statement should be added to the registry:
    http://api.bit.ly/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&uri={1}&format=txt
    or
    http://api.bit.ly/v3/shorten?uri={1}&format=txt
    Hope, this helps

  13. Thanks Max–great info!


  1. 1 Usando encurtadores de endereço diferentes no Twitter Notify » Winnext
  2. 2 Using bit.ly with The Twitter Notify plug-in for Live Writer « Aaron's Live Writer Blog
  3. 3 InsertableContentSource » Blog Archive » Twitter Notify, Because No-one Should Be Hacking The Registry
  4. 4 Microsoft’s Free Windows Live Software & Resources | The Road to Know Where

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: