mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +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:
parent
df9229a90c
commit
d3eac6caf8
@ -86,10 +86,11 @@ const webhookDefinition: IAddonDefinition = {
|
|||||||
"event": "{{event.type}}",
|
"event": "{{event.type}}",
|
||||||
"createdBy": "{{event.createdBy}}",
|
"createdBy": "{{event.createdBy}}",
|
||||||
"featureToggle": "{{event.data.name}}",
|
"featureToggle": "{{event.data.name}}",
|
||||||
"timestamp": "{{event.data.createdAt}}"
|
"timestamp": "{{event.data.createdAt}}",
|
||||||
|
"json": {{{eventJson}}}
|
||||||
}`,
|
}`,
|
||||||
description:
|
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',
|
type: 'textfield',
|
||||||
required: false,
|
required: false,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
|
@ -22,6 +22,8 @@ export default class Webhook extends Addon {
|
|||||||
parameters;
|
parameters;
|
||||||
const context = {
|
const context = {
|
||||||
event,
|
event,
|
||||||
|
// Stringify twice to avoid escaping in Mustache
|
||||||
|
eventJson: JSON.stringify(JSON.stringify(event)),
|
||||||
};
|
};
|
||||||
|
|
||||||
let body: string | undefined;
|
let body: string | undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user