2021-08-12 15:04:37 +02:00
import {
2021-01-19 10:42:45 +01:00
FEATURE_ARCHIVED ,
2021-08-12 15:04:37 +02:00
FEATURE_CREATED ,
2021-10-07 10:22:20 +02:00
FEATURE_ENVIRONMENT_DISABLED ,
FEATURE_ENVIRONMENT_ENABLED ,
FEATURE_METADATA_UPDATED ,
2021-12-17 04:30:39 +01:00
FEATURE_VARIANTS_UPDATED ,
2021-10-07 10:22:20 +02:00
FEATURE_PROJECT_CHANGE ,
2021-01-19 10:42:45 +01:00
FEATURE_REVIVED ,
2021-02-18 09:18:04 +01:00
FEATURE_STALE_OFF ,
2021-08-12 15:04:37 +02:00
FEATURE_STALE_ON ,
2021-10-07 10:22:20 +02:00
FEATURE_STRATEGY_ADD ,
FEATURE_STRATEGY_REMOVE ,
FEATURE_STRATEGY_UPDATE ,
2021-08-12 15:04:37 +02:00
FEATURE_UPDATED ,
2022-04-06 20:51:01 +02:00
FEATURE_TAGGED ,
FEATURE_UNTAGGED ,
2021-08-12 15:04:37 +02:00
} from '../types/events' ;
import { IAddonDefinition } from '../types/model' ;
2021-01-19 10:42:45 +01:00
2021-08-12 15:04:37 +02:00
const webhookDefinition : IAddonDefinition = {
2021-01-19 10:42:45 +01:00
name : 'webhook' ,
displayName : 'Webhook' ,
description :
'A Webhook is a generic way to post messages from Unleash to third party services.' ,
2021-02-25 22:27:11 +01:00
documentationUrl : 'https://docs.getunleash.io/docs/addons/webhook' ,
2021-01-19 10:42:45 +01:00
parameters : [
{
name : 'url' ,
displayName : 'Webhook URL' ,
description :
'(Required) Unleash will perform a HTTP Post to the specified URL (one retry if first attempt fails)' ,
type : 'url' ,
required : true ,
2021-02-04 11:02:58 +01:00
sensitive : true ,
2021-01-19 10:42:45 +01:00
} ,
{
name : 'contentType' ,
displayName : 'Content-Type' ,
placeholder : 'application/json' ,
description :
'(Optional) The Content-Type header to use. Defaults to "application/json".' ,
type : 'text' ,
required : false ,
2021-08-12 15:04:37 +02:00
sensitive : false ,
2021-01-19 10:42:45 +01:00
} ,
{
name : 'bodyTemplate' ,
displayName : 'Body template' ,
placeholder : ` {
"event" : "{{event.type}}" ,
"createdBy" : "{{event.createdBy}}" ,
"featureToggle" : "{{event.data.name}}" ,
"timestamp" : "{{event.data.createdAt}}"
} ` ,
description :
2021-02-25 22:27:11 +01:00
"(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/docs/api/admin/events)" ,
2021-01-19 10:42:45 +01:00
type : 'textfield' ,
required : false ,
2021-08-12 15:04:37 +02:00
sensitive : false ,
2021-01-19 10:42:45 +01:00
} ,
] ,
events : [
FEATURE_CREATED ,
FEATURE_UPDATED ,
FEATURE_ARCHIVED ,
FEATURE_REVIVED ,
2021-02-18 09:18:04 +01:00
FEATURE_STALE_ON ,
FEATURE_STALE_OFF ,
2021-10-07 10:22:20 +02:00
FEATURE_ENVIRONMENT_ENABLED ,
FEATURE_ENVIRONMENT_DISABLED ,
FEATURE_STRATEGY_REMOVE ,
FEATURE_STRATEGY_UPDATE ,
FEATURE_STRATEGY_ADD ,
FEATURE_METADATA_UPDATED ,
2021-12-17 04:30:39 +01:00
FEATURE_VARIANTS_UPDATED ,
2021-10-07 10:22:20 +02:00
FEATURE_PROJECT_CHANGE ,
2022-04-06 20:51:01 +02:00
FEATURE_TAGGED ,
FEATURE_UNTAGGED ,
2021-01-19 10:42:45 +01:00
] ,
} ;
2021-08-12 15:04:37 +02:00
export default webhookDefinition ;