Introduction

An Alexa Interaction
- Your Alexa device is always listening for one of its wake words (Alexa, Echo or Computer).
- Once Alexa hears its wake word, it knows it needs to pay attention to any subsequent speech.
- It passes this speech to the Alexa Voice Service (AVS) in the cloud.
- Amazon converts the speech to text and attempts to determine the skill that was requested based on the invocation name. In the above example, ‘Ask My Database’.
- Once it recognizes the skill, it forms as structured JSON request and sends it to our ORDS REST end-point.
- The proxy receives the request over https and then passes it on to ORDS via http.
- ORDS determines which handler to carry out the request based on the URL called by Amazon.
- The handler performs PL/SQL logic then returns a JSON response to Amazon.
- Amazon turns the response into speech and instructs the Alexa device to speak the response back to the end user.
- All this happens in less than a second.
Anatomy of an Alexa Skill
This is phrase that Alexa uses to identify your skill as opposed to any other skill. The various components of a Custom Skill are also packaged into an Invocation when you define the skill in the Amazon Alexa developer console.
Intent Schema
A set of Intents (the Intent Schema). Represent the actions your user can perform with your skill
In our example, we have one which is "getDatabaseSessions". The intent defined here is passed into our web service and we will use this to determine what code to run to fulfill the intent.
Custom Slots
Slots can be thought of as a way to inject variables into the intent. In our example, we are including the session status that we want to inquire on. These will be called out in the JSON sent to our web service
Utterances
Utterances are what the end user will make in order to execute an intent. An utterance ties together the Intent and the Custom Slots (or variables). Alexa identifies the intent based on the utterances defined
Utterances are also used to provide variations of phrases users may use to invoke your intent.
Other Considerations for an Alexa Skill

Testing
Once you have a working service, you will need to perform formal testing. Amazon provides several options including:
- On-Line Simulator. Type your sample utterance into a testing tool provided by Amazon and see the JSON that passes from Amazon to your ORDS service and the response your ORDS service passes back to Amazon.
- Unit testing on your Alexa device linked to your Amazon developer account.
- Share your services with unit testers or other developers via developer account sharing.
- Invite up to 2,000 users to beta test your skill using the Beta testing feature.
Before publishing your service you will need to consider security for your REST service which, by necessity is exposed to the internet.
- Secure your ORDS REST service by verifying the unique Skill Id that that is passed to you in the JSON payload.
- For added security, use Account Linking which utilizes OAUTH to authenticate against your ORDS REST service.
Publishing
- Submit your skill for certification and publication.
- If you do not want your skill published, another option is to keep your skill in Beta testing mode where you can invite up to 2,000 users to use your skill. You can manage users access and revoke access when necessary. This may be a good option for corporate users who don't want their skill published to the general public.
Secure ORDS Web Service End Point
One of the last steps in configuring your skill is to provide the URL for your ORDS REST service. For this, your service must be running SSL:
- During development, you can upload a self-signed certificate.
- From Beta Testing on, you must use a certificate from a trusted authority.
- Tip: Lets Encrypt provides free SSL certificates which work fine with AWS.
It's Time to Talk ORDS

At a high level, this is what your handler will need to do:
- Parse the JSON payload sent by Amazon
- Verify caller using the application id contained in the payload
- Determine the intent and custom slot values
- Run PL/SQL logic to fulfill the user's intent
- Build a JSON response to send back to Amazon
Voice Enable Your ERP
"Alexa ask EBS for my daily financial briefing"
Think of the CFO who wants to get a morning briefing on the state the company's financials. He simply asks Alexa, which in turn calls an ORDS service to pull the data from EBS and respond with:
- Your total revenue for yesterday was 1.2 million US dollars
- Your current cash on hand is 500,000 US dollars
- Your current open receivables are 200,000 US dollars
- <this list is just about endless>
Don't Stop There
"Alexa ask HQ for my daily corporate briefing"
- Current headcount is 12,000 (from your ERP Cloud HR system)
- There are 200,000 US Dollars in open quotes (from your Salesforce system)
- There were 2 reported accidents yesterday (from your in-house accident reporting system)
- The US trade deficit with China grew by 2% yesterday (from a data.gov web service)
- XYZ Corp was mentioned 2,000 times yesterday (taken from the company twitter feed)
- <again, the list is just about endless>
Conclusion
It's just another reason to consider APEX and ORDS, both no cost options of the Oracle database.
This Blog Post was developed from a presentation I did at KSCOPE and Open World in 2017. You can download the full presentation here.