slack-notification
slack-notification copied to clipboard
NewLines in Message and Attachment Test not working
Hi, great extension, thanks! But to use it in conjunction e.g. with the GenerateReleaseNotes task it would be great to be able to use variables that contain newlines correctly. When a variable contains a Newline-Character, currently `n will be slacked. (i.e. the backtick from powershell special character escaping is not properly replaced. `t for tab character is the same. Maybe it would be enough to manually replace at least these two instead of creating a generic solution.
I think the replacement should be done after the JSON.Stringify calls.
Additionally, when entering SomeText\nWith a newline in the input boxes, the \n will also be masked and be part of the slack message instead of creating a newline.
Greetings, Florian
@eFloh Thanks for using Slack Notification task and for giving this feedback. I will make the necessary changes and release an update to the task. I will keep you updated here.. :)
@eFloh did you find any work around for that?
My suggestion is:
Message and PreText are very much the same type of field.
- Keep the Message field the way it is without any modifications.
- Change the PreText field to require a name of variable as input, so we can format the variable before hand and the variable is only expanded internally by the task not by VSTS.
this would be a one line change on the task
I believe on the task input.ts file, method toJSON
change this line preText: this._preText,
to this line: preText: process.env[this._preText],
or whatever is the way to read a variable.
Hey guys, thanks for your hard work.
I want to just tell you and others that for me, when using Powershel script only this works as a Newline-Character ``n and I'm not even using variables as input capability because it doesn't work for me (ver.5)
Has there been any movement on this issue? I'm currently trying to send a multiline message and can't figure out how to get the \n strings to not literally render in the message. I'm using powershell in a separate task to construct the message (and insert the \n characters) and the store in a pipeline variable which is used for input in the slack notification task.