My team is working on a chatbot with Microsoft bot framework, as a requirement we need to show a dynamic choice list according to what the users select. For this we are hitting an API to fetch the custom response. Please find below an example of the response.
{
"items": [
{
"val": {
"Field1": "Hello World"
},
"_links": {
"self": [
{
"href": "API_URL_FOR_THIS_OPTION"
}
]
}
},
{
"val": {
"Field1": "Hi World"
},
"_links": {
"self": [
{
"href": "API_URL_FOR_THIS_OPTION"
}
]
}
},
],
"_links": {
"self": [
{
"href": "MAIN_API_URL"
}
]
}
}
Here, the number of options to be shown in the dynamic choice list will be equal to the length of the items array. The following code is used to convert this response into choices array compatible with adaptive cards
var arr1=[]
for(var i=0; i<resp.body.items.length;i++)
{
arr1.push(resp.body.items[i].values["Field1"])
}
var choice_arr_new=[];
for(var j = 0; j<arr1.length; j++)
{
var dictionry={};
dictionry['title'] = arr[j];
dictionry['value'] = arr[j];
choice_arr_new.push(dictionry);
}
It works well but I am encountering a size limit of about 250 Kb as the api response has items.length of more than 3000 for some cases. And hence, I receive the following Error: The request content length exceeded limit of 262144 bytes, while trying to pass the choice array to the Adaptive card
Questions:-
- Is there any way to increase the size limit to accommodate large choices array for
adaptive card?
- Is there any alternative way to display the list within Bot Framework?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…