How to create a Custom Amazon Alexa skill for your virtual agent?
Want to create a custom Alexa skill for your developed virtual agent/chatbot in Dialogflow, IBM Watson, Drift or any other supporting platform? It’s easier than you might think.Here’s everything you need to know to build your first custom Amazon Alexa skill.
User Journey:
Development & Integration:
Part 1: Building custom Amazon Alexa Skill
- Sign in to your Amazon Developer service(ADS) account and choose Alexa.
- Create Alexa Skill & set Invocation Name.
- Since, integration has to be with a developed virtual agent, there is no need for all different intents & training on Alexa skill.
- Create a custom intent with custom slot filling to capture user query.
- Delete all other default intents including fallback intent so only custom intent gets triggered for each user query. (Note: If you face issue while deleting fallback intent , add few training phrases and retry to delete)
Part 2: Developing Service Endpoint
- All Alexa Request & Response are forwarded to developed virtual agent through this service endpoint by HTTPS.
- Create a route in any backend platform like NodeJs, Java, Python or any other
- Parse the Alexa Request Object & extract user query from slot field of the object.
- Create a request to your virtual agent from this service endpoint with the user utterance. (Note: Virtual Agent Client library, Rest API , etc can be used over here)
- Create a formatted Alexa Response Object & return the response along with it.
Part 3: Integration : Amazon Alexa skill & Service Endpoint
- Create & deploy the service endpoint that accepts & returns request & response to & from Alexa.
- Use the HTTPS endpoint in the Alexa endpoint
- After integration, all request made to Alexa will be forwarded to the service endpoint .
Communication:
The User — Custom Alexa Skill Communication
The communication between the user and the custom skill is achieved via an Alexa powered device such as the Echo.
Activation of a particular skill is done by saying the skill’s invocation name along with the trigger word (“Alexa”) which activates the device.Upon activating the skill, the user is able to send other voice commands, or speech requests, to the skill.
Communication with the Custom Alexa Skill, Service Endpoint & Virtual Agent
The skill interface on the Alexa processes the user’s speech requests and then maps them to custom intent. Once the custom intent is detected, the skill interface creates a json encoded event, which is passed to the skill service.
The skill service on the Alexa determines the action & forwards the request to HTTPS endpoint. The skill service returns a JSON encoded response from the HTTPS endpoint to the skill interface for further processing. After processing, the speech response is sent back to the user through the device.
Advantages:
- Saves time from rework to create the virtual agent & Alexa console is saved.
- Changes need to be made only on virtual agent end.
References: