1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

feat(integrations): ability to add stringified event (#6642)

You might want to include entire event, but as a different field.
This commit is contained in:
Tymoteusz Czech 2024-03-26 09:25:16 +01:00 committed by GitHub
parent df9229a90c
commit d3eac6caf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -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,

View File

@ -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;