N
Novu10mo ago
empe

Where and how can I edit System Variables?

How can I effectively modify and incorporate new system variables, or simply variables, into Novu?
7 Replies
Pawan Jain
Pawan Jain10mo ago
@emilpearce There are 3 types of system variables 1. subscriber 2. step 3. branding 1. It depends on subscriber details, so to modify this we need to update the subscriber 2. this depends on digest events, so it depends on how many events the user has triggered and those events got digested. One can not directly modify these 3. branding related variables can be updated on brand page https://web.novu.co/brand
empe
empe10mo ago
Can I create more subscriber oriented variables? For example if my subscriber is on "A plan" or "B plan" Something like "{{subscriber.plan}}"
Pawan Jain
Pawan Jain10mo ago
You can use the data field. Data field is unstructured and does not have a fixed schema {{subscriber.data.plan}} https://docs.novu.co/platform/subscribers#subscriber-attributes
empe
empe10mo ago
If I introduce a new variable in my database like "plan" or "social security code", I could add it to my subscribers through the data object? Like so:
import { Novu } from '@novu/node';

const novu = new Novu('<NOVU_API_KEY>');

await novu.subscribers.identify('111', {
email: 'john.doe@domain.com',
firstName: 'John',
lastName: 'Doe',
phone: '+13603963366',
avatar: 'https://example.com/images/avatar.jpg',
locale: 'en',
data: { plan: 'Basic', social_security_code: '09287391827391782' },
});
import { Novu } from '@novu/node';

const novu = new Novu('<NOVU_API_KEY>');

await novu.subscribers.identify('111', {
email: 'john.doe@domain.com',
firstName: 'John',
lastName: 'Doe',
phone: '+13603963366',
avatar: 'https://example.com/images/avatar.jpg',
locale: 'en',
data: { plan: 'Basic', social_security_code: '09287391827391782' },
});
Pawan Jain
Pawan Jain10mo ago
Yes it will work
empe
empe10mo ago
And then use it when creating a notification?
Hello {{subscriber.firstName}}!

You have been upgraded to the {{subscriber.data.plan}} plan.

Have a nice day.
Hello {{subscriber.firstName}}!

You have been upgraded to the {{subscriber.data.plan}} plan.

Have a nice day.
Pawan Jain
Pawan Jain10mo ago
Yes you are correct