Table of Contents
I asked: “Hey Siri, do you know Alexa?”
Siri replied: “I offer no resistance to helpful assistants!”
Reminiscing “Hierarchy of Anticipation” by Robert Stephens, one of the co-founders of Assist – The automated assistant platform for message and voice, Siri has been designed to recognize preferences driven by past behavior. This kind of pattern recognition offers opportunities for brands to be proactive with customer engagement. How will it work? In case I’m just ready to place my order, Siri recognizes that I make a particular order, from a specific restaurant, so if in case I have to order my usual, I’ll just wait at my seat and say, “Hey Siri, get me my usual”. Did you catch the simplicity and ease of this command? The beauty lies in the promptness of the digital assistant!
The most prevalent voice assistants for smartphones, available along with iOS and Android devices are Apple’s voice-controlled digital assistant for iOS, Amazon’s Echo (Alexa) and Google Voice assistant for both Android and iOS. Google is said to have taken on Alexa, Siri, and Cortona with its own voice assistant: Google Assistant. All these are quite distinctly different products that ultimately diverge in directionally distinct arcs in both use case and utility. But if you own any or all of these devices, it can be established that there is a great deal of uniqueness and utility with all these.
Nine years on from Siri, six years on from Alexa and four years on from Google Assistant; Apple, Amazon, and Google have spread their voice assistants far and wide respectively. Although Siri is dependent and specific on Apple devices (its own hardware) but Amazon’s Echo Dot (Alexa) and Google Assistant are not only on Google’s own hardware, but are on through partnerships with other companies that see such voice assistants in a wide range of devices, from fridges to headphones, speakers to cars.
Voice Assistants like Siri vs. Cortona vs. Alexa vs. Google Assistant are quite helpful while doing certain things like setting reminders, composing text messages, taking notes, creating events, setting alarms and making changes to system settings. As real knowledge is to know the extent to one’s ignorance, as soon as users get to know this digital voice or personal assistants more, they tailor their responses individually and that too in your personal/preferred language.
Siri can be incredibly useful for those who get used to it. Enabling users to do a wide array of tasks on their iOS devices like creating reminders. Just in case you wish Siri to be a little more useful, ask it to do anything from the list below like asking Siri to place a call, start a FaceTime chat, launch an app, send a message (“Hey Siri, send a Cliq message to Scott”) or (“Video call Scott using Cliq”) , set up a calendar event, find out whether your team won the game, pull up the photos you took the day before, get directions home, find a restaurant, play some music, set a reminder, etc.
The results might surprise you, but what can be even more surprising is the candidness of the assistant to answer, or at least attempt to answer “human-like” questions in a similar way.
Siri makers brag that it is capable of doing more than one can imagine, even before we ask it! It can help you stay connected without lifting a finger. From making calls to text messages on your behalf to offering proactive suggestions like texting someone that you’re running late for a meeting – allows you to stay updated and in touch effortlessly.
Right from reminding you to make calls that matter, Siri eases everyday tasks, is a faster, easier way to do all kinds of useful things. Setting alarms, reminders and previewing calendar is easy without the need to pick up a device. Although it cannot order on user’s behalf at the moment Siri can as well suggest shortcuts based on your routine. Siri can predict too. Based on your routine, it can come up with intelligent suggestions that can ease your routine tasks out.
It might be infuriating at times when the digital assistants fail to catch the user command and come out with vague replies. But a user shouldn’t be too quick to dismiss it. These voice assistants like Google Now, Siri and Microsoft’s Cortona can be really useful and time-saving tools for getting things done and finding information. There is a need to invest some time and effort to better understand how smarter these assistants are.
Siri in iOS now supports third-party apps which implies that it can now interact with apps like Skype, PayPal, Uber, and some others Siri compatible apps that have chosen to include support for Siri virtual assistant. In actual practice this allows users to give certain commands to Siri like “send $10 to Mark using PayPal” or “Get me an Uber to airport”. Enabling Siri in third-party apps for iPhone and iPads is easy.
Siri integration requires iOS 10 or later versions along with installing third-party apps to be used. Some manual integration is also required for third-party apps.
As an example of how Siri functions in a normal consulting company app with their managers through a voice messaging system: A user opens Siri and calls out: “Hey Siri, send a Facetime message telling my managers that I need help.” Then the request is sent to the managers.
A domain is to be selected based on app tasks. Sirikit programming guide suggests names of few domains like VoIP calling, messaging, Payments, photos, workouts, ride booking, CarPlay and restaurant reservations, etc. As an example, here messaging domain (a type of Apple Siri domain) is being used for Siri app integration. As Siri propagates the user’s actions, when a user requests an action from Siri, it sends the user’s intent along with certain necessary details and additional information to the handler for that intent.
If your iOS application offers “domain service”, like ride-booking (e.g.: Uber), fitness (e.g.: Gold Gym), messaging (e.g.: Facebook, Whatsapp, Skype), payments (e.g.: Paypal), it can integrate with Siri to let the user performs certain actions (better called as intents) in response to spoken commands given by users.
Siri is intelligent enough to handle all the language processing and semantic analysis that is required to turn these spoken requests into instructions that the app can handle. The iOS app defines the tasks it supports, validates the information it receives and provides information for Siri to present and take action.
WatchOS and iOS apps can adopt the Sirikit framework to allow people to use Siri and Shortcuts to perform app-specific actions on Apple Watch, iPhone, iPad, HomePod and CarPlay. Here is a list of domains that Sirikit supports for iOS and watchOS apps.
Sending a message, search a message and assigning attributes to a message are three kinds of intents supported by Siri’s messaging domain.
Implementing Intent Handler is the primary part of integrating Siri into your iOS app. This can be done by adding the “Intents Extension” target in the iOS app by selecting “File–>New–>Target” and then selecting “Intents Extension.” Enter any name, e.g.: “SiriIntentExtension”
Some system information must be provided within “Info.plist” file of the “SiriIntentExtension” to indicate the intents that the app must react to:
Above code specifies the supported intents list (which contains only one intent in our case, “INSendMessageIntent”). If there is a need to restrict access to intents for locked devices, you can specify a restricted intents list using the “IntentsRestrictedWhileLocked” key.
The “NSExtensionPrincipalClass” key provides the name of the class in your IntentsExtension that decides which handler is to be used for a given intent. Let’s call this class an “IntentHandler”.
The implementation of the IntentHandler class is pretty simple:
As the above code returns an instance of “MessagesIntentHandler” for any given intent (as we have subscribed to only one intent types). If you need to implement support for different intents, you can verify which intent the handler is to be provided for:
Every process happens within “MessagesIntentHandler” class. Here’s the implementation of this class:
As the handler inherits from “NSObject”, the “INSendMessageIntentHandling” protocol requires the use of “NSObjectProtocol” and it contains one required and four optional functions:
A user needs to authorize before accessing the app. For this the “INSendMessageIntentHandling” protocol must contain the following code:
The above code checks whether an internet connection is available and whether a user is authorized in the application. “NSUserActivity” is passed to the application when the app is opened. If the validation fails, we return an error and an appropriate status code.
Passing a “failureRequiringAppLaunch,” command to Siri will indicate user to open an app. As soon as the user opens the app, the “userActivity” can be detected and suggest that the user can again try after authorization.
Third most important function suggests Siri work as follows:
This finally resolves the domain of a user request and sends a wrapped message to the server. “intent.content” contains a text message that is recorded by the user. If this attempt fails, a “.failure” response code is sent to Siri so that it can convey it to the user. There is a need to add “NSSiriUsageDescription” key to your app’s “Info.plist.” The complete implementation of “MessageIntentHandler” can be found on GitHub.
In order to develop this kind of extension, these points must be noted:
The domain must be added for both the app and the SiriIntentExtension
According to Apple’s docs, custom dictionary of app-specific and user-specific words must be implemented that can help Siri not be misunderstood.
Usage permission of Siri has to be managed by calling “INPreferences.requestSiriAuthorization”
It is important to specify a localization of the name, like a user, must set their language preferences so that Siri understands when the user gives commands in that particular language. This requires the user to pass a “CFBundleDisplayName” key for any localization with the appropriate value.
As the Siri gets turned on, it can be put to use for various tasks.
To be able to use Siri in iOS app development more accurately, it is important to define custom vocabulary that people use with your app. Any terms defined by the user are used by Siri to help resolve requests but aren’t guaranteed to be recognized. It can give you race stats for motorsports, quickly look up a password or search for your favorite memories and find answers to food and celebrity questions. Consider defining alternate app names and do not try to impersonate other apps by listing their names as alternate names for your app. Also, provide Siri with example requests so that users can utilize Siri in a most efficient way. Take real-time tips on digital voice assistant integration in iOS apps from our experts. Contact us.
Neeti got her master's degree in software engineering in 2009 and has been working since for software companies of all sizes as a technical writer. What started as a high school passion has now been converted into a serious profession. She has a special knack of learning from all verticals and imbibing the extracts into her writing. She enjoys learning technical aspects of writing from her tasks where her experience and understanding are most impactful.