Step by step starting tutorial

In this guide you'll make your first Dasha app. If you need any help, join us in our Developer Community.

The app going to be a simple conversational IVR for a fictional postal service. In general, IVR asks the user to press buttons as an answer, e. g. "press 1 to talk to shipment returns".

People don't like IVRs for their synthetic nature, so let's make a conversational one that can understand what the user says. You can download full source code for this example.

Step 1: Installing Dasha CLI

Dasha CLI is a tool to help manage Dasha accounts, applications and settings. You can install it with npm:

$ npm install --global "@dasha.ai/cli"

MacOS and Linux users need to use sudo:

sudo npm install --global "@dasha.ai/cli"

Don't forget to log into your account:

$ dasha account login

Step 2: Installing Dasha Studio (optional)

Dasha Studio is an extension to Visual Studio Code that accelerates building Dasha apps and provides advanced tools for your app's maintenance. It's an optional but highly recommended step.

Install VSCode and then install DashaStudio one of the following ways:

  • Search for "Dasha Studio" in VSCode Extension View

  • Run code --install-extension dasha-ai.dashastudio

  • Download Dasha Studio from VSCode Marketplace

    Dasha Studio consists of two primary components: Graph Editor and Profiler. It also provides syntax highlighting and IntelliSense for Dasha Script. Learn more on Dasha Studio capabilities in Debugging your app and doing maintenance.

Step 3: Creating conversational UI

Let's create a main.dsl file and put in our first node:

start node root //start node { do { #connectSafe($phone); //connect via phone #waitForSpeech(1000); #sayText("Welcome to United Postal Service! How can I help you?"); wait *; //wait for user speech } transitions { track_parcel: goto track_parcel on #messageHasIntent("track_parcel"); missed_delivery: goto missed_delivery on #messageHasIntent("missed_delivery"); where_is_point: goto where_is_point on #messageHasIntent("where_is_point"); return_shipment: goto return_shipment on #messageHasIntent("return_shipment"); } }

track_parcel: goto track_parcel on #messageHasIntent("track_parcel"); literally means "go to node track_parcel if what user have said contains intent 'track parcel'".

Let's add that track_parcel node:

node track_parcel { do { #sayText("Sorry, tracking function is not implemented yet."); #disconnect(); exit; } }

In node track_parcel we simply respond to user and hang up. In this example we're using #sayText() system call to do it.

Step 4: Creating NLU dataset

Now that we have our conversation flow in place. Let's create a NLU dataset. Read here more.

Create data.json file and put in the intents and/or entities:

{ "version": "v2", "intents": { "track_parcel": { "includes": [ "track parcel", "track package", "where is my package", "where is my parcel", "you know I'd like to track my package please" ] }, "missed_delivery": { "includes": [ "i missed the delivery", "missed my delivery", "how can I reschedule delivery", "is there a way to schedule delivery again" ] } } }

To teach Dasha a new intent you must provide 5-8 sample phrases containing the intent.

Step 5: Integrating with your backend

At this point, we have all the conversational UI ready and it's time to integrate Dasha into your backend.

First, you need to install and import the Dasha SDK:

$ npm install "@dasha.ai/sdk"
const dasha = require("@dasha.ai/sdk");

Then you upload your app to run on Dasha Cloud:

const app = await dasha.deploy("path/to/app");

Now, to start your dialogue application:

await app.start();

To create and launch your first conversation with Dasha:

const conv = app.createConversation(); await dasha.chat.createConsoleChat(conv); await conv.execute({ channel: "text" });

Finally, stop the application and clean up its resources:

await app.stop(); app.dispose();

Next up

Now that you've built your first app, here are some things you might want to see next:

Found a mistake? Email us, and we'll send you a free t-shirt!

Enroll in beta

Request invite to our private Beta program for developers to join the waitlist. No spam, we promise.