Tag Archives: Twitter

Twitter and their “shortener”

tl;dr Composer just got better at posting tweets, so post full urls instead of shortening.

Twitter automatically parse out any domain name or url in a tweet and replaces it with a t.co link. If you type something like twitter.com your 11 character domain gets converted into (currently) a 22 character t.co link.

Until today, Composer wasn’t very good at understanding this. Sometimes, it would shorten your post before sending it to twitter when it wasn’t necessary. And worse, with the introduction of images, sometimes posts to twitter would fail. If you add an image, you lose (currently) 23 characters from your tweet because twitter posts a link to the image (22) plus a space (1).

So, from today, we’ve built custom handlers just for twitter. We parse out any domain or url, replace it with (currently) 23 characters, and then check if your tweet is <140.

Shortlinking

This means, if you post a massive url to twitter, it gets auto shortened on twitter’s side, and now Composer is smart enough to figure that out. So if you’re posting links to Facebook, Twitter and WordPress, post the full url, no need to use a shortener.

Two caveats, we’re a little conservative because twitter’s t.co links are 22 characters for http links and 23 for https links. So we assume all links are 23 just to be on the safe side. Also, we parse out all domains (like composer.io or github.io) which Twitter doesn’t. I filed a bug.

This was made substantially easier thanks to twitter-text-php, thanks to its authors.

Composer posts images

In our biggest release since launch, we’ve just deployed the ability to publish images.

Today, images are posted to Facebook, Twitter and WordPress. If you send an image post to other services, we’ll send just the text, without the image. We’re working on sending a link to the image to other services.

We send the image as a normal image post to both Facebook and Twitter. For WordPress, we get a bit creative. First, we upload the full original file to your WordPress site. Then, we get the image details back from WordPress, and insert the medium sized image into the post. This way, you can choose what size your Composer posted images appear in WordPress, by editing your “medium size” in your Media settings on your WordPress site.

To celebrate, I posted this picture of our office elephant to Facebook, Twitter and WordPress!

Office Elephant

Twitter outage

This morning we discovered a problem with our publishing to twitter. We were using the Twitter API version 1.0, which was shut down on Monday. We’ve updated to use the 1.1 API and publishing to twitter should now be back online. Apologies for any tweets that failed in the meantime.

To help with these errors, we’ve added deeper visibility into the status of posts on the history page. Under each post you’ll now see a row shows the status of that post against each service. The three statuses are pending, posted and failed. If you see pending, try refreshing after a few seconds. If you see consistent problems with one or more services, let us know.

Composer’s own link shortener

When you’re writing messages that are destined for Twitter, there’s often a need to shorten urls. Well, from today, Composer can do that for you. On the post screen you’ll notice a new input box in the top right hand corner. If you enter a URL into it and click “Shorten” the url will be shortened and added to your message.

The new short url will be added to the end of the current message (not where the cursor is in the text box, that will come later). Shortlinks will be on the domain go.cmp.sr and will be very short.

Also note that any urls posted in the message will not be shortened, only urls entered via the shortener, the rest are left as they are.

If you spot any issues with the layout, or have any other feedback, let us know in the comments.

The Composer bookmarklet

Update: Now there are multiple bookmarklets here.

By popular request, Composer has a bookmarklet. Heavily inspired by the WordPress “Press This” feature, it uses the same javascript. You’ll find it on the compose screen under the Submit button.

It works in the usual way. Add it to your bookmarks then click it on any page. If you select some text on the page before you click it, that text will also be copied into the compose screen for you.

Tech

With this change, the compose screen supports 4 new url arguments: body, s = text selection, t = page title, and u = page url, on the new target url http://composer.io/posts/add/b.

The bookmarklet runs its javascript magic and constructs a url that looks like this (all values are url encoded):
http://composer.io/posts/add/b?s=foo&t=bar&u=http://foo.bar/

The body argument was added so you can roll your own bookmarklet and combine whatever javascript variables you want in your own order. The body argument is used first, then the others are combined in the usual way and appended.

For example, this url will load a compose screen like:

I'm the awesome body
This is the text I selected
Title of Awesome http://awesome.tld/

If you do roll your own, please let us know in the comments below. 🙂

Auto shortening for twitter, etc

More goodness from the composer HQ today! If you type a message over 140 characters and send it to Twitter, Plurk or Identica, we’ll automatically shorten it, post it on a URL, generate a short link, and then post the beginning of your message along with a short link to the full message. It’s live now, no configuration necessary.

Shoot over any feedback in a comment… 🙂

New Bootstrap theme

Composer has been given a bit of a facelift. The stock CakePHP design has been augmented (it’s not fair to say replace, much of it remain) with Twitter’s Bootstrap.

In theory, this makes the whole design far more responsive. That’s true for the menu, but not so much for the other parts, yet. The pieces are now in place, so we’re a step forward.

Also, a big boon for me personally when posting on my phone, I’ve changed the flash messages to be colour coded, so now green box means succeeded, red box means failed. Yay for colour coding!

Also, the new responsive theme makes text much bigger on my phone, puts the menu behind a button, and so on. If you haven’t already, head over to Composer and check out the new design. As always, thoughts on a postcard (or comment)… 🙂

Remember me and other tweaks

The remember me function now works. If you’re having issues, I recommend clearing cookies for this domain. The “remember me” text on the login page is also now a label, so clicking it will tick the checkbox. The devil’s in the details.

I’ve also deployed some behind the scenes changes that bring encryption to the application. If you created a link to WordPress before today, then the data you submitted was stored in plain text in the database. From today forward, this data is encrypted.

There was some discussion about whether or not this feature is important. Most people felt it was overkill to focus on security so early. I’m a big fan of the “better safe than sorry” philosophy when it comes to security, so I’m pleased that this code is live.

I also found a new deployment process, so bzr-upload replaces good old rsync! Deployments are now as simple as `bzr upload`.

Composer speaks SMS

Today I built an SMS API for Composer. It’s very basic, but it works. I just sent a text, had the message published, and got an SMS reply telling me which services succeeded (and sadly, failed).

Twitter failed because it wants to make every domain a link, and then wants to “shorten” that link to a 20 or 21 character t.co link. Very stupid. So twilio.com (10 characters) became http://t.co/Mnj6d4ZX (20 characters). With 3 domains (not urls) in my message, I gained at least 20 characters, and went over the 140 limit. But that’s another story!

I started out this morning (technically afternoon, but my morning 😉 ) building an SMS API for Composer. I wanted to be able to post from my mobile, without internet, and update my statuses. I chose Tropo because they’re free while in development. I figured it would be a while before I’d have the whole thing production ready, so a few months of free SMS gateway seemed appealing.

Alas, too many hours later, none of my texts reached Tropo, I couldn’t get a reply to work by IM or SMS, and so finally I decided to get agile and instead try Twilio. Bingo. It just worked. No issues, no bother. There are a couple of downsides. First, I got $30 bonus when signing up, but to “activate” my account I need to add a credit card. Second, it’s not free, it’s $1 a month per number plus 1c per text received and 1c to 7c or more per SMS sent, depending on the destination. But it works, and it worked in less than an hour.

I hard coded the mobile number to account id link, so if you want to use the SMS API, just let me know, tell me your mobile number, and I’ll add you to it! I’ll work on a better system where folks can register in time, but for now, it works. This is an MVP after all! 🙂

Now I can send one text message to Composer and update Facebook, Twitter, Identica and WordPress all at once. Happy days.