N
Novuβ€’10mo ago
todd

Default layout on email step when created through API

Through the API, when I create a workflow with an email step, the default layout is not set as the layout for that step. More technically, the step returns a _layoutId as null. A look at the source code confirms that behaviour as much as I could tell. Is this what is expected/desired? I have follow thoughts, but just want to confirm that first. A general comment is that the Web client seems to overlay functionality/lifecycle management that I would have thought could/should be in the API. This makes it harder to understand particularly as I am trying to help maintain a client SDK (and looking to build a terraform provider).
7 Replies
Pawan Jain
Pawan Jainβ€’10mo ago
Hi @todd7201 I agree with you πŸ™‚ In UI we first call all existing layouts, show them in drop-down. Once user select item from drop down that layout id is selected To replica this via api, you will have to first call the get layouts api I hope it helps πŸ™
todd
toddβ€’10mo ago
@Pawan Jain Thanks, that is what I am doing. I will note that this exposes a defect in the UI. When the Step has no layoutId on an email, the displayed layout (on the UI) is the default layout but it actually isn't set. If you click on the drop-down it then works out that it isn't set. This got me for a while because the email was being generated without the default layout. Also, if I'm right through the UI you have to have a layout when programmatically you don'tβ€”and I can see cases to not have a layout πŸ™‚ Cheers.
Novu_Bot
Novu_Botβ€’10mo ago
@todd7201, you just advanced to level 2!
Pawan Jain
Pawan Jainβ€’10mo ago
Thanks @todd7201 I see we should use default layout if no layoutid provided
todd
toddβ€’10mo ago
@Pawan Jain I may not πŸ™‚ [sorry, a bit late here] If you are meaning at the UI-level in the web interface, sure, go ahead! Certainly, at worst ensure that the UI aligns with the data. Partly here you will need to retrofit for cases where there is no default. On the API, I wouldn't default values because generally that's not very REST. If I do a PUT then I don't expect you to mutate the resource (because I would expect the same resource back) and defaulting values should be provided to the client to include in the first place (which often also means breaking up resources). Put differently, if you want to default a value then you should make sure it is provided in the POST or PUT resource. It's not a hard problem to solve but one that the current API isn't looking to address and hence these problem leak into the solution (IMHO).
Pawan Jain
Pawan Jainβ€’10mo ago
If you are meaning at the UI-level in the web interface, sure, go ahead! Certainly, at worst ensure that the UI aligns with the data. Partly here you will need to retrofit for cases where there is no default.
Currently, we create a layout by default in each organisation. We set that layout as default. Default layout cannot be deleted. So there will always be a default layout present in each organisation.
Want results from more Discord servers?
Add your server
More Posts
Self-Hosted Reverse Proxy WEB_CONTEXT_PATHThe WebContextPath does not seem to be working i want the web client to resolve to https://domainamegroup notificationsIs it possible to create a group for the notifications? examples :System Updates (Please login as yoHow to add a slack workflowI have been trying to add a slack provider, I have tried to click the button at the bottom several tSelf hosted custom SMTP configuration with self signed certHaving configured a custom SMTP endpoint in Novu 0.18.0 we are getting errors due to the use of a seTriggered notification returned 201 but did not receive anything nor it showed in the activity feedWhile I was testing the REST API for triggering fcm notifications (via Postman), there's a particulaSelf Hosting on Kubernetes with runAsNonRoot: true optionI would like to host Novu on a Kubernetes environment using the Novu Docker images. I am using the How do I send a notification based on subscriber activity?Essentially I want to create a workflow where a push notification is sent to a subscriber. And then What is the best way to remove a single deviceToken from a subscriber that has several deviceTokensHi, I just want to confirm what is the current best way to delete only specific tokens from the arraWhat is a Template in Subscriber preference and where can I get the template IDI am using Self hosted version of Novu with .net I am trying to set Notification preferences for a sNetwork error while registeringHello. I have problem with self-hosted service. When I'm trying to register UI shows Network Error.