Single choice but choices comes from my API respon...
# 🤝help
b
Hi, I'm new on BotPress. I just wonder about is there anything like this? For example: in my actions: const response = await axios.get("my-api-link.com/getOptions") after this, the options of single choice will be my options which fetched from my api link. for example response data is: { "option1", "option2", "option3" } so when user triggers this card, it'll show "Please select an option" then shows single choice, also prevents direct user input. only choices. Does anyone know? Thank you for helping. const brandNames = response.data.map(item => item.brandName) const quickReplies = brandNames.map(brandName => ({ title: brandName, payload: brandName })) console.log(quickReplies) // Kullanıcıya seçenekleri göster await bp.events.replyToEvent(event, [ { type: 'quick_reply', text: 'Lütfen bir seçenek seçin:', quick_replies: quickReplies } ]) } i tried this, but it doesn't give quick replies info. response was successful.
const singleChoice = { text:
Select An option
, choices: [ { title: 'YES', value: 'yes' }, { title: 'NO', value: 'no' } ], typing: false } const eventDestination = { channel: event.channel, target: event.target, botId: event.botId, threadId: event.threadId } const render = await bp.cms.renderElement('#builtin_single-choice', singleChoice, eventDestination) console.log(render) bp.events.replyToEvent(event, render) this code is solving that.