diff --git a/src/lib/addons/webhook-definition.ts b/src/lib/addons/webhook-definition.ts index 30438b1837..b125b8083b 100644 --- a/src/lib/addons/webhook-definition.ts +++ b/src/lib/addons/webhook-definition.ts @@ -86,10 +86,11 @@ const webhookDefinition: IAddonDefinition = { "event": "{{event.type}}", "createdBy": "{{event.createdBy}}", "featureToggle": "{{event.data.name}}", - "timestamp": "{{event.data.createdAt}}" + "timestamp": "{{event.data.createdAt}}", + "json": {{{eventJson}}} }`, description: - "(Optional) You may format the body using a mustache template. If you don't specify anything, the format will similar to the events format (https://docs.getunleash.io/reference/api/legacy/unleash/admin/events)", + "(Optional) You may format the body using a mustache template. If you don't specify anything, the format will similar to the events format (https://docs.getunleash.io/reference/api/legacy/unleash/admin/events). You can use {{{eventJson}}} to include entire serialized event.", type: 'textfield', required: false, sensitive: false, diff --git a/src/lib/addons/webhook.ts b/src/lib/addons/webhook.ts index ed0dede588..1d0e7eec89 100644 --- a/src/lib/addons/webhook.ts +++ b/src/lib/addons/webhook.ts @@ -22,6 +22,8 @@ export default class Webhook extends Addon { parameters; const context = { event, + // Stringify twice to avoid escaping in Mustache + eventJson: JSON.stringify(JSON.stringify(event)), }; let body: string | undefined;