Skip to content

Commit ce1c5ad

Browse files
authored
feat: adds markdown support from notification payload (#77)
Signed-off-by: nitish <[email protected]>
1 parent 9d20e17 commit ce1c5ad

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

.secrets.baseline

Lines changed: 3 additions & 3 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-04-21T04:17:22Z",
6+
"generated_at": "2025-06-24T14:20:16Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -134,7 +134,7 @@
134134
"hashed_secret": "3235b7f8d626cde63611d2e9ec43473f4e844c67",
135135
"is_secret": false,
136136
"is_verified": false,
137-
"line_number": 2773,
137+
"line_number": 2775,
138138
"type": "Base64 High Entropy String",
139139
"verified_result": null
140140
}
@@ -152,7 +152,7 @@
152152
"hashed_secret": "3235b7f8d626cde63611d2e9ec43473f4e844c67",
153153
"is_secret": false,
154154
"is_verified": false,
155-
"line_number": 3041,
155+
"line_number": 3043,
156156
"type": "Base64 High Entropy String",
157157
"verified_result": null
158158
}

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ const notificationCreateModel = {
14041404
- Pass 'WEB_FIREFOX' for Firefox browser.
14051405
- Pass 'WEB_CHROME' for Chrome browser.
14061406
- **Event Notifications SendNotificationsOptions** - Event Notifications Send Notifications method.
1407-
- **instance_id** (_string_) - Unique identifier for IBM Cloud Event Notifications instance.
1407+
- **instance_id*** (_string_) - Unique identifier for IBM Cloud Event Notifications instance.
14081408
- **ibmenseverity** (_string_) - Severity for the notifications. Some sources can have the concept of an Event severity. Hence a handy way is provided to specify a severity of the event. example: LOW, HIGH, MEDIUM
14091409
- **id*** (_string_) - A unique identifier that identifies each event. source+id must be unique. The backend should be able to uniquely track this id in logs and other records. Send unique ID for each send notification. Same ID can be sent in case of failure of send notification. source+id will be logged in IBM Cloud Logging service. Using this combination we will be able to trace the event movement from one system to another and will aid in debugging and tracing.
14101410
- **source*** (_string_) - Source of the notifications. This is the identifier of the event producer. A way to uniquely identify the source of the event. For IBM Cloud services this is the crn of the service instance producing the events. For API sources this can be something the event producer backend can uniquely identify itself with.
@@ -1426,12 +1426,13 @@ const notificationCreateModel = {
14261426
- **ibmendefaultshort*** (_string_) - Default short text for the message.
14271427
- **ibmendefaultlong*** (_string_) - Default long text for the message.
14281428
- **specversion*** (_string_) - Spec version of the Event Notifications. Default value is `1.0`.
1429-
- **ibmenhtmlbody*** (_string_) - The html body of notification for email.
1430-
- **ibmenmailto*** (_Array of string_) - Array of email ids to which the notification to be sent.
1431-
- **ibmensmsto*** (_Array of string_) - Array of SMS numbers to which the notification to be sent.
1432-
- **ibmensmstext*** (_string_) - SMS text to be sent.
1433-
- **ibmenslackto*** (_Array of string_) - Array of Slack channel/member ids to which the notification to be sent.
1434-
- **ibmentemplates*** (_Array of string_) - Array of template IDs that needs to be applied while sending notification for custom domain email and slack destination.
1429+
- **ibmenhtmlbody** (_string_) - The html body of notification for email.
1430+
- **ibmenmailto** (_Array of string_) - Array of email ids to which the notification to be sent.
1431+
- **ibmensmsto** (_Array of string_) - Array of SMS numbers to which the notification to be sent.
1432+
- **ibmensmstext** (_string_) - SMS text to be sent.
1433+
- **ibmenslackto** (_Array of string_) - Array of Slack channel/member ids to which the notification to be sent.
1434+
- **ibmentemplates** (_Array of string_) - Array of template IDs that needs to be applied while sending notification for custom domain email and slack destination.
1435+
- **ibmenmarkdown** (_string_) - The markdown content of pretty formatting.
14351436
14361437
Note: variable with * represents the mandatory attribute.
14371438
</details>

event-notifications/v1.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4209,6 +4209,8 @@ namespace EventNotificationsV1 {
42094209
subject?: string;
42104210
/** Stringified MMS Attachment JSON. */
42114211
ibmenmms?: string;
4212+
/** The markdown content for notification. */
4213+
ibmenmarkdown?: string;
42124214
/** The payload for webhook notification. */
42134215
data?: JsonObject;
42144216
/** The notification content type. */

examples/event-notifications.v1.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,6 +2769,8 @@ describe('EventNotificationsV1', () => {
27692769
const notificationsSouce = '1234-1234-sdfs-234:test';
27702770
const htmlBody =
27712771
'"Hi ,<br/>Certificate expiring in 90 days.<br/><br/>Please login to <a href="https: //cloud.ibm.com/security-compliance/dashboard">Security and Complaince dashboard</a> to find more information<br/>"';
2772+
const markdownContent =
2773+
'**Event Summary** \n\n**Toolchain ID:** `4414af34-a5c7-47d3-8f05-add4af6d78a6` \n**Content Type:** `application/json`\n\n---\n\n *Pipeline Run Details*\n\n- **Namespace:** `PR`\n- **Trigger Name:** `manual`\n- **Triggered By:** `[email protected]`\n- **Build Number:** `343`\n- **Pipeline Link:** [View Pipeline Run](https://cloud.ibm.com/devops/pipelines/tekton/e9cd5aa3-a3f2-4776-8acc-26a35922386e/runs/f29ac6f5-bd2f-4a26-abb8-4249be8dbab7?env_id=ibm:yp:us-south)';
27722774
const mms =
27732775
'{"content": "iVBORw0KGgoAAAANSUhEUgAAAFoAAAA4CAYAAAB9lO9TAAAAAXNSR0IArs4c6QAAActpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx4bXA6Q3J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40w8BQYQN4OW2pbCA6XKEKL0CsuSeHFvaIaSh3nfrHhrNNxm+032rWBb875czJMN18qtS6Qxz9yepLRlNRfPR9ijsYrS/0vdlmCghO78RZ5n3y7t2pswd1TR2Ydm0KxZ+hcVE6/YzeJ1xHDN3vxHpKFL92/TsXVK7KlN3N4Ol/v+/FXmPYtG01d4Vw2fe6vu+jh9CK7NwaQcsPWsm2Dt21XVegVl6TxdttgHMJD+DZp6Ljtqd7eN8aUY6x0RFq4LcamjtS2DT6ZS6AvIhFYcQoPDiWOOesIYdoXo6Fvf6Slfd24z/MWW0ox5whjmlBtxfCY7qdsbJu/h1gM3fHTZnC+JxhwcTeDqdKuv2/S+rSWfaLxiFzG3bIyruM1abzo6mwD1uLLB7yTtvhWrjNsaaM3kj5oc8JdiWbl3Xt5F8LtV+6F9B+QAfyu42IxPt5uO2oavO4jsoun/nF3Y7bRYttWNsbOjn6WtsbRveF3HfEVTneYTeI3ZD8RXtfQKxguyHhA3BJuBofT9AmDw+Tm9Yyxc3DC7kEXQ+TVZXhLYyRZQOpUMQ78dx27LaP0lhdHfrh6o/UBZjFz19p/Z9HoMoMPoHTtpP9IGMAP0ePbVt3HqFdLc03TI/wQfQq8dGStnuHt3VXlWvWPuxuzi0N9i4WnNtiSIj0VTeToM+p3bZhHR7drumLADmG3bQq8LZjfqZAiApIbo75x3TH7YfQJJDlmG1RsmaZzCGc4Ojd2wdLZ++EMb7AExmZs/F8rphwKFUC8in01JaZgCQPCgDAgDAgDwoAwIAwIA8KAMCAMPHUG/gKC0oz7fm25ogAAAABJRU5ErkJggg==", "content_type": "image/png"}';
27742776

@@ -2836,6 +2838,7 @@ describe('EventNotificationsV1', () => {
28362838
ibmentemplates: JSON.stringify(['149b0e11-8a7c-4fda-a847-5d79e01b71dc']),
28372839
ibmensubject: 'certificate expire',
28382840
ibmenhtmlbody: htmlBody,
2841+
ibmenmarkdown: markdownContent,
28392842
ibmenmms: JSON.stringify(mms),
28402843
ibmenfcmbody: JSON.stringify(notificationFcmBodyModel),
28412844
ibmenapnsbody: JSON.stringify(notificationApnsBodyModel),

test/integration/event-notifications.v1.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,6 +3037,8 @@ describe('EventNotificationsV1_integration', () => {
30373037
const notificationsSouce = '1234-1234-sdfs-234:test';
30383038
const htmlBody =
30393039
'"Hi ,<br/>Certificate expiring in 90 days.<br/><br/>Please login to <a href="https: //cloud.ibm.com/security-compliance/dashboard">Security and Complaince dashboard</a> to find more information<br/>"';
3040+
const markdownContent =
3041+
'**Event Summary** \n\n**Toolchain ID:** `4414af34-a5c7-47d3-8f05-add4af6d78a6` \n**Content Type:** `application/json`\n\n---\n\n *Pipeline Run Details*\n\n- **Namespace:** `PR`\n- **Trigger Name:** `manual`\n- **Triggered By:** `[email protected]`\n- **Build Number:** `343`\n- **Pipeline Link:** [View Pipeline Run](https://cloud.ibm.com/devops/pipelines/tekton/e9cd5aa3-a3f2-4776-8acc-26a35922386e/runs/f29ac6f5-bd2f-4a26-abb8-4249be8dbab7?env_id=ibm:yp:us-south)';
30403042
const mms =
30413043
'{"content": "iVBORw0KGgoAAAANSUhEUgAAAFoAAAA4CAYAAAB9lO9TAAAAAXNSR0IArs4c6QAAActpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+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3eyIVpdwriIAOeSnER3E+iauE40w8BQYQN4OW2pbCA6XKEKL0CsuSeHFvaIaSh3nfrHhrNNxm+032rWBb875czJMN18qtS6Qxz9yepLRlNRfPR9ijsYrS/0vdlmCghO78RZ5n3y7t2pswd1TR2Ydm0KxZ+hcVE6/YzeJ1xHDN3vxHpKFL92/TsXVK7KlN3N4Ol/v+/FXmPYtG01d4Vw2fe6vu+jh9CK7NwaQcsPWsm2Dt21XVegVl6TxdttgHMJD+DZp6Ljtqd7eN8aUY6x0RFq4LcamjtS2DT6ZS6AvIhFYcQoPDiWOOesIYdoXo6Fvf6Slfd24z/MWW0ox5whjmlBtxfCY7qdsbJu/h1gM3fHTZnC+JxhwcTeDqdKuv2/S+rSWfaLxiFzG3bIyruM1abzo6mwD1uLLB7yTtvhWrjNsaaM3kj5oc8JdiWbl3Xt5F8LtV+6F9B+QAfyu42IxPt5uO2oavO4jsoun/nF3Y7bRYttWNsbOjn6WtsbRveF3HfEVTneYTeI3ZD8RXtfQKxguyHhA3BJuBofT9AmDw+Tm9Yyxc3DC7kEXQ+TVZXhLYyRZQOpUMQ78dx27LaP0lhdHfrh6o/UBZjFz19p/Z9HoMoMPoHTtpP9IGMAP0ePbVt3HqFdLc03TI/wQfQq8dGStnuHt3VXlWvWPuxuzi0N9i4WnNtiSIj0VTeToM+p3bZhHR7drumLADmG3bQq8LZjfqZAiApIbo75x3TH7YfQJJDlmG1RsmaZzCGc4Ojd2wdLZ++EMb7AExmZs/F8rphwKFUC8in01JaZgCQPCgDAgDAgDwoAwIAwIA8KAMCAMPHUG/gKC0oz7fm25ogAAAABJRU5ErkJggg==", "content_type": "image/png"}';
30423044
const notificationCreateModel = {
@@ -3055,6 +3057,7 @@ describe('EventNotificationsV1_integration', () => {
30553057
ibmentemplates: JSON.stringify([slackTemplateID]),
30563058
ibmensubject: 'certificate expire',
30573059
ibmenhtmlbody: htmlBody,
3060+
ibmenmarkdown: markdownContent,
30583061
ibmenpushto: JSON.stringify(notificationFcmDevicesModel),
30593062
ibmenfcmbody: JSON.stringify(notificationFcmBodyModel),
30603063
ibmenapnsbody: JSON.stringify(notificationApnsBodyModel),

test/unit/event-notifications.v1.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ describe('EventNotificationsV1', () => {
252252
ibmenhtmlbody: 'testString',
253253
subject: 'testString',
254254
ibmenmms: 'testString',
255+
ibmenmarkdown: 'testString',
255256
data: { foo: 'bar' },
256257
datacontenttype: 'application/json',
257258
ibmenpushto:

0 commit comments

Comments
 (0)