Novu workflow is sending a payload but headless never gets the data...

Sending:
curl -X POST 'https://api.novu.co/v1/events/trigger' \
-H 'Authorization: ApiKey NOVU_SECRET_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "test-function",
"to": {
"subscriberId": "080808"
},
"payload": {
"type": "function.done",
"message": "Test function,
"successes": "4"
}
}
Sending:
curl -X POST 'https://api.novu.co/v1/events/trigger' \
-H 'Authorization: ApiKey NOVU_SECRET_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "test-function",
"to": {
"subscriberId": "080808"
},
"payload": {
"type": "function.done",
"message": "Test function,
"successes": "4"
}
}
Receiving:
{
data: {
hasMore: false,
filter: { read: false },
notifications: [
Notification {
id: '6756f354499a750e14ee5aba',
subject: undefined,
body: 'Test function',
to: {
id: '090809',
subscriberId: '080808'
},
isRead: false,
isArchived: false,
createdAt: '2024-12-09T13:40:36.828Z',
readAt: undefined,
archivedAt: undefined,
avatar: undefined,
primaryAction: undefined,
secondaryAction: undefined,
channelType: 'in_app',
tags: [],
redirect: undefined,
data: undefined
}
]
}
}
Receiving:
{
data: {
hasMore: false,
filter: { read: false },
notifications: [
Notification {
id: '6756f354499a750e14ee5aba',
subject: undefined,
body: 'Test function',
to: {
id: '090809',
subscriberId: '080808'
},
isRead: false,
isArchived: false,
createdAt: '2024-12-09T13:40:36.828Z',
readAt: undefined,
archivedAt: undefined,
avatar: undefined,
primaryAction: undefined,
secondaryAction: undefined,
channelType: 'in_app',
tags: [],
redirect: undefined,
data: undefined
}
]
}
}
Why the data is undefined? we are fetching through the latest headless with @novu/js using novuClient.notifications.list
5 Replies
iStun4Fun
iStun4FunOP2w ago
any clues @Support @Pawan Jain i changed this that couldnt be find in the docs... before i was sending only the body payload.message and it was read right by the client @novu/headless
export const progressUpdate = workflow(
"progress-update",
async ({ step, payload }) => {
await step.inApp(
"inbox",
async () => {
return {
body: `${payload.message}`,
// new part:
data: {
thing1: payload.thing1,
param2: payload.param2,
type: payload.type,
message: payload.message
}
};
},
);
},
{
payloadSchema,
}
);
export const progressUpdate = workflow(
"progress-update",
async ({ step, payload }) => {
await step.inApp(
"inbox",
async () => {
return {
body: `${payload.message}`,
// new part:
data: {
thing1: payload.thing1,
param2: payload.param2,
type: payload.type,
message: payload.message
}
};
},
);
},
{
payloadSchema,
}
);
Pawan Jain
Pawan Jain2w ago
@iStun4Fun This is expected behavior. payload key-value pairs are not sent as Notification item response. in-app step data field can have any key-value pairs
rexchoppers
rexchoppers3d ago
@Pawan Jain I’m having something similar happen. My API (C#) sends an event, Novu processes this but no payload data is returned when I use Headless notifications.list. Not even an event type. I assume this is expected behaviour from Novu? If so my only alternative will be to use server side rendered notifications instead Workflows are created manually in Novu too I've just seen this:
Our team has decided to include separate data field in dashboard where custom key-value pairs can be defined and values of those keys can be sent via payload.

later, when notifications are fetched in headless mode, data field will return those values
Our team has decided to include separate data field in dashboard where custom key-value pairs can be defined and values of those keys can be sent via payload.

later, when notifications are fetched in headless mode, data field will return those values
So that answers my qwuestion
Pawan Jain
Pawan Jain21h ago
Thanks for the update @rexchoppers Can I help with anything else? Are you using @novu/headless or @novu/js
rexchoppers
rexchoppers21h ago
All good @Pawan Jain keep up the great work. I’m using Novu headless for my front end application (This is in angular)
Want results from more Discord servers?
Add your server