Closed krissus closed 3 months ago
Liquid uses specialized models, e.g. this one: https://github.com/notifo-io/notifo/blob/main/backend/src/Notifo.Domain/Liquid/LiquidNotification.cs
So I think you are true, that custom properties are not part of that yet. But it should be easy to change.
I think that Property options can work, but here https://github.com/notifo-io/notifo/blob/534ec69c09039bd5808641d17b378c0a627a3244/backend/src/Notifo.Domain/Liquid/LiquidContext.cs#L60C1-L60C75
code is converting values from the Properties dictionary to notification.custom.{key}
and IMO the Liquid cannot convert variable on template ie. notification.custom.myVariable
because it's searching for the object: notification -> custom -> myVariable.
When I've changed from notification.custom.{key}
to notification_custom_{key}
and in template I'm using ie. {{ notification_custom_myVariable }}
I see the variable that I've sent during the event was created.
Request - api/apps/00000000-0000-0000-0000-000000000000/events
{
"requests": [
{
"topic": "users/6606axxxd1a0",
"creatorId": "6606axxxx2d1a0",
"settings": {
"email": {
"send": "Send",
"condition": "Always",
"template": "KK-Test-email-template"
},
"webpush": {
"send": "Inherit",
"condition": "Inherit"
},
"webhook": {
"send": "Inherit",
"condition": "Inherit"
}
},
"preformatted": {
"subject": {
"en": "EN subject - {{ notification.custom.myVariable }}"
},
"body": {
"en": "EN subject - {{ notification.custom.email_title }}"
},
"test":{
"en": "To jest test property TEST EN"
},
"confirmMode": "None"
},
"properties": {
"myVariable": "This is myVariable 2",
"email_id": "emailid2@domain.com",
"support_contact_no": "support-email2@support-contact-no.com",
"email_title": "This is my Title2"
},
"scheduling": {
"type": "UTC",
"time": "00:00:00"
},
"data":"",
"silent": false,
"test": false
}
]
}
Email template
<mj-text>
EN Dear {{ user.fullname | default: 'User' }} <br />
<br />
Custom_MyVariable {{ notification_custom_myVariable }} <br />
WORKING Section <br />
OLD Custom_MyVariable {{ notification.custom.myVariable }} <br />
Custom_MyVariable {{ notification_custom_myVariable }} <br />
Custom Support Contact Number: {{notification_custom_support_contact_no}} <br />
Custom Email ID {{notification_custom_email_id}} <br />
Custom Email Title {{notification_custom_email_title}} <br />
<br />
<br />
<br />
</mj-text>
Last email what I've received
EN Dear KK
Custom_MyVariable This is myVariable 2
WORKING Section
OLD Custom_MyVariable
Custom_MyVariable This is myVariable 2
Custom Support Contact Number: support-email2@support-contact-no.com
Custom Email ID emailid2@domain.com
Custom Email Title This is my Title2
So I don't know if the switching from .
to _
here won't destroy other features. What do you think @SebastianStehle ?
I think I will have to write a test for that. But you are probably right
I have published an update for that.
Hi, I've started using email templates with Notifo.... but I'm facing and issue that the custom properties inside the email template are not replaced with the dynamic value. To check what is going on I've check on the templates what kind of the data I can use like below
and I'm getting some information but I can't see properties values which was send by creating an event
Properties from the event
And what I see when I try to debug on UI
Maybe I've configured system wrongly but I can't present custom properties on email templates. Could you help with this? Currently I've installed versiion from main branch.