How to make dispatcher.utter fetch 5 replies

if I have this code that fetch 5 top news and I want it to show up to the user, I try this but it returned an exception and just fetch one line.

         def run(self, dispatcher, tracker, domain):
       
          main_url = "https://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=""
        
           
          open_page = requests.get(main_url).json() 
        
         
          article = open_page["articles"] 
         
          totalResults = [] 
            
          for ar in article: 
              totalResults.append(ar["title"]) 
                
          for i in range(len(totalResults)): 
            if i == 5:
             break
            
            response = (i + 1, totalResults[i])    
            dispatcher.utter_custom_message(response)
            return []

Is the error related to buttons ? Because the custom_message function is trying to access a field buttons in your response. I’m not sure about this because I’m trying it right now, but imo if you want a really custom message you’ll have to overload OutputChannel and adapt the “send_custom_message” method.

You can find an exemple of how to overload it here : chatroom/bot_server_channel.py at master · scalableminds/chatroom · GitHub (check the project to see all the step)

It’s not necessarily custom message I just want to fetch 5 replies at same action