How to use Azure Function (NodeJs) as Amazon Alexa endpoint

Altaf Shaikh
2 min readDec 20, 2019

In this piece, I will be covering how to use an Azure Function as an endpoint for Amazon Alexa.

  1. Create an Azure function

Creating an Azure function is out of the scope of this document. Please visit this link to learn How To Develop Azure Functions by using Visual Studio Code.

Copy the function URL after the successful deployment of Azure function from VSCode.

2. Add Alexa skill Endpoint

Go to the Build tab of your skill dashboard in Alexa Developer Console. Select the Endpoint option from the left side menu.

Select the HTTPS option on the right pane.

In Default Region block, add function URL copied from step 1.

Select the SSL certificate type as per your domain mappings of Azure function. During development, you can continue with option 1 or 2, but make sure to update it before moving to production.

Click Save Endpoints.

Now your endpoint is pointing to the Azure Function. You need to handle Alexa skill requests in your Azure Function.

3. Handle Alexa skill request in the Azure Function.

  1. Install ASK SDK to your azure function project.

Run the following command to install the standard ASK SDK v2 for Node.js distribution

npm install --save ask-sdk

2. Add the following code in index.ts file to handle skill requests.

I have kept the intent handler in different folder to keep the file structure clean.

You can add multiple IntentHandlers in addRequestHandlers function. I am adding only a single IntentHandler.

3. Add the following code to handle skill requests.

I have modified the handle function to use async/await structure. It enables us to call asynchronous operations in the handler.

4. Deploy your function to Azure Functions and test your skill in the developer console.

Voila! You get a response from Azure Function endpoint for your Alexa skill query.

Response from Azure function

--

--