N
Novu•16mo ago
rajat

Is there an API to bulk-delete workflows?

I have tests that create workflows and it would be great for to bulk-delete them in the cases where my cleanup step does not run successfully
7 Replies
Tomer Barnea
Tomer Barnea•16mo ago
@Pawan Jain can you help here?
Pawan Jain
Pawan Jain•16mo ago
hi @rajat5885 If you are using in-app notifications, then we have useRemoveAllNotifications hook to bulk delete all in-app messages together https://docs.novu.co/notification-center/react/api-reference#useremoveallnotifications Currently, we don't have a similar endpoint for other channel messages (notifications)
rajat
rajatOP•16mo ago
hey Pawan - I'm referring to workflows (previously known as notification templates.) Not notifications themselves
sumitsaurabh927
sumitsaurabh927•16mo ago
Hey @rajat5885 the only way I could see of bulk deleting workflows is to loop over this somehow:
import fetch from 'node-fetch';

const response = await fetch('https://api.novu.co/v1/workflows/:workflowId', {
method: 'DELETE',

});

const data = await response.json();
import fetch from 'node-fetch';

const response = await fetch('https://api.novu.co/v1/workflows/:workflowId', {
method: 'DELETE',

});

const data = await response.json();
Pawan Jain
Pawan Jain•16mo ago
Hi @rajat5885 Sorry I misunderstood your question We currently don't have bulk deletion api for workflows Only way is to delete them one by one 🙂
todd
todd•16mo ago
If you are interested in various solutions to this problem, go take a look at the novu-dotnet library. In particular, the Sync library mirrors environments and has to deal with deletions. Also the integration tests clean up after themselves. https://github.com/novuhq/novu-dotnet/blob/main/src/Novu.Tests/AcceptanceTests/SyncEnvironmentTests.cs
rajat
rajatOP•16mo ago
thanks! this is helpful
Want results from more Discord servers?
Add your server