Autocomplete like input option for user to select value

How can we provide the autocomplete like option to user on chatbot for select values.

For Eg: In text box user types “Kumar” then API will be call & show multiple available name option which contains “Kumar”.

  1. Call Api first before prompting and store quesions in an array.
let names = ['name1', 'name2',...., 'nameN']

Then use function

return new Promise(resolve => {
    const { term } = data;
    let suggestions = [];
    names.forEach((hit) => {
        if (hit.toLowerCase().includes(term.toLowerCase())) {
            suggestions.push([hit, hit]);
        }
    });
    resolve(suggestions);
});           

add this function in prompt settings.

Thanks for the reply. I will follow your suggestion and let you know.