Skip to content

Include HTTP Response Body in Email (SMTP) Notifications #6044

@mukhlish32

Description

@mukhlish32

⚠️ Please verify that this question has NOT been raised before.

I checked and did not find an issue that exactly matches this request. Closest is #5454, but I am making a distinct request with clearer scope.

Image

📝 Describe your problem

I'm using a health check API that returns detailed JSON information. When the system is in a bad state, it returns HTTP 500 with a structured error payload. Uptime Kuma correctly detects the failure and sends an alert via SMTP.

To manage alert logic, I also use the JSON Query Expression feature:

  • Expression: status
  • Condition: ==
  • Expected Value: ok

This means Uptime Kuma only considers the service UP if "status": "ok" exists in the JSON response body. So clearly, Uptime Kuma is already reading and parsing the response body.

However, the email notification does not include the response body, which contains important debug information like which service failed. (e.g., Redis down, disk full, etc), which would help us quickly understand the root cause without re-checking the API manually.

Currently, the email might say:

Status: DOWN
Message: Request failed with status code 500

📝 Error Message(s) or Log

No error messages — it's a feature limitation.

🐻 Uptime-Kuma Version

2.0.0-beta.3

💻 Operating System and Arch

Ubuntu 24.04

🌐 Browser

Chrome

🖥️ Deployment Environment

Docker


Please let me know if this feature already exists or if there’s a workaround available.
If not, I believe it would be very helpful for teams using structured health check APIs.

Thank you!


🏷️ Feature Request Type

Other

🔖 Feature description

Allow users to include the HTTP response body (especially when it's JSON) in SMTP email notifications using the Custom HTML E-mail Body feature.

Currently, even if the monitor parses and uses the JSON response (e.g., via JSON Query Expression), the response body is not available in email templates.

This feature would expose responseJSON or a similar variable, enabling users to show service-specific failure info (e.g., disk full, Redis down) directly in email alerts.

Optional settings could include:

  • A toggle to enable/disable including the response body
  • Support for pretty-printing or templating the response
  • Truncation/length limits for large responses

This will help operators identify the root cause faster, without needing to log into Kuma or call the API manually.

✔️ Solution

Expose the parsed response body (e.g., responseJSON) to the custom HTML email template system when using SMTP notifications. This would allow users to render the structured JSON response directly inside the email. For example:

📋 Example API response

{
  "status": "fail",
  "redis": { "status": "fail", "error": "Connection refused" },
  "disk": { "status": "fail",  "error": "usedPercent: 94.1" },
  "timestamp": "2025-08-07T08:51:29.771Z"
}

📋 Custom Body

{% if responseJSON %}
  {% assign data = responseJSON | parse_json %}
  <table>
    {% for key in data %}
      {% assign value = data[key] %}
      {% if key != "status" and key != "timestamp" %}
        <tr>
          <td>{{ key }}</td>
          <td>{{ value.status }}</td>
          <td>{% if value.status == "fail" %}{{ value.error | default: "Unknown error" }}{% endif %}</td>
        </tr>
      {% endif %}
    {% endfor %}
  </table>
{% endif %}

This solution would:

  • Reuse existing responseJSON data already fetched and parsed by Uptime Kuma
  • Allow full customization via the existing email template feature
  • Let users create rich, informative alert emails

Optional settings:

  • Add a toggle like: ✅ Include response body in email
  • Limit size to prevent huge payloads

❓ Alternatives

No response

📝 Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:notificationsIssues or PRs related to notificationsfeature-requestRequest for new features to be addedtype:enhance-existingfeature wants to enhance existing monitor

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions