Skip to the content.

Creating a link that posts a tweet | Cam

13th Sep, 2013 by Cam

If you have ever wanted people to help spread the word about something you were working on, then having visitors to your page post a link back to the page can be very useful. Especially with a custom message and some hashtags to help with visibility.

Creating a link that posts a tweet’ is really quite simple, but there are a few things that you need to be aware of.

Anyone who has done this before, using the old Twitter API (replaced mid 2013), may be familiar with the url ‘https://twitter.com/home/?status=’. This URL is no longer used. Now you need to use the new ‘intent’ method, which goes a little something like this:

https://twitter.com/intent/tweet?text=Your+text+here+http%3A%2F%2Fyoursite.com%2Fyour-page+%23yourhashtag&via=yourtwittername

When clicked on, that link would create a tweet with the following text: “Your text here https://yoursite.com/your-page #yourhashtag @yourtwittername

You could of course add this link to an image or a button:

tweet this

This example uses the text “How to create a link that posts a tweet”, “https://camgould.com/blog/creating-a-link-that-posts-a-tweet” as the link, “#intent #action #blog” as hashtags, and “@camgould”: TWEET THIS ARTICLE

Using this method can be a great way to help make it easy for people to post a tweet and link back to an article, competition, project or whatever you want. Making things easy is the key to encouraging actions.

If you want to make life a little easier, and and avoid manually writing the formatted html of the message, you can use the URL encoding tool from w3schools.com. Just write your message (including links and hashtags) in the ‘Try It Yourself’ field, and add ‘https://twitter.com/intent/tweet?’ before the text that is output by that tool.