简体   繁体   中英

Api.ai webhook integration

I integrated webhook with demo hotel example provided by api.ai.

when i add my code for webhook responses, basic user queries such as "HI","Hello" also get custom response from webhook.

how to call webhook on specific intent only after setting required parameter true and not on default intent which doesn't required parameters and how to use slot filling feature?

I guess, for slot filling feature, following link might help you out: https://api.ai/docs/examples/slot-filling

Now the answer to your previous question where you asked, how to call webhook on specific intent only after setting required parameter true. Please have a look at following snap wherein you have an option to set "required" for any parameter in action & "use webhook" in fulfillment. So now webhook will be called only for that specific intent when that parameter value is entered by user such as UserEmail in the following snap.

在此处输入图片说明

Now if you want to use this "email" value in your webhook, you just have to create a class for get & set method:

public class Parameters
{
    public string UserEMail { get; set; }
}

& use this value to respond user

case "Ask For Email":{
          string strUserEmail = request.result.parameters.UserEmail;
          obj.speech = "Thank you";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM