Skip to content

Commit 5da772c

Browse files
authored
feat: adds support for app configuration as a destination (#82)
Signed-off-by: nitish <[email protected]>
1 parent cd479f7 commit 5da772c

File tree

6 files changed

+464
-11
lines changed

6 files changed

+464
-11
lines changed

.secrets.baseline

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "package-lock.json|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-09-04T10:57:40Z",
6+
"generated_at": "2025-09-25T01:54:39Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -126,15 +126,15 @@
126126
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
127127
"is_secret": false,
128128
"is_verified": false,
129-
"line_number": 1601,
129+
"line_number": 1658,
130130
"type": "Secret Keyword",
131131
"verified_result": null
132132
},
133133
{
134134
"hashed_secret": "3235b7f8d626cde63611d2e9ec43473f4e844c67",
135135
"is_secret": false,
136136
"is_verified": false,
137-
"line_number": 2816,
137+
"line_number": 2967,
138138
"type": "Base64 High Entropy String",
139139
"verified_result": null
140140
}
@@ -144,15 +144,15 @@
144144
"hashed_secret": "0cc20f91828bed53ddb6294968b7f9abd631a3ba",
145145
"is_secret": false,
146146
"is_verified": false,
147-
"line_number": 1535,
147+
"line_number": 1598,
148148
"type": "Secret Keyword",
149149
"verified_result": null
150150
},
151151
{
152152
"hashed_secret": "3235b7f8d626cde63611d2e9ec43473f4e844c67",
153153
"is_secret": false,
154154
"is_verified": false,
155-
"line_number": 3175,
155+
"line_number": 3332,
156156
"type": "Base64 High Entropy String",
157157
"verified_result": null
158158
}

README.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ Currently, this functionality supports following destinations:
511511
5. IBM Cloud Code Engine
512512
6. IBM Cloud Object Storage
513513
7. Webhook
514+
8. App Configuration
514515

515516
```js
516517
const testDestinationParams = {
@@ -731,6 +732,29 @@ For EventStreams template supported template type value: event_streams.notificat
731732
```
732733
For CodeEngine template supported template type value: ibmceapp.notification and ibmcejob.notification
733734

735+
#### AppConfiguration Template
736+
```js
737+
const templateConfigModel = {
738+
body: <template-body>,
739+
};
740+
let createTemplateParams = {
741+
instanceId: <instance-id>,
742+
name: <template-name>,
743+
type: <template-type>,
744+
templateConfigModel,
745+
description: <template-description>,
746+
};
747+
748+
let createTemplateResult;
749+
try {
750+
createTemplateResult = await eventNotificationsService.createTemplate(createTemplateParams);
751+
console.log(JSON.stringify(createTemplateResult.result, null, 2));
752+
} catch (err) {
753+
console.warn(err);
754+
}
755+
```
756+
For App Configuration template supported template type value: app_configuration.notification
757+
734758
### List Templates
735759
```js
736760
const params = {
@@ -912,6 +936,30 @@ try {
912936
```
913937
For Event Streams template supported template type value: event_streams.notification
914938

939+
#### Update App Configuration Template
940+
```js
941+
const templateConfigModel = {
942+
params: {
943+
body: <template-body>,
944+
},
945+
};
946+
let replaceTemplateParams = {
947+
instanceId: <instance-id>,
948+
id: <template-id>,
949+
name: <template-name>,
950+
type: <template-type>,
951+
templateConfigModel,
952+
description: <template-description>,
953+
};
954+
let replaceTemplateResult;
955+
try {
956+
replaceTemplateResult = await eventNotificationsService.replaceTemplate(replaceTemplateParams);
957+
} catch (err) {
958+
console.warn(err);
959+
}
960+
```
961+
For App Configuration template supported template type value: app_configuration.notification
962+
915963
#### Update CodeEngine Template
916964
```js
917965
const templateConfigModel = {
@@ -1008,7 +1056,6 @@ try {
10081056
### Create Subscription
10091057

10101058
```js
1011-
While Creating Subscription use any of one option from webhook or email
10121059

10131060
// SubscriptionCreateAttributesWebhookAttributes
10141061
const subscriptionCreateAttributesModel = {
@@ -1034,6 +1081,46 @@ eventNotificationsService
10341081
});
10351082
```
10361083

1084+
### ⚠️ Special Consideration for App Configuration Destination
1085+
1086+
When creating or updating a subscription for an **App Configuration** destination, the `attributes` object has a specific rule:
1087+
1088+
- You must include **either** `feature_flag_enabled` **or** `template_id_notification`
1089+
- You **cannot** include both properties together
1090+
1091+
This ensures that a subscription is created for the correct use case — either **feature flag evaluation** or **notification templating**, but not both at once.
1092+
1093+
#### ✅ Valid Example (Feature Flag Evaluation)
1094+
1095+
```js
1096+
{
1097+
"attributes": {
1098+
"feature_flag_enabled": true
1099+
}
1100+
}
1101+
```
1102+
1103+
#### ✅ Valid Example (template association)
1104+
1105+
```js
1106+
{
1107+
"attributes": {
1108+
"template_id_notification": "<template-id>"
1109+
}
1110+
}
1111+
```
1112+
1113+
#### ❌ Invalid Example (Not Allowed)
1114+
1115+
```js
1116+
{
1117+
"attributes": {
1118+
"feature_flag_enabled": true,
1119+
"template_id_notification": "<template-id>"
1120+
}
1121+
}
1122+
```
1123+
10371124
### List Subscriptions
10381125

10391126
```js
@@ -1586,6 +1673,8 @@ Find [event_notifications_v1.env.hide](https://github.com/IBM/event-notification
15861673
- `EVENT_NOTIFICATIONS_EVENT_STREAMS_ENDPOINT` - Event streams end point
15871674
- `EVENT_NOTIFICATIONS_CODE_ENGINE_APP_TEMPLATE_BODY` - base 64 encoded json body for Code Engine Application
15881675
- `EVENT_NOTIFICATIONS_CODE_ENGINE_JOB_TEMPLATE_BODY` - base 64 encoded json body for Code Engine Job
1676+
- `EVENT_NOTIFICATIONS_APP_CONFIG_CRN` - CRN of App Configuration instance
1677+
- `EVENT_NOTIFICATIONS_APP_CONFIG_TEMPLATE_BODY` - base 64 encoded json body for App Configuration
15891678
15901679
## Questions
15911680

event-notifications/v1.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,6 +3684,7 @@ namespace EventNotificationsV1 {
36843684
SMTP_CUSTOM = 'smtp_custom',
36853685
SMS_CUSTOM = 'sms_custom',
36863686
EVENT_STREAMS = 'event_streams',
3687+
APP_CONFIGURATION = 'app_configuration',
36873688
}
36883689
}
36893690

@@ -5099,6 +5100,19 @@ namespace EventNotificationsV1 {
50995100
verification: string;
51005101
}
51015102

5103+
/** Payload describing a App Configuration destination configuration. */
5104+
export interface DestinationConfigOneOfAppConfigurationDestinationConfig
5105+
extends DestinationConfigOneOf {
5106+
/** The App Configuration Destination type. */
5107+
type: string;
5108+
/** CRN of the App Configuration instance. */
5109+
crn: string;
5110+
/** Environment ID of App Configuration. */
5111+
environment_id: string;
5112+
/** Feature ID of App Configuration. */
5113+
feature_id: string;
5114+
}
5115+
51025116
/** Payload describing a Chrome destination configuration. */
51035117
export interface DestinationConfigOneOfChromeDestinationConfig extends DestinationConfigOneOf {
51045118
/** FCM api_key. */
@@ -5293,6 +5307,15 @@ namespace EventNotificationsV1 {
52935307
sensitive_headers?: string[];
52945308
}
52955309

5310+
/** The attributes for a App Configuration notification. */
5311+
export interface SubscriptionAttributesAppConfigurationAttributesResponse
5312+
extends SubscriptionAttributes {
5313+
/** App Configuration enable feature flag attribute. */
5314+
feature_flag_enabled?: boolean;
5315+
/** App Configuration template id. */
5316+
template_id_notification?: string;
5317+
}
5318+
52965319
/** The attributes for a Code Engine response. */
52975320
export interface SubscriptionAttributesCodeEngineAttributesResponse
52985321
extends SubscriptionAttributes {
@@ -5412,6 +5435,15 @@ namespace EventNotificationsV1 {
54125435
add_notification_payload: boolean;
54135436
}
54145437

5438+
/** The attributes for a App Configuration subscription. */
5439+
export interface SubscriptionCreateAttributesAppConfigurationAttributes
5440+
extends SubscriptionCreateAttributes {
5441+
/** App Configuration enable feature flag attribute. */
5442+
feature_flag_enabled?: boolean;
5443+
/** App Configuration template id. */
5444+
template_id_notification?: string;
5445+
}
5446+
54155447
/** The attributes for a Code Engine subscription. */
54165448
export interface SubscriptionCreateAttributesCodeEngineAttributes
54175449
extends SubscriptionCreateAttributes {
@@ -5521,6 +5553,15 @@ namespace EventNotificationsV1 {
55215553
template_id_notification?: string;
55225554
}
55235555

5556+
/** The attributes for a App Configuration subscription. */
5557+
export interface SubscriptionUpdateAttributesAppConfigurationAttributes
5558+
extends SubscriptionUpdateAttributes {
5559+
/** App Configuration enable feature flag attribute. */
5560+
feature_flag_enabled?: boolean;
5561+
/** App Configuration template id. */
5562+
template_id_notification?: string;
5563+
}
5564+
55245565
/** The attributes for a Code Engine subscription. */
55255566
export interface SubscriptionUpdateAttributesCodeEngineAttributes
55265567
extends SubscriptionUpdateAttributes {
@@ -5644,6 +5685,12 @@ namespace EventNotificationsV1 {
56445685
template_id_notification?: string;
56455686
}
56465687

5688+
/** Payload describing a App Configuration template configuration. */
5689+
export interface TemplateConfigOneOfAppConfigurationTemplateConfig extends TemplateConfigOneOf {
5690+
/** Template body(Base64 encoded). */
5691+
body: string;
5692+
}
5693+
56475694
/** Payload describing a code engine application template configuration. */
56485695
export interface TemplateConfigOneOfCodeEngineApplicationTemplateConfig
56495696
extends TemplateConfigOneOf {

0 commit comments

Comments
 (0)