@@ -108,6 +108,12 @@ SDK Methods to consume
108108 - [Update Destination](#update-destination)
109109 - [Delete Destination](#delete-destination)
110110 - [ Custom Domain_Name_verification] ( #custom-domain-name-verification )
111+ - [ Templates] ( #templates )
112+ - [Create Template](#create-template)
113+ - [List Templates](#list-templates)
114+ - [Get Template](#get-template)
115+ - [Update Template](#update-template)
116+ - [Delete Template](#delete-template)
111117- [ Push Destination APIs] ( #push-destination-apis )
112118 - [Create Destination tag subscription](#create-destination-tag-subscription)
113119 - [List Destination tag subscription](#list-destination-tag-subscription)
@@ -482,6 +488,106 @@ const updateSpfVerifyDestinationParams = {
482488 console .warn (err);
483489 }
484490```
491+
492+ ## Templates
493+
494+ Template is a pre-defined layout, that may include content like images, text and dynamic content based on event. Rather than creating a new content from scratch each time, you can use a template as a base and configure them in subscription.
495+ supports the following templates:
496+
497+ - Custom Email notification
498+ - Custom Email invitation
499+
500+ ### Create Template
501+ ``` js
502+ const templateConfigModel = {
503+ params: {
504+ body: ' <!DOCTYPE html><html><head><title>IBM Event Notifications</title></head><body><p>Hello! Invitation template</p><table><tr><td>Hello invitation link:{{ ibmen_invitation }} </td></tr></table></body></html>' ,
505+ subject: ' Hi this is invitation for invitation message' ,
506+ },
507+ };
508+ let createTemplateParams = {
509+ instanceId: < instance- id> ,
510+ name: < template- name> ,
511+ type: < template- type> ,
512+ templateConfigModel,
513+ description: < template- description> ,
514+ };
515+ let createTemplateResult;
516+ try {
517+ createTemplateResult = await eventNotificationsService .createTemplate (createTemplateParams);
518+ console .log (JSON .stringify (createTemplateResult .result , null , 2 ));
519+ } catch (err) {
520+ console .warn (err);
521+ }
522+ ```
523+ ### List Templates
524+ ``` js
525+ const params = {
526+ instanceId: < instance- id> ,
527+ };
528+
529+ let res;
530+ try {
531+ res = await eventNotificationsService .listTemplates (params);
532+ console .log (JSON .stringify (res .result , null , 2 ));
533+ } catch (err) {
534+ console .warn (err);
535+ }
536+ ```
537+
538+ ### Get Template
539+ ``` js
540+ const params = {
541+ instanceId: < instance- id> ,
542+ id: < template- id> ,
543+ };
544+
545+ let res;
546+ try {
547+ res = await eventNotificationsService .getTemplate (params);
548+ console .log (JSON .stringify (res .result , null , 2 ));
549+ } catch (err) {
550+ console .warn (err);
551+ }
552+ ```
553+
554+ ### Update Template
555+ ``` js
556+ const templateConfigModel = {
557+ params: {
558+ body: ' <!DOCTYPE html><html><head><title>IBM Event Notifications</title></head><body><p>Hello! Invitation template</p><table><tr><td>Hello invitation link:{{ ibmen_invitation }} </td></tr></table></body></html>' ,
559+ subject: ' Hi this is invitation for invitation message' ,
560+ },
561+ };
562+ let updateTemplateParams = {
563+ instanceId: < instance- id> ,
564+ name: < template- name> ,
565+ type: < template- type> ,
566+ templateConfigModel,
567+ description: < template- description> ,
568+ };
569+ let updateTemplateResult;
570+ try {
571+ updateTemplateResult = await eventNotificationsService .updateTemplate (updateTemplateParams);
572+ } catch (err) {
573+ console .warn (err);
574+ }
575+ ```
576+
577+ ### Delete Template
578+ ``` js
579+ const params = {
580+ instanceId: < instance- id> ,
581+ id: < template- id> ,
582+ };
583+
584+ try {
585+ await eventNotificationsService .deleteTemplate (params);
586+ } catch (err) {
587+ console .warn (err);
588+ }
589+ ```
590+
485591## Push Destination APIs
486592
487593### Create Destination tag subscription
0 commit comments