N
Novu10mo ago
Sapar

Cannot use a workflow if its name has underscores

I've created a workflow through API with following params: $data = [ 'name' => 'new_seller_admin_notify_four', 'notificationGroupId' => '6409c0dbe5d10c2178942e3f', 'preferenceSettings' => [ 'email' => true, 'sms' => true, 'in_app' => true, 'chat' => true, 'push' => true, ], 'steps' => [ [ 'template' => [ "title" => "new_seller_admin_notify", "content" => [ [ "type" => "text", "content" => "Hello adminss!<div>New seller has been registered!</div><div>Name: {{name}}</div><div>Email: {{sellerEmail}}</div>", "styles" => [ "textAlign" => "left" ] ] ], "type" => "email", "subject" => "New Seller", "contentType" => "editor", "senderName" => "Chester field", "variables" => [ [ "name" => "name", "type" => "String" ], [ "name" => "sellerEmail", "type" => "String" ] ] ], ], ] ] When I trigger event using this workflow, I'm getting an error: [2024-02-26 07:25:17] local.ERROR: [NovuService]:sendNotificationToTopics ["The given data failed to pass validation."] If I replace underscores with dashes, an event is triggered successfully. new_seller_admin_notify_four change to new-seller-admin-notify-four
14 Replies
Pawan Jain
Pawan Jain10mo ago
@Sapar I see this is also working with api
Sapar
SaparOP10mo ago
@Pawan Jain what do you mean? Do you mean api is working if I use underscores?
Pawan Jain
Pawan Jain10mo ago
I see it is working perfectly fine in our web UI also
No description
Sapar
SaparOP10mo ago
@Pawan Jain no, the problem is not about creating a workflow the problem is about triggering a nevent using that workflow
Pawan Jain
Pawan Jain10mo ago
Sorry, Now I see problem is with trigger Just to double check, workflow name and workflow trigger identifier are different. workflow trigger identifier is used to trigger the workflow
Sapar
SaparOP10mo ago
@Pawan Jain I followed the documentation
Sapar
SaparOP10mo ago
No description
Pawan Jain
Pawan Jain10mo ago
What do you see in trigger identifier field of the workflow you created, similar to this image newselleradminnotifyfour
Sapar
SaparOP10mo ago
If I set the name WITH DASHES, it sets the identifier WITH DASHES, but if I set the name WITH UNDERSCRORES, it is just REMOVING THE UNDERSCORES in the identifier. how?
Sapar
SaparOP10mo ago
No description
Sapar
SaparOP10mo ago
@Pawan Jain is it possible to set UNDERSCRORES IN the identifier?
Pawan Jain
Pawan Jain10mo ago
We are sanitizing the name, you can update the identifier as well later let me check if it can be specified while creating the workflow I see it can not be set during creation of workflow We create it using slugify npm package https://github.com/novuhq/novu/blob/next/apps/api/src/app/workflows/usecases/create-notification-template/create-notification-template.usecase.ts#L52
Want results from more Discord servers?
Add your server