Adding hyperlinks in custom action and display in rasa X

Hi team,

may I know how I can add display web URLs or hyperlinks in rasaX ?. Now I am getting plain text only in rasa X.

##############code ########################

class Dynamic_Link(Action):

def name(self) -> Text:
    return "action_dynamic_link"
def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
		
		google_url="https://www.google.com/"
		amazon_url=https://www.amazon.com/
		
		 step1=f"1. open google .[]{google_url} \n 2. go to amazon websit.[]{amazon_url}"
		 dispatcher.utter_message(text=step1)

##########code ends##############

@naveenjr you want to display the hyperlink that’s it and in Rasa X only ?

Generic Code:

In domain.yml

utter_link:
- text: [Here you go] ({link})

In actions.py

`dispatcher.utter_message(text= " Following are the list of [Product Accessories] (https://rasa.com) ")`

Try first basic and then proceed, if you can print the name or last name by using user input then then same goes hear, so try :wink: Its your learning.

I hope this will help you and good luck!

Hi @nik202, thanks for the info. I have 2 questions here .

1.Here how utter_link and actions.py are linked ? (above mentioned solution).

2.i can not dispatch mutliple “utter_message” inside one “run” function. only first one is displaying in Rasa X. but both are displaying in Rasa shell and rasa interactive.

that is the reason i am sending all text inside one message

@naveenjr

No, I have given the generic code idea, but it can be interlinked, such as if the user wants to get the weather for a particular city, then we can write the code (API), fetch the information, and can render it to the frontend using the domain(utterance) or actions (dispatcher ) method.

It’s possible to display, but not only single utterances (I guess), I have displayed 5 responses with the same method. So, it is possible.

I hope this will give you more motivation. Good Luck!