In this article

Quickstart: Get intent using Node.js

In this article

In this quickstart, use an available public LUIS app to determine a user's intention from conversational text. Send the user's intention as text to the public app's HTTP prediction endpoint. At the endpoint, LUIS applies the public app's model to analyze the natural language text for meaning, determining overall intent and extracting data relevant to the app's subject domain.

Prerequisites

Get LUIS key

Access to the prediction endpoint is provided with an endpoint key. For the purposes of this quickstart, use the free starter key associated with your LUIS account.

Sign in using your LUIS account.

Select your name in the top right menu, then select Settings.

Copy the value of the Authoring key. You will use it later in the quickstart.

The authoring key allows free unlimited requests to the authoring API and up to 1000 queries to the prediction endpoint API per month for all your LUIS apps.

Get intent with browser

To understand what a LUIS prediction endpoint returns, view a prediction result in a web browser. In order to query a public app, you need your own key and the app ID. The public IoT app ID, df67dcdb-c37d-46af-88e1-8b97951ca1c2, is provided as part of the URL in step one.

The endpoint of the public IoT app is in this format: https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/df67dcdb-c37d-46af-88e1-8b97951ca1c2?subscription-key=<YOUR_KEY>&q=turn on the bedroom light

Copy the URL and substitute your key for the value of <YOUR_KEY>.

Paste the URL into a browser window and press Enter. The browser displays a JSON result that indicates that LUIS detects the HomeAutomation.TurnOn intent as the top intent and the HomeAutomation.Room entity with the value bedroom.

Change the value of the q= parameter in the URL to turn off the living room light, and press Enter. The result now indicates that LUIS detected the HomeAutomation.TurnOff intent as the top intent and the HomeAutomation.Room entity with value living room.

Install dependencies by running the following command at the command-line: npm install.

Run the code with npm start. It displays the same values that you saw earlier in the browser window.

LUIS keys

This quickstart uses the authoring key for convenience. The key is primarily for authoring the model but does allow a small number (1000) of endpoint requests. When you are ready for more endpoint requests in a test, stage or production environment, create a Language Understanding resource in the Azure portal and assign it to the LUIS app in the LUIS portal.