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
@Sapar I see this is also working with api
@Pawan Jain what do you mean?
Do you mean api is working if I use underscores?
I see it is working perfectly fine in our web UI also
@Pawan Jain no, the problem is not about creating a workflow
the problem is about triggering a nevent using that workflow
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
@Pawan Jain I followed the documentation
What do you see in trigger identifier field of the workflow you created, similar to this image
newselleradminnotifyfour
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?
@Pawan Jain is it possible to set UNDERSCRORES IN the identifier?
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