David Ferguson

RSS

Quick start a new iMessage from Alfred using the new Messages app

I was looking around at the new Messages (beta) this morning and just because I’m curious, got to looking through the Info.plist. Yes, I’m that kind of nerd. :) Guess what I found… an iMessage URL scheme. I don’t know if this has been mentioned elsewhere yet..

So what does that mean? As of Alfred 1.1 you can set specific actions when selecting data in the Alfred contact viewer. So, if you want to quickly create an iMessage to a contact from Alfred, go to Preferences->Features->Address Book and on the Phone option, select Pass to URL Scheme, then set the scheme to “imessage:{query}”

Once you have that set, press your hotkey to bring up Alfred (mine is Cmd+Space), search for a contact, select one, press Enter, select the phone number that they can receive iMessages on, and press Enter.

If you use things like Google Talk, you can do the same thing with Google contacts. Go to Preferences->Features->Address Book and go to the Messaging tab. Find the Google Talk option, set the action to Pass to URL Scheme and set the URL to im:{query}.

There are also URLs for aim:, ichat:, and xmpp:.

EDIT:

This post is still valid for information purposes but it has come to my attention and been brought up by other users that the setup mentioned above doesn’t work for all phone numbers. I believe its numbers that have been added since the introduction of iCloud are formatted differently where the area code is in ()’s and there is a space between the area code and the prefix. When using the method described above on a phone number formatted that way, it doesn’t work because iMessage doesn’t remove all the escape characters. The easiest way to get around this was to simply make an extension that strips out the slashes used for escaping and to remove the space in the number.

The extension is available here. So, instead of setting the Address Book area to ‘Pass to URL Scheme’, import this extension and tell it to run this extension instead. The extension could also be used to allow you to quick enter a number if you chose. It currently doesn’t have a keyword set to it, but i believe if you just add a keyword (‘im’ for example) then you could enter into Alfred: ‘im 555-555-0123’ and it should create a new iMessage to that number. You don’t have to include the hyphens, I just added those to make it easier to read.