tanayraj
(Tanayraj Jhagadiawala)
July 23, 2021, 8:20am
1
hey, I am struggling to give hyperlinks to users on rasa x.
in my action.py file
domin.yml
Output:
link is not clickable. It is a normal string. i want hyperlink as an output.
rasa version - 2.7.10
If can anybody help me to solve this problem?
Thank you!
Don’t worry much about formatting in Rasa X (since the developer is the only one using it). You should implement the features you want in your frontend.
Anyway, try to do
dispatcher.utter_message(response = "utter_link", attachment = webUrl)
And in your domain: - text: Here you go -
Look at the Dispatcher documentation for more info.
tanayraj
(Tanayraj Jhagadiawala)
July 23, 2021, 9:27am
3
hey @ChrisRahme …thank you for your quick response.
I did changes as you mentioned. But still, on rasa x, it is not giving a clickable hyperlink. which on click should open in a new tab.
action.py
domin.py
output
and I am not focusing on formatting. I just need a clickable hyperlink. On click, a link should open in a new tab.
Thank you!
What I meant is you can make it clickable when you build your your frontend
nik202
(NiK202)
July 23, 2021, 12:12pm
5
@tanayraj Try this and It will solve your issue:
utter_link:
- text: " [Here you go](https://rasa.com)"
Even, if this work you can even render the link whilst storing. I had personally used in my action.py
Proof, in below thread
Good Luck!
1 Like
ChrisRahme
(Chris Rahmé)
July 23, 2021, 12:17pm
6
Good idea, @nik202 ! I wanted to suggest that, but I wanted to try out if it worked with Rasa X before posting!
If this works in Rasa X (as it does in Webchat), the original utterance should be:
utter_link:
- text: [Here you go]({link})
or, if you want to show the link, maybe:
utter_link:
- text: Here you go - [{link}]({link})
nik202
(NiK202)
July 23, 2021, 12:28pm
7
@ChrisRahme Will this will satisfies you as you suggested I had run and it solved the problem.
1 Like
tanayraj
(Tanayraj Jhagadiawala)
July 23, 2021, 12:47pm
11
thank you for your response. But I want to add a dynamic link. In my case, the link is generating from action.py and the link is different each time.
I get it what you have mentioned but I believe it is only useful for a static link.
but thank you once again. if you have any suggestions for dynamic then please share them. i am still stuck at this point.
nik202
(NiK202)
July 23, 2021, 12:49pm
12
@tanayraj I guess you not got our point, you can write a code for dynamic link storing and render in domain.yml see the example of Chris.
@tanayraj I am using 100+ dynamic link based on user question. Every time it will be different based on user query.
@tanayraj you also mentioned “I just need a clickable hyperlink. On click, a link should open in a new tab.” that solving you’re issue and for dynamic we already suggested.
1 Like
nik202
(NiK202)
July 23, 2021, 1:05pm
13
@tanayraj
dispatcher.utter_message(template="utter_link", tracker, link=webUrl)
utter_link:
- text: [Here you go] ({link})
You need to try first.
Hope this will solve your issue.
2 Likes
tanayraj
(Tanayraj Jhagadiawala)
July 23, 2021, 1:09pm
14
yes, you were right. i just misunderstood. Thank you @nik202 and @ChrisRahme .
after using your suggestions it is working as I expected. now I am able to open the link in a new tab.
Thank you once again.
1 Like
chris.chu
(Christopher Chu)
August 6, 2021, 2:59pm
16
Doesn’t work for me, I’m getting a .yaml error when i tried this:
"The provided yaml file is invalid. You can use http://www.yamllint.com/ to validate the yaml syntax of your file."
Can’t reveal much else as of NDA, but I’m trying to print a hyperlink to webchat.
nik202
(NiK202)
August 6, 2021, 4:25pm
17
@chris.chu your some file is not properly formatted, do check with yml checker http://www.yamllint.com