Patch(webhooks): custom template parsing

What does this MR do and why?

The webhook custom templates strip the quotation marks when a date is supplied. This MR aims to prevent that.

The issue comes from how the "test webhook" and the "live" webhook behave. When testing the webhook with the template:

{
  "created_at": {{object_attributes.created_at}},
  "updated_at": {{object_attributes.updated_at}}
}

it works as expected, it properly returns a date in quotes. However when the webhook auto fires we strip that, so the output is:

  "created_at": 2025-12-17T10:25:48.541Z

With this change, the output when manually testing looks like:

{
  "created_at": "2026-03-16T17:57:17.223Z",
  "updated_at": "2026-03-16T17:57:17.223Z"
}

and when it runs automatically:

{
  "created_at": "2026-03-16 18:00:15 UTC",
  "updated_at": "2026-03-16 18:00:15 UTC"
}

In both cases the value is properly quoted.

References

Resolves #584387 (closed)

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Create any project
  2. Go to the webhook page
  3. Create a webhook with the template:
{
  "created_at": {{object_attributes.created_at}},
  "updated_at": {{object_attributes.updated_at}}
}
  1. Test the webhook, you should see properly formatted json, and quotation marks around the string.
  2. Check the webhook to auto send when issue comments are created
  3. On an issue in that project add a comment - you should see the date being quoted properly

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading