telegram-notifications-plugin icon indicating copy to clipboard operation
telegram-notifications-plugin copied to clipboard

Escaping environmental variables

Open EricRossC opened this issue 8 years ago • 2 comments

Hi there! I just started using this wonderful plugin but it took me a while to figure out why my messages where not getting through: my BUILD_URL has a _ inside and I was using that variable inside the message.

Is there any way to escape this variables? Also, is there a way to include the job status in the message (failed, success)?

Thanks in advance Best regards!

EricRossC avatar Apr 17 '18 22:04 EricRossC

Hi! Thank you! Do you have problems when a variable value has the underscore character? For example, you have a message like "My build URL is ${BUILD_URL}", your BUILD_URL contains _ char, and this variable cannot be resolved correctly? Setting job status isn't the part of our plugin. But you can add post-build step and choose statuses for which you want to get messages, for example only for failed jobs. Or you can try different solutions to set BUILD_STATUS variable, I've found these: first, second

wlad031 avatar Apr 18 '18 03:04 wlad031

Thanks for your reply!

About the problem with the _ char, in my case the $BUILD_URL variable resolves to http://server/something_something/path/path, and when the plugin tries to send the message, the telegram server rejects the message. I get this message in the log:

org.telegram.telegrambots.exceptions.TelegramApiRequestException: Error sending message: [400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 42

I left out the $BUILD_URL variable and now I get the message.

Thanks in advance!

EricRossC avatar Apr 18 '18 03:04 EricRossC