/v1/workspaces/{workspace_id}/notification-types/{type_id}/previewAuthPreview a notification type
Renders every routed channel with sample `data`, or as a real `recipient` (its locale: exact, then language, then the type default; its fields as `recipient.*`). Reports missing variables per channel and variables some channels use but others do not. Sends nothing.
Path parameters
workspace_id*string · uuidId of the workspace.
type_id*string · uuidId of the type.
Request body
dataobjectSample `data`, as a send would pass it (keys kept as sent). At most 16 KB.
Example: {"amount":"12.00","invoice_id":"inv_123"}
recipientstringRender as this recipient (its locale chain and fields under `recipient.*`). Nothing is sent.
Example: "user_123"
localestringLocale to render when no recipient is given (or to override it).
Example: "pt-PT"
Response · 200 The rendered channels.
channels*arrayOne entry per routed channel.
cross_channel_mismatches*objectVariables used by some channels but not others: variable → the channels missing it.
Example
Request
POST https://api.notify.productcraft.co/v1/workspaces/{workspace_id}/notification-types/{type_id}/preview
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"data": {
"amount": "12.00",
"invoice_id": "inv_123"
},
"recipient": "user_123",
"locale": "pt-PT"
}import { Notify } from "@productcraft/notify";
// Reads PRODUCTCRAFT_API_KEY and PRODUCTCRAFT_WORKSPACE_ID from the environment;
// client routes take a recipient token: notify.client({ token })
const notify = new Notify();
const preview = await notify.notificationTypes.preview("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { data: { amount: "12.00", invoice_id: "inv_123" } });notify.notificationTypes.preview(typeId, params?, options?): Notify.Preview
Response
{
"channels": [
{
"channel": {},
"locale": "string",
"rendered": {},
"missing_variables": [
"string"
],
"warnings": [
"string"
]
}
],
"cross_channel_mismatches": {}
}