First and last name detection
first_name
The first name, the person has provided
last_name
The last name, the person has provided
Connecting to the application
Just add "person-en:v2"
in dashaapp file section nlu.skills
. It will look like:
{ "formatVersion": "2", "dialogue": { "file": "main.dsl" }, "nlu": { "language": "en-US", "skills": [ "person-en:v2" ], "customIntents": { "file": "nlu.json" } }, "nlg": { "type": "phrases", "file": "phrasemap.json", "signatureFile": "phrasemap.json" }, "name": "my app name" }
Example of using in the DSL
context { input endpoint: string; output first_name: string? = null; output last_name: string? = null; } start node root { do //actions executed in this node { #connectSafe($endpoint); // connecting to the phone number which is specified in index.js that it can also be in-terminal text chat goto ask; } transitions // specifies to which nodes the conversation goes from here { ask: goto ask; } } node ask { do { if ($first_name is null and $last_name is null) { #sayText("What is your name?"); wait *; } #sayText("Thank you, have a good day!"); exit; } transitions { ask: goto ask on true; } } preprocessor digression get_first_name { conditions { on #messageHasData("first_name"); } do { set $first_name = #messageGetData("first_name")[0]?.value; return; } } preprocessor digression get_last_name { conditions { on #messageHasData("last_name"); } do { set $last_name = #messageGetData("last_name")[0]?.value; return; } }
Try it out
Found a mistake? Email us, and we'll send you a free t-shirt!