简体   繁体   中英

IBM Watson Assistant: How to set a context variable from option response?

I couldn't figure out a problem with IBM Watson Assistant. I've chosen to use an Option type as response. That way, I can see a list on my chatbot where each item is clickable and has an associated value.

When a user clicks one of the options, the associated user input value is sent to the assistant. How can I give this value to a context variable? Is it possible?

Yes, that is possible for option responses and is the typical use case. I have demonstrated that in a simple chatbot I use in some of my talks.

I use different language code as options. Users can click on them and the result is saved in the variable langcode . Because users could have already specified what I would ask for, I check for it and save it.

列出标签和选项

The simple bot has more uses of options and the full skill is available in case you want to see all the details.

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