-
Create a new Intent name:
addTwoNumbers
. -
Under Training phrases type:
add 5 and 6
and Change the parameters name:number to a
&number1 to b
. -
Then go to Fulfillment session under intent. and
Enable webhook call for this intent
. -
Now go to Fulfillment menu undersidebar and
Enable
theInline Editor
. -
Define
intentMap.set('YourIntentName', FunctionsName)
Functions. For example in this intent I'm usingintentMap.set('addTwoNumbers', AddNumber);
-
Create a function named 'addTwoNumbers'.
function AddNumber(agent){ var x =agent.parameters.a; var y =agent.parameters.b; var z =x+y; agent.add('sum of '+x+' and '+y+' = '+z); }
-
Click on Deploy Button and Test it.