Problem with MQTT notifications handler for custom message payload

Using Grafana v11.5 with MQTT integration for alert results reporting.

Customized alert notification templates which work in the preview for fired alerts are not executed in the MQTT handler. Instead, a default json payload continues to be executed.

Things done:

  1. Proper alert query executing
  2. MQTT alert contact handler properly configured and tested (json format selected)
  3. Customized notification template created and tested
  4. Customized notification template loaded to MQTT Message block
  5. Changes properly saved

I am seeing many examples for email and slack notifications, but very little on MQTT alert notification handling. The Grafana documentation only provides a static json payload example for what is sent–this is the default payload that I am unable to modify.

Who else is using the MQTT alert notification handler and can explain why only the default payload message gets sent?

1 Like

JSON payload cannot be changed. The template that you specify in the integration configuration only affects one field of the JSON object - message. If you want it to be a custom JSON then you need to switch to “text” mode and update the message template to produce JSON

Thank you. I finally concluded that after multiple attempts and seeing the result in the message object. I had thought about trying “text” mode but wanted to inquire further among more seasoned people in case I was missing something more straightforward. I appreciate the response. I will go back and see if I can construct a modified json payload.