N
Novu•13mo ago
empe

How to create a notification template for a topic?

Where I set the topic's notification template?
18 Replies
Pawan Jain
Pawan Jain•13mo ago
You don't need a separate template for topic You can you same notification template
empe
empe•13mo ago
wdym?
Pawan Jain
Pawan Jain•13mo ago
You can any templates listed here https://web.novu.co/templates
Novu Manage Platform
Novu Manage Platform
empe
empe•13mo ago
How?
Pawan Jain
Pawan Jain•13mo ago
You want to trigger notification to a topic?
empe
empe•13mo ago
Yes
Gali Baum
Gali Baum•13mo ago
novu.trigger('delay6', {
to: [{
type: 'Topic', topicKey: 'delay2-topic-identifier'
}],
payload: {
name: '7'
}
});
}
novu.trigger('delay6', {
to: [{
type: 'Topic', topicKey: 'delay2-topic-identifier'
}],
payload: {
name: '7'
}
});
}
Pawan Jain
Pawan Jain•13mo ago
Here delay6 is templateId
Gali Baum
Gali Baum•13mo ago
delay6 can be any trigger identifier of your templates
empe
empe•13mo ago
wow I've no idea of how I would come to realize this using the docs I'm like rereading this for several times already and it's not plain to understand at all 😅 btw still having trouble 😦
Pawan Jain
Pawan Jain•13mo ago
Lets join over screen share @emilpearce
empe
empe•13mo ago
Let me try one more thing The "delay6" = template identifier?
Pawan Jain
Pawan Jain•13mo ago
yes
empe
empe•13mo ago
That what was confusing Can we change that in the docs?
Pawan Jain
Pawan Jain•13mo ago
<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL> you mean this?
empe
empe•13mo ago
const topicKey = 'posts:comment:12345';

await novu.trigger('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>', {
to: [{ type: 'Topic', topicKey: topicKey }],
payload: {},
});
const topicKey = 'posts:comment:12345';

await novu.trigger('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>', {
to: [{ type: 'Topic', topicKey: topicKey }],
payload: {},
});
to
const topicKey = 'posts:comment:12345';

await novu.trigger('<REPLACE_WITH_NOTIFICATION_TEMPLATE_IDENTIFIER>', {
to: [{ type: 'Topic', topicKey: topicKey }],
payload: {},
});
const topicKey = 'posts:comment:12345';

await novu.trigger('<REPLACE_WITH_NOTIFICATION_TEMPLATE_IDENTIFIER>', {
to: [{ type: 'Topic', topicKey: topicKey }],
payload: {},
});
Pawan Jain
Pawan Jain•13mo ago
thanks
empe
empe•13mo ago
Any time bro