alleyway / add-tradingview-alerts-tool

Automated entry of TradingView alerts for bot trading tools such as 3Commas, Alertatron, CryptoHopper, etc.
MIT License
623 stars 140 forks source link

New line added on custom messages #140

Closed rivendell-tech closed 1 year ago

rivendell-tech commented 1 year ago

Hi @mlake when adding a custom message to the alert, it is added a new line by default. So the content is parsed as ContentType:text/plain instead of ContentType:application/json, resulting in a 400 Bad Request on Tradingview when using Discord webhooks.

Tradingview support confirms they're planning to ignore this, but there's no ETA at the moment.

Is there a way to fix this behavior or avoid it? At the moment I have to manually delete the new line on each alert, then it works correctly.

mlake commented 1 year ago

Just to clarify...

It's TradingView that's sending a different content-type as header if there's a newline or not?

...or do you mean discord is interpreting as text/json based on the payload given to it?

I don't think it's adding a newline in the code..Is it's something to do with your YAML configuration which has YAML adding a new line?

rivendell-tech commented 1 year ago

It's TradingView that's sending a different content-type as header if there's a newline or not?

Yes, Tradingview is sending ContentType:text/plain if there's a new line and ContentType:application/json, as it should, if there's not.

Is it's something to do with your YAML configuration which has YAML adding a new line?

There's no a new line or a space after the closing brace in the yaml file.


As reference, the reply from Tradingview support:

tradingview-support-nl

mlake commented 1 year ago

From your tradingview-alerts-home directory, run the following:

npm install @alleyway/add-tradingview-alerts-tool@beta

Please report back if it's working okay and I will push a release.

rivendell-tech commented 1 year ago

Perfectly, you can proceed. :pray:

mlake commented 1 year ago

🖖 live long & prosper

rivendell-tech commented 1 year ago