Skip to content

Encoding for body in custom alerting #989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
egorsmkv opened this issue Feb 4, 2025 · 1 comment
Open

Encoding for body in custom alerting #989

egorsmkv opened this issue Feb 4, 2025 · 1 comment

Comments

@egorsmkv
Copy link

egorsmkv commented Feb 4, 2025

Describe the feature request

I have the following config:

alerting:
  custom:
    url: "https://webhook.site/80437f67-6027-4d3d-acf8-fd2c26f9e5f6"
    headers:
      "Content-Type": "application/json"
    method: "POST"
    body: |
      {
        "message": "[ALERT_TRIGGERED_OR_RESOLVED]: [ENDPOINT_GROUP] - [ENDPOINT_NAME] - [ALERT_DESCRIPTION] - [RESULT_ERRORS]"
      }

When a trigger executed Gatus send a request:

Image

As you can mention, we have two " here:

Image

It leads to an error on the webhook part (it can't decode the body) so my feature request is to add possibility for it.

Why do you personally want this feature to be implemented?

No response

How long have you been using this project?

No response

Additional information

No response

@mathias-goebel
Copy link

mathias-goebel commented Mar 31, 2025

confirm. the custom alert will not send valid JSON because of unescaped double quotes within [RESULT_ERRORS] . Of course you can omit this placeholder, but best solution would be to have a JSON serializer finalizing the request body.

edit: Corrected: it is [RESULT_ERRORS] and not ALERT_DESCRIPTION.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants