notifo-io / notifo

Multi channel notification service for collaboration tools, e-commerce, news service and more.
MIT License
758 stars 72 forks source link

a proper document #214

Open neginsadeghi opened 10 months ago

neginsadeghi commented 10 months ago

Hi, I want to use this system but I don't know how to create custom variables and feed them with values and ...

Is there any wiki/document that I could read and do it ?

SebastianStehle commented 10 months ago

Yes, Dokumentation is not existent. If you describe what you want to do I can probably help

neginsadeghi commented 10 months ago

I want to create an email template called template01, I want it to have a default text body and have some variable that I could feed them based on each event.

consider the following :

I want to use this system for a network monitoring system, I want to have these variables :

IP address, trigger, date, customer:

after feeding it would be :

Dear {{customer}} your IP is : {{IP}} and you triggered : {{trigger}} at date : {{date}}

see the link bellow xyz.com thanks

How can I create such template and how can I send emails with the template while feeding the values of variables ?

if you could tell me how can I do it using rest API, it would be great

Thanks

SebastianStehle commented 10 months ago

I would create the email template with the UI, because it is much easier. You will also see a few default placeholders being uses, e.g. the user.displayName and so on.

In general Notifo used Liquid / Fluid as a template engine and the following variables are available:

See https://github.com/notifo-io/notifo/blob/main/backend/src/Notifo.Domain/Liquid/LiquidContext.cs

The notifications have a property called "properties", which can be used to add user generated value to a notification.

From the perspective of the API you generate a new event using the following endpoint: https://app.notifo.io/api/docs/index.html?url=/api/openapi.json#tag/Events/operation/Events_PostEvents

This is then converted to a notification. But you have to remember to enable the email channel on the user level or notification level to do that.