Wednesday, January 11, 2012

How Third-Party Apps Should Use Siri

Apple’s Siri is a “digital assistant” for iPhone 4S and, presumably, various other products to be released in the future. I expect it will come to the Mac at some point too.

I haven’t used Siri, but I have been following the developments because I think she (in the UK, apparently a he) will become a very big deal once there is an easy way for third-party applications (App Store apps) to take advantage of the voice recognition and natural-language processing Apple runs on its servers.

There has been a lot of discussion online about how this could be done without various apps stepping on each other’s toes. If I say “Siri, remind me at six about Tarkan’s birthday party,” which calendar program will it use for the reminder?

In this case, it will obviously use Apple’s. You could make that configurable but I really doubt Apple would.

I think the answer is as easy as it is obvious, and easier than it is awkward. Apple controls (approves) the name of every app in the App Store. It can easily allow developers to choose a “Siri Name” for an app, also subject to central approval. Keeping these unique should not be hard.

Then you simply tell Siri whom to tell (or ask) what. Much like you did in Applescript, if you had a Mac in the 90’s (or are a total masochist today).

For an app named “Candy Store,” it might go like this:

HUMAN TO SIRI: Siri, ask Candy Store if they have blue gumdrops.
SIRI TO CLOUD: <...sends audio...>
CLOUD TO SIRI: Parsed OK for "Candy Store" : "find 'blue gumdrops'"
SIRI TO APP:   find 'blue gumdrops'
APP TO SIRI:   OK, in stock, $6/dozen.  Options: order, view.
SIRI TO HUMAN: Candy Store has blue gumdrops for six dollars per dozen.
               You can view them or order them if you like.
HUMAN TO SIRI: Order six dozen please.

Siri would of course know the context of that last command, because Siri is tracking a conversation and not just individual commands. You could also be very direct:

HUMAN TO SIRI: Siri, tell Candy Store to cancel next week's shipment.
...
SIRI TO HUMAN: Your Candy Store shipment of four hundred mixed jellybeans
               for Monday, January 16 has been canceled.

If I were Apple I would start this with a very, very simple API, supporting only the simplest directives like “find” and “order” and “do,” but also sending the original text to the app in case the app wants to do its own parsing.

But that’s probably way too utopian of me. Apple will no doubt wait until there is a huge NSDigitalAssistantRequest API and statically-typed conversations and 30% of any digitally-assisted sale going to Cupertino, and start with three hand-picked third-party apps for a year-long trial run before mere mortals are allowed in.

Even then, it could of course be huge.