-------- Solution --------
I found the correct format from this test case
Here is how you can do it
- buttons:
- payload: '/continue{{"chat_user_mood":"unhappy"}}'
title: unhappy
- payload: '/continue{{"chat_user_mood":"just_ok"}}'
title: just_ok
- payload: '/continue{{"chat_user_mood":"happy"}}'
title: happy
-------- Original question --------
I want to fill the slot directly from the button. But I failed to do so.
System Ubuntu 20.04 & Mac OS 11 (Big Sur) + Python 3.8.
❯ pip list | grep rasa
rasa 2.0.6
rasa-sdk 2.0.0
I have defined both intent & slot like this
intents:
- affirm
- deny
- continue
...
slots:
user_name:
type: text
influence_conversation: true
chat_user_mood:
type: categorical
values:
- happy
- just_ok
- unhappy
And reply is
utter_chat_ask_user_mood:
- buttons:
# Trided several fotmat
- payload: /continue{chat_user_mood:happy}
title: happy
- payload: '/continue{"chat_user_mood":"just_ok"}'
title: just_ok
- payload: '/continue{"chat_user_mood": "unhappy"}'
title: unhappy
Then I get an error
2020-11-16 01:09:45 ERROR rasa.core.nlg.interpolator - Failed to fill utterance template '/continue{chat_user_mood:happy}'. Tried to replace 'chat_user_mood:happy' but could not find a value for it. There is no slot with this name nor did you pass the value explicitly when calling the template. Return template without filling the template.
Traceback (most recent call last):
File "/home/brikerman/.miniconda3/envs/chatty/lib/python3.8/site-packages/rasa/core/nlg/interpolator.py", line 28, in interpolate_text
text = text.format(values)
KeyError: 'chat_user_mood:happy'
2020-11-16 01:09:45 ERROR rasa.core.nlg.interpolator - Failed to fill utterance template '/continue{"chat_user_mood":"just_ok"}'. Tried to replace '"chat_user_mood":"just_ok"' but could not find a value for it. There is no slot with this name nor did you pass the value explicitly when calling the template. Return template without filling the template.
Traceback (most recent call last):
File "/home/brikerman/.miniconda3/envs/chatty/lib/python3.8/site-packages/rasa/core/nlg/interpolator.py", line 28, in interpolate_text
text = text.format(values)
KeyError: '"chat_user_mood":"just_ok"'
2020-11-16 01:09:45 ERROR rasa.core.nlg.interpolator - Failed to fill utterance template '/continue{"chat_user_mood": "unhappy"}'. Tried to replace '"chat_user_mood": "unhappy"' but could not find a value for it. There is no slot with this name nor did you pass the value explicitly when calling the template. Return template without filling the template.
Traceback (most recent call last):
File "/home/brikerman/.miniconda3/envs/chatty/lib/python3.8/site-packages/rasa/core/nlg/interpolator.py", line 28, in interpolate_text
text = text.format(values)
KeyError: '"chat_user_mood": "unhappy"'