N
Novu4mo ago
Sapar

Cannot create a workflow through API

I'm using the code in my app: $novu = new Novu(<NOVU_API_KEY>); $novu->createNotificationTemplate([ [ 'name' => 'new_seller_admin_notify', 'notificationGroupId' => '65d88e638b742c73124b6c23', 'active' => true 'preferenceSettings' => [ 'email' => true, 'sms' => true, 'in_app' => true, 'chat' => true, 'push' => true, ], 'steps' => [ [ 'template' => [ "title" => "wellness_course_started_title", "content" => [ [ "type" => "text", "content" => "Hello admins!<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" => "Le Paniew Blue", "variables" => [ [ "name" => "name", "type" => "String" ], [ "name" => "sellerEmail", "type" => "String" ] ] ], ], ] ] ]); I am getting an error: [2024-02-23 12:49:49] local.ERROR: [NovuService]:createNotificationTemplate ["{"message":["active must be a boolean value"],"error":"Bad Request","statusCode":400}"] BUT, I set 'active' => true.
10 Replies
Novu_Bot
Novu_Bot4mo ago
@Sapar, you just advanced to level 3!
Sapar
Sapar4mo ago
If remove the parameter 'active' => true, the workflow is created succesfully, but it is INACTIVE, so I need to open my web-dashboard and activate it manually.
Pawan Jain
Pawan Jain4mo ago
@Sapar did you try sending false value to active field
Sapar
Sapar4mo ago
Yes I tried @Pawan Jain . The same error. [2024-02-26 07:13:40] local.ERROR: [NovuService]:createNotificationTemplate ["{"message":["active must be a boolean value"],"error":"Bad Request","statusCode":400}"]
Pawan Jain
Pawan Jain4mo ago
@Sapar I see api is working as expected Let me check if there is some issue in SDK Is above code for laravel/php sdk?
Sapar
Sapar4mo ago
@Pawan Jain , no, this is for use Novu\SDK\Novu; "unicodeveloper/novu": "^1.1" Can anyone help with that?
Pawan Jain
Pawan Jain4mo ago
@unicodeveloper
Could you please help us
Prosper
Prosper4mo ago
@Sapar @Pawan Jain I will check that this morning It should work as intended. Give me some time to double check
Sapar
Sapar4mo ago
Is it possible to fix? ?
Prosper
Prosper4mo ago
I just confirmed that this is indeed happening I am trying to see what's wrong Because the whole data payload is simply been passed to the API