Tpaw
(Tom)
September 29, 2022, 12:56pm
1
Hi, I’m trying to pass variable to slot using buttons:
sourcelang = "French"
buttons = [
{"payload": '/change_language{"lang": "sourcelang"}', "title": "Yes"},
{"payload": '/deny{"lang":"self.bot_lang"}', "title": "No"}
]
But when i click button “Yes”, slot value is set to “sourcelang”, not to “French”. Rasa expects property name enclosed in double quotes. How can i pass variable sourcelang?
rasa_learner
(sathishlakshmanan)
September 29, 2022, 6:44pm
2
You can implement it the following way,
sourcelang = "French"
buttons = [
{"payload": '/change_language{"lang": "'+sourcelang+'"}', "title": "Yes"},
{"payload": '/deny{"lang":"'+self.bot_lang+'"}', "title": "No"}
]
1 Like
Tpaw
(Tom)
September 30, 2022, 8:00am
3
Yes! That’s exactly what I meant and it works perfectly. Thanks!
rasa_learner
(sathishlakshmanan)
September 30, 2022, 5:24pm
4
You can mark it as a solution so others with the same problem can find it useful as well
1 Like