I used to program in C++ but I'm trying to program a facebook bot in Javascript.
I have a function Options
that creates option buttons. The buttons are programmed like this (1):
"buttons": [{
"type": "web_url",
"url": "https://www.messenger.com",
"title": "Use"
}]
But since I have lots of them I would like to create a function to create buttons. I've tried to create a Button function like that:
function PLButton(type, title, payload) {
"type": type,
"title": title,
"payload": payload
}
And then substitute the code above (1) by this:
"buttons": [{PLButton("postback", "Drop", "PRESS_CANCEL")}]
But it doesn't work.