Fill Button Options with Database Values

Is there a way to have database entries as button options? I have a “rooms” table, with a boolean for whether or not that room is available. I want to display the rooms that are “true” and have the user select one. Then that room’s availability value would change to false.

How would I go about doing this?


1 Like

Hi @mpranckus

Yeah, its possible, For this, the approach would be doing the below method

1.Do a database search matching your condition and store the result in variables
2. Access the result in a function using data.variables.variablename and we have to resolve in a particular format from function to display them as quick reply buttons.

the format would be

let obj = {
title: "Please select the options",
options :[{
title:"hotel 1",
text:"hotel 1",
title :"Hotel 2",
text: "Hotel 2",

The title should be an string , options should be an json array.

Please resolve the result in this particular format from function to show them as qr buttons

And in Quick reply prompt, please use the fetch from option and select the variable(where you stored the function response)

Please let us know incase of any queries.