Open educatedwarrior opened 6 years ago
Hi @educatedwarrior,
do you just want to include the javascript code in the Event emitted by your TriggerAgent? You should be able to but the code in the message
option.
I can't get it to work. When I get the email, java script show the text of the java script instead of what needs to be rendered. I pasted the output below. This is what comes back in the email.
new TradingView.widget({ "width": 980, "height": 610, "symbol": "NASDAQ:AAPL", "interval": "D", "timezone": "Etc/UTC", "theme": "Light", "style": "1", "locale": "en", "toolbar_bg": "#f1f3f6", "enable_publishing": false, "allow_symbol_change": true, "hideideas": true });
thought of something. Think I'm missing the escape symbol before double quotes inside the tags.
Nope, didn't work. I was using Java Script I entered into a credential.
Did you set the content_type
option of the EmailAgent
to text/html
? I can't find any sanitization code that would remove the script tags in our code.
I tried your suggestion above for content_type and I get the same issue. The JavaScript within the script tag is displayed as text in the message and not interpretted. Here is an example formatted output message.
I using also tried using javascript from cryptocompare widgets, just to see if there was an issue with trading view widgets. Here is the link for cryptocompare widgets - https://www.cryptocompare.com/dev/widget/wizard/
I don't think it's a huginn problem so I'm closing this ticket for now.
It's a huginn issue. Huginn is stripping the script tags from the message output, so then the java script then becomes text in the html.
I also noticed the & symbol gets replaced with "\&" in the message output.. and this causes an issue with the script running as well. I can run the javascript here https://www.w3schools.com/jquerymobile/tryit.asp?filename=tryjqmob_collapsible and get it to work.
I would like to be able to add a java script widget into a message from a trigger alert. Any suggestions?
Widget Site https://www.tradingview.com/widget/
Sample Widget Code