Rasa Webchat Carousel Example

Is it possible to customize the carousel, like I want to add plus,minus buttons and add to cart functionality etc, basically ordering system on bot itself?

@bharath-madduri it much dependent on front end and your expertise in React JS as Rasa webchat is developed in that only.

1 Like


Thats a gr8 post, Can you please let me know how to set the size of the carousel and its elements ?

-thanks Vishal

This files contains your custom actions which can be used to run

custom Python code.

See this guide on how to implement these action:

Custom Actions

This is a simple example for a custom action which utters “Hello World!”

from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker

from rasa_sdk.executor import CollectingDispatcher

from typing import Dict, Text, Any, List, Union, Optional

from rasa_sdk import Action

import pprint

import re

import time

import html2text

from textblob import TextBlob

import requests

import os

class ActionCarousel(Action):

def name(self) -> Text:

    return "action_carousel"

def run(self, dispatcher: CollectingDispatcher,

         tracker: Tracker,

         domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    test_carousel =     {

                "type": "template",

                "payload": {

                    "template_type": "generic",

                    "elements": [{

                        "title": "sample text",

                        "subtitle": "",

                        "image_url": "C:\\Users\\siddesh\\Documents\\carousel_bot\\images_folder\\dog.jpg",

                        "dims": {

                        "width": 200,



                        "buttons": [ 


                                "title": "button title",

                                "type": "postback",

                                "payload": "/intent_lion{\"choice_id\": 1}"









    return []

I am attaching my action.py and my carousel is not working. Can anybody help me with this. i m new in rasa chat bots. any changes required in config.yml or anywhere else? thanks in advance

Video link:

This video will solve your issues


Thank you very much for the reply. I used the code provided in the video. Still, I m facing the problem, It is showing a small box instead of a carousel. Here, I am using a Django connection, not in webchat. so the problem may be inside the UI. I have used the only rule policy. Thank you again for ur quick efforts.

can you please share repo and screenshot of what you are getting

can you please share repo and screenshot of what you are getting

above is the link to get the sample chatbot, it also has problem.png where i have added screent shot how carousel looks like (using Django)

It seems you are using chatroom and not rasa-webchat. Please check and let me know

1 Like

how can I resolve the issue with the chatroom??

yes its chatroom

I haven’t used chatroom. Because of manual work for designing. So, I am not the right person to solve your issue with carousel. might be RasaStaff?

Many thanks for reply…

Is it mandatory to define buttons? If not defined, then the widget facing issues (hides)

Yes, it is, when we are showing something to user, we can’t keep user dangling like what they can do next, so there has to be one button which could continue the conversation

can’t we simply use the carousel just for images and some text? Carousel is not only just to have some actions right, it could be used for different purpose as well. If that features has to be achieved can we do using the existing carousel code?

I am using Rasa 2.7 and even though the example Dict above used to render the carousel works, it returns an error when using “rasa shell”:

    "Attachment: " + message.get("attachment"), color=color
TypeError: must be str, not dict

I think the UI may work on older versions of Rasa, but I think you should use the “custom” attribute in the domain file or “json_message” value on dispatcher.utter_message in later versions.

Maybe the UI needs to be updated to cater for this?

Hi, you can have a look here, on how to add carousels in webchat

1 Like

@Horizon733 Hii i wanted to add a carousel in my bot but i dont want display an image i just want to display the text part and button in carousel , i tried removing image parameter but still the blank image shows up