You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/DEVELOPING_YOUR_FIRST_SKILL.rst
+27-14Lines changed: 27 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,8 +54,8 @@ The functionality of these is identical and you can use **either**.
54
54
Exception handlers
55
55
~~~~~~~~~~~~~~~~~~
56
56
57
-
Sometimes things go wrong, and your skill code needs a way to handle the problem
58
-
gracefully. The ASK SDK for Python supports exception handling in a similar way
57
+
Sometimes things go wrong, and your skill code needs a way to handle the problem
58
+
gracefully. The ASK SDK for Python supports exception handling in a similar way
59
59
to handling requests. You have a choice of using `classes <#option-1-implementation-using-classes>`_ or `decorators <#option-2-implementation-using-decorators>`_.
60
60
The following implementation sections explore how to implement exception handling.
61
61
@@ -189,7 +189,7 @@ previous handler.
189
189
return handler_input.response_builder.response
190
190
191
191
Similar to the previous handler, this handler matches an IntentRequest with
192
-
the expected intent name. Basic help instructions are returned, and ``.ask(speech_text)``
192
+
the expected intent name. Basic help instructions are returned, and ``.ask(speech_text)``
193
193
causes the user's microphone to open up for the user to respond.
194
194
195
195
CancelAndStopIntent handler
@@ -274,6 +274,19 @@ previous handler.
274
274
Creating the Lambda handler
275
275
~~~~~~~~~~~~~~~~~~~~~~~~~~~
276
276
277
+
.. note::
278
+
279
+
For a custom skill, you can host your service in AWS Lambda or
280
+
as a web service hosted on your own endpoint.
281
+
282
+
Generally, hosting the skill code on AWS Lambda is the easiest way.
283
+
The below sections provide information on how to achieve this.
284
+
285
+
However, if you wish to host it with any other cloud hosting provider,
286
+
the SDK provides some support packages (``ask-sdk-webservice-support``,
287
+
``flask-ask-sdk``, ``django-ask-sdk``). You can find more information
288
+
on this configuration `here <WEBSERVICE_SUPPORT.html>`__.
289
+
277
290
The `Lambda handler <https://docs.aws.amazon.com/lambda/latest/dg/python-programming-model-handler-types.html>`_
278
291
is the entry point for your AWS Lambda function. The following code example
279
292
creates a Lambda handler function to route all inbound requests to your skill.
@@ -391,7 +404,7 @@ previous handler.
391
404
return handler_input.response_builder.response
392
405
393
406
Similar to the previous handler, this handler matches an IntentRequest with
394
-
the expected intent name. Basic help instructions are returned, and ``.ask(speech_text)``
407
+
the expected intent name. Basic help instructions are returned, and ``.ask(speech_text)``
395
408
causes the user's microphone to open up for the user to respond.
396
409
397
410
@@ -496,7 +509,7 @@ the previous handler.
496
509
.. code-block:: python
497
510
498
511
handler = sb.lambda_handler()
499
-
512
+
500
513
When using decorators, your request handlers and exception handlers are
501
514
automatically recognized by the Skill Builder object instantiated at
502
515
the top of the code.
@@ -658,15 +671,15 @@ the skill with Alexa.
658
671
659
672
* Next, configure the endpoint for the skill. To do this, follow these steps:
660
673
661
-
1. Under your skill, click the **Endpoint** tab, select AWS Lambda ARN,
674
+
1. Under your skill, click the **Endpoint** tab, select AWS Lambda ARN,
662
675
and copy the **Skill ID** of the skill you just created.
663
676
2. Open the AWS Developer Console in a new tab.
664
677
3. Navigate to the AWS Lambda function created in the previous step.
665
-
4. From the **Designer** menu, add the **Alexa Skills Kit** trigger menu, and
666
-
scroll down to paste the skill ID into the **Skill ID Verification** configuration.
678
+
4. From the **Designer** menu, add the **Alexa Skills Kit** trigger menu, and
679
+
scroll down to paste the skill ID into the **Skill ID Verification** configuration.
667
680
Click **Add and save** once completed to update the AWS Lambda function.
668
-
5. Copy the AWS Lambda function **ARN** from the top right corner of the page.
669
-
An ARN is a unique resource number that helps Alexa service identify the
681
+
5. Copy the AWS Lambda function **ARN** from the top right corner of the page.
682
+
An ARN is a unique resource number that helps Alexa service identify the
670
683
AWS Lambda function it needs to call during skill invocation.
671
684
6. Navigate to the Alexa Skills Kit Developer Console, and click on your
672
685
**HelloWorld** skill.
@@ -676,18 +689,18 @@ the skill with Alexa.
676
689
Click **Save Endpoints**.
677
690
9. Click **Invocation** tab, save and build the model.
678
691
679
-
* At this point you can test the skill. In the top navigation, click **Test**.
692
+
* At this point you can test the skill. In the top navigation, click **Test**.
680
693
Make sure that the **Test is enabled for this skill**
681
694
option is enabled. You can use the Test page to simulate requests, in text
682
695
and voice form.
683
696
684
-
* Use the invocation name along with one of the sample utterances as a guide.
697
+
* Use the invocation name along with one of the sample utterances as a guide.
685
698
For example, *tell greeter to say hello* should result
686
699
in your skill responding with “Hello World” voice and "Hello World" card on
687
-
devices with display. You can also open the Alexa app on your phone or at
700
+
devices with display. You can also open the Alexa app on your phone or at
688
701
https://alexa.amazon.com) and see your skill listed under **Your Skills**.
689
702
690
703
* Feel free to start experimenting with your intents as well as
691
704
the corresponding request handlers in your skill's code. Once you're finished
692
-
iterating, optionally move on to getting your skill certified and published
705
+
iterating, optionally move on to getting your skill certified and published
0 commit comments