Alerting - How does one assign templates to transports

Does anyone have any examples they could share on how to assign alerts templates to different transports.

We want to for example have an alert be sent to our on site noc team via email with html content but we want the same alert to be sent to our standby engineer via sms but with no html content.

Would I need to create two templates and assign each one to a sms transfer port and the other to email transport.

If so how do I assign a template to a transport.

I have checked the documentation but can’t find anything.

Thanks

I’m assuming this is your issue on github: https://github.com/librenms/librenms/issues/5438

My answer points you to the docs that has the ability to do this but as per the response in the issue - you CANNOT assign templates to transports only rules but in the templates you CAN display different output per transport and the docs has an example on this.

Reviving this because it seems it should be more of an issue.

In the docs this is glossed over under Conditional Formatting:

The problem is if I was going to use this method, where each section that varied between transports was on top of each other instead of just (pseudocode)

if transport = teams, use this big code block
else, use this big code block

it would be a huge hassle to do the “styled” template suggested for MSTeams at the bottom of the page.

There’s two ways to solve this:

  1. Tell me how to do nested code blocks properly
  2. Let me set templates on a per transport type deal

Also, it seems the methodology to get the subject line is either grab it from the first line of the Template textarea, or get it from the Alert title / Recovery title section, which unfortunately cannot run code so I can’t have a “Device Reachable at {{ $alert->ip }}” subject. I can do the if stuff in the top but that’s annoying if you’ve provided me these Subject areas. I have two solutions to fix this as well:

  1. Move the Subject areas to the Template textarea as a default template with //comments so the user can just fill it in (and get to use variables/arrays)
  2. Allow the use of variables/arrays in the title sections

If the nested codeblock section option worked it would be pretty easy to write out a guide for that with a template template that could be submitted to the docs.