How to send Custom JSON to the Slack App through Rasa Chatbot

That is how my JSON file looks like

  data = newsapi.get_top_headlines(country = "in")
  leng = len(data)
  for i in range(leng):
    gt = {
            "attachment": {
                "type": "template",
                "payload": {
                    "template_type": "generic",
                    "elements": [
                                                {
                            "title": data['articles'][i]['title'],
                            "image_url":data['articles'][i]['urlToImage'],
                            "subtitle": data['articles'][i]['description'],
                            "buttons": [
                                {
                                    "type": "web_url",
                                    "url": data['articles'][i]['url'],
                                    "title": "Read More"
                                },
                            ]
                        },
                    ]
                }
            }
        }
    dispatcher.utter_message(json_message = gt)

And this is the error I am getting

image

Thank You