How to Create Dynamic Choices from API respose

I solved my problem
here is my code
async function action(bp: typeof sdk, event: sdk.IO.IncomingEvent, args: any, { user, temp, session } = event.state) {

const getServices = async () => {
const services = session[‘services’]
const singleChoice = {
text: ‘Select Any One service’,
typing: true,
choices: []
for (let i = 0; i < services.length; i++) {
const serv = services[i]
const obj = {
title: serv.service_name,
value: serv.service_name
const eventDestination = {
botId: event.botId,
try {
const payloads = await bp.cms.renderElement(’#builtin_single-choice’, singleChoice, eventDestination)
await, payloads)
} catch (e) {
console.error(error : ${e})

return getServices()


Have you find a way to do this?
I am too stuck at this.

Try the above code. it is the solution to create dynamic choices

Thanks i did tried your code and after receiving error i did write here. but now i did able to solve that its just removing # in bp.cms.renderElement(’#builtin_single-choice’, parameter. thanks for your code.