Change Alert Template Title Depending on Transport Used

Hello,

Is it possible to have a different alert title depending on the transport used? I have a devices up/down alert template attached to 2 transports. One sends an email alert to my email and the other sends an email to my 4G router, which then picks it up to send it via SMS. My 4G router requires the subject of the email to contain the phone number for the SMS to be sent too.

I can change the alert title in the template to my phone number but then all my email alerts come through with the subject as my phone number too. My alert template already includes an if/else statement to send a different message depending on the transport used. Can i add something in there to generate a title/subject?

This is my current alert template:

@if ($alert->transport_name == 'Text Message Alerts')
@if ($alert->state == 1) {{ $alert->severity }} @endif
@if ($alert->state == 2) acknowledged @endif
@if ($alert->state == 3) recovering @endif
@if ($alert->state == 0) recovered @endif
\nHost:</b> {{ $alert->hostname }}
\nAlert Duration:</b> {{ $alert->elapsed }}

@else
<div style="font-family:Helvetica;">
<h2>@if ($alert->state == 1) <span style="color:red;">{{ $alert->severity }} @endif
@if ($alert->state == 2) <span style="color:goldenrod;">acknowledged @endif</span>
@if ($alert->state == 3) <span style="color:green;">recovering @endif</span>
@if ($alert->state == 0) <span style="color:green;">recovered @endif</span>
</h2>
<b>Host:</b> {{ $alert->hostname }}<br>
<b>Alert Duration:</b> {{ $alert->elapsed }}<br>
<br>

@if ($alert->faults)
@foreach ($alert->faults as $key => $value) <b>{{ $value['service_desc'] }} - {{ $value['service_type'] }}</b><br>
{{ $value['service_message'] }}<br>
<br>
@endforeach
@endif
</div>
@endif

Regards
Oliver

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.