Start an iMessage Conversation From the Web with Custom Links

May 15, 2012 - 3 Comments

Start an iMessage conversation from the web

By using a custom URL inside of an anchor tag, you can place a link on any website that will initiate a new iMessage conversation. Anyone clicking the link will then launch the Messages app in iOS or iMessages in Mac OS X to begin a new conversation with the specified Apple ID. Even if you have limited knowledge of HTML the link structure is easy to use:

Mac OS X: imessage://your@appleid.com

<a href="imessage://your@appleid.com">Send iMessage to a Mac</a>

iOS: sms://your@appleid.com

<a href="sms://your@appleid.com">Send iMessage to iOS</a>

Replace “your@appleid.com” with your own Apple ID that is configured to use with iMessage. Note that the iOS link uses “sms” as the identifier, meaning some users may send you an actual text message rather than iMessage if they are not set up to use Apple’s messaging protocol.

Because iOS and OS X use different URL schemes, you’ll need to use two different links by default. This could have advantages, if you only wanted people from iOS to reach you for example, but if you don’t like that idea there’s a nice workaround to the dual links by using the short PHP script offered by Beuagil.es. This script will detect the user agent and determine which link to use based on that, effectively combining the two iMessage links into one intelligent link:

<a href="<?php
$useragent = $_SERVER['HTTP_USER_AGENT'];
if(preg_match('/Macintosh/',$useragent)) $os = 'imessage';
elseif(preg_match('/iPhone/',$useragent)) $os = 'sms';
else $os = 'sms';
echo $os;
?>:your@appleid.com">Send an iMessage</a>

Obviously you’ll need a PHP capable website for the above script to work, otherwise you’ll have to use the HTML snippets offered at the top of the post.

You can also use similar URLs to initiate FaceTime calls from the web.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in iPad, iPhone, Mac OS X, Tips & Tricks

3 Comments

» Comments RSS Feed

  1. Ron says:

    Because of the SMS connection I would be cautious of this unless you have an unlimited texting plan

  2. G3P0 says:

    I would also be cautious of making your link public unless you like spam.

  3. Nic says:

    Hi,

    How if we want to auto send enquiry with the link?

    E.g. When a user directly click on the link, will fill up enquiry and auto send enquiry to us. Possible?

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates