Svelte E-mail
API Reference
Subscribers
- GETGet subscribers
- POSTCreate subscriber
- POSTBulk create subscribers
- GETGet subscriber
- PUTUpdate subscriber
- DELDelete subscriber
- PUTUpdate subscriber credentials
- DELDelete subscriber credentials by providerId
- PATCHUpdate subscriber online status
- GETGet subscriber preferences
- GETGet subscriber global preferences
- PATCHUpdate subscriber preference
- PATCHUpdate subscriber global preferences
- GETGet in-app notification feed for a particular subscriber
- GETGet the unseen in-app notifications count for subscribers feed
- POSTMark a subscriber feed message as seen
- POSTMarks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
- POSTMark message action as seen
- GETHandle providers oauth redirect
- GETHandle chat oauth
Topics
Notification
Workflows
Workflow Overrides
Workflow groups
Integrations
Layouts
Execution Details
Organizations
Svelte E-mail
Integrating Novu Framework with Svelte email for your Svelte application can be done in three steps. If you don’t have an app, you can clone our Svelte example.
1
Install Svelte email components
Install the required Svelte email components.
npm i svelte-email
2
Create email templates folder
Create an emails
folder in the src/lib
directory of your Svelte app.
3
Write your email
Create a new sample-email.svelte
file for your email template.
<script lang="ts">
import { Button, Container, Head, Hr, Html, Img, Preview, Section, Text } from 'svelte-email';
export let firstName = 'John';
const fontFamily =
'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif';
const main = {
backgroundColor: '#ffffff'
};
const container = {
margin: '0 auto',
padding: '20px 0 48px'
};
const logo = {
margin: '0 auto'
};
const paragraph = {
fontFamily,
fontSize: '16px',
lineHeight: '26px'
};
const btnContainer = {
textAlign: 'center' as const
};
const button = {
fontFamily,
backgroundColor: '#5F51E8',
borderRadius: '3px',
color: '#fff',
fontSize: '16px',
textDecoration: 'none',
textAlign: 'center' as const,
display: 'block'
};
const hr = {
borderColor: '#cccccc',
margin: '20px 0'
};
const footer = {
fontFamily,
color: '#8898aa',
fontSize: '12px'
};
</script>
<Html lang="en">
<Head />
<Preview preview="Welcome to svelte-email" />
<Section style={main}>
<Container style={container}>
<Img
src="https://svelte.dev/svelte-logo-horizontal.svg"
alt="Svelte logo"
style={logo}
width="200"
height="50"
/>
<Text style={paragraph}>{firstName}, welcome to svelte-email</Text>
<Text style={paragraph}>A Svelte component library for building responsive emails</Text>
<Section style={btnContainer}>
<Button pX={12} pY={12} style={button} href="https://github.com/carstenlebek/svelte-email">
View on GitHub
</Button>
</Section>
<Text style={paragraph}>Happy coding!</Text>
<Hr style={hr} />
<Text style={footer}>Carsten Lebek</Text>
</Container>
</Section>
</Html>
4
Write your workflow
Define your Workflow using the above template
import WelcomeEmail from '$lib/emails/sample-email.svelte';
import { render } from 'svelte-email';
import { workflow } from '@novu/framework';
workflow('new-signup', async ({ step, payload }) => {
await step.email(
'send-email',
async (inputs) => {
const html = render({
template: WelcomeEmail,
props: {
firstName: 'John',
},
});
return {
subject: `Welcome to Svelte E-mail`,
body: html,
}
});
}
);
Was this page helpful?