How to Pre-Populate Twitter Status Updates Via Links

We all know that getting information out via Twitter is helpful to your brand or company, but what if you want to have your website or blog readers do it for you? Or perhaps you want to get a standard message out or include a keyword or two through the…

We all know that getting information out via Twitter is helpful to your brand or company, but what if you want to have your website or blog readers do it for you? Or perhaps you want to get a standard message out or include a keyword or two through the use of hashtags (#).

NOTE: As of May 2011, this method no longer works! Please read my NEW post on the new way here.

tweet_chat

The process for doing this is very easy, however I learned a little trick that you can use, especially if you want to use hashtags (which I solve at the end of this post).

- Advertisements -

Simple Link

The context is very simple. Let’s say the message you want to post is:

“I learned how to pre-populate Twitter statuses at: https://www.hightechdad.com Thanks @hightechdad!”

All that you need to put in for your link is:

http://twitter.com/home?status=I learned how to pre-populate Twitter statuses at: https://www.hightechdad.com Thanks @hightechdad!

Try it by clicking this link –> http://twitter.com/home?status=I learned how to pre-populate Twitter statuses at: https://www.hightechdad.com Thanks @hightechdad!

Linked Text

If you want to make it a bit more elegant, you can put it into link tag and simply link a word or set of words:

<a href="http://twitter.com/home?status=I learned how to pre-populate Twitter statuses at: https://www.hightechdad.com Thanks @hightechdad!">TWEET THIS</a>

Try it by clicking this link –> TWEET THIS

Issues with Hashtags

Hashtags are important in many Twitter messages because that give users the ability to group similar messages together. Let’s say that you are attending “XYZ Expo” and you heard something interesting that you wanted to share with your Twitter followers. By adding a hashing and a keyword like #xyzExpo, you can start “tagging your tweets.” That way, when people click on your hashtag, it will show all tweets that have the same hashtag. It’s a great way to consolidate like tweets and Twitterers.

Normally, in the tweet, you would simply put in the “#” (hashtag symbol). However, when you want to put it into a link like the one listed above, you run into issues. This is because the “#” is used within URLs as an anchor tag. For example, if you want to jump to a particular area within a page, you would add a “#” to the end of the page name as well as tag that section within the page for that anchor link. Say that you have a section called “Details” and you anchor your page there, the link would be “somepage.htm#details”. This is great for in-page navigation but poses problems with the Twitter status linking. If you only include the hashtag, the Twitter server will give you an error, thinking it is looking for a particular anchor on a page that doesn’t exist.

Unfortunately, you can’t use a special “&xxx;” type of code for the # symbol (the way you can with “&” which is “&amp;”) because the translation for the “#” actually CONTAINS the “#” symbol (the special HTML character for a hashtag is “&#35;”which contains a # so it won’t work).

Solution

So, how can you make hashtags work in a pre-populated Twitter status update? Easy, you use a different type of character. And actually, you should do the same for spaces.

The characters:

  • space = %20
  • hashtag = %23

Let’s say you want to pre-populate the message:

“I learned how to pre-populate Twitter statuses with hashtags at: https://www.hightechdad.com Thanks @hightechdad! #cool”

The html code would look like this:

<a href="http://twitter.com/home?status=I%20learned%20how%20to%20pre-populate%20Twitter%20statuses%20with%20hashtags%20at:%20https://www.hightechdad.com%20Thanks%20@hightechdad!%20%23cool">TWEET THIS</a>

Try it by clicking this link –> TWEET THIS

You can also, I believe, eliminate all of the %20’s from your message and simply use the %23 for the hashtag. So, your code would look like this:

<a href="http://twitter.com/home?status=I learned how to pre-populate Twitter statuses with hashtags at: https://www.hightechdad.com Thanks @hightechdad! %23cool">TWEET THIS</a>

Try it by clicking this link –> TWEET THIS

Do note that the user must be logged in or log in to make this work. Obviously they do need to have a Twitter account. They also do have the ability to change the context of the tweet as all that this does is pre-populate the status field on Twitter’s site. I hope you found this useful. It can help your audience to get out tweets easily directly from your site.

HTD says: Twitter is a very useful communication tool. Enabling your users to get your message out easily is critical.

- Advertisements -