Invoice Receipt
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
Invoice Receipt
Send invoices or receipts immediately after a user purchases
Intro
Invoices and receipts require custom fields such as the order number, billing details, and objects purchased which must be dynamically fetched from the database. The use of step controls and the payload schema simplifies the fetching of that unique data.
Explore the source code on GitHub
Preview
Code Example
import { workflow } from '@novu/framework';
import { renderAppleReceiptEmail } from '../emails/apple-receipt';
import { zodControlSchema, jsonSchema, zodPayloadSchema } from './schemas';
/**
* Apple Receipt Workflow
*/
export const appleReceipt = workflow(
"Apple Receipt",
async ({ step, payload }) => {
await step.email(
"send-email",
async (controls) => {
return {
subject: controls.receiptSubject,
body: renderAppleReceiptEmail(controls, payload),
};
},
{
controlSchema: zodControlSchema
},
);
},
{
payloadSchema: zodPayloadSchema
}
);
Was this page helpful?
On this page