novu icon indicating copy to clipboard operation
novu copied to clipboard

🚀 Feature: Make an Endpoint for Handlebars Interpolation Using Existing Templates

Open Khongchai opened this issue 1 year ago • 0 comments

🔖 Feature description

We have a panel where the admin can create different types of announcements. These announcements are tied to different workflows, and each of them have their own custom handlebars in app template. Some are cosmetically complex. It'd be nice to have an endpoint that we can just call to have the templating engine on novu backend do the interpolation and return the resulting html back. Something like this:

🎤 Why is this feature needed ?

Right now, we have to manually find the template by getting the entire detail of a workflow, then look for a specific step, extract out the handlebars template and then on our react admin panel, use the data input by the admin and interpolate using the handlebars package.

✌️ How do you aim to achieve this?

To have a new endpoint specifically for previewing things. A possible interface in the sdk might be:

novu.workflows.previewTemplate({
    name: workflowName,
    payload: {
          announcementName, 
          announcementDescription,
    },
    step: 1,  
});

The endpoint returns a string representing the interpolated content using the handlebars template and the given payload of the specified workflow and step.

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

Khongchai avatar Dec 10 '23 06:12 Khongchai