Type cannot be null or undefined

headers = { 'Authorization': f'ApiKey {api_key}', 'Content-Type': 'application/json' } payload = { "notificationGroupId": "507f1f77bcf86cd799439014", "name":"email-workflow", "steps": [ { "type": "custom", "template": { "subject": "Welcome!", "body": "Thank you for signing up." }, "recipient": "[email protected]", "filters": [ { "property": "user.role", "operator": "equals", "value": "new_user" } ], "variant": { "variantName": "New User Welcome Email", "variantId": "507f1f77bcf86cd799439011" } },
],
} response = requests.post('https://api.novu.co/v1/workflows', headers=headers, json=payload) Im new to novu workflows, i'm trying to create a workflow using the above code,and im getting this error when i run this code Error: Failed to create workflow: 400 {'message': ['type should not be null or undefined', 'type must be one of the following values: in_app, email, sms, chat, push, digest, trigger, delay, custom'], 'error': 'Bad Request', 'statusCode': 400}
19 Replies
Pawan Jain
Pawan Jain4mo ago
@Guna Vardhan I see you are trying to create a new workflow using code Did you get a change to try novu v2 (code based workflow approach)?
Guna Vardhan
Guna VardhanOP4mo ago
from the api reference of the novu documentation?
Guna Vardhan
Guna VardhanOP4mo ago
tried it the next js application is not getting connected to the bridge endpoint
Pawan Jain
Pawan Jain4mo ago
please share the error screenshot
Guna Vardhan
Guna VardhanOP4mo ago
okay But can you tell me what's going wrong with the code above?
Pawan Jain
Pawan Jain4mo ago
steps": [ { "type": "custom", here custom is not supported with novu v1
Guna Vardhan
Guna VardhanOP4mo ago
even if i use email or sms im getting same error i have set up the next js application
Novu_Bot
Novu_Bot4mo ago
@Guna Vardhan, you just advanced to level 1!
Guna Vardhan
Guna VardhanOP4mo ago
can you help me what to do next?
No description
No description
Dima Grossman
Dima Grossman4mo ago
@Guna Vardhan is your application running on port 4000 ? also, do you have your second terminal still running? (npx novu dev)
Guna Vardhan
Guna VardhanOP4mo ago
yes
Dima Grossman
Dima Grossman4mo ago
Could you share a photo of the npx novu@latest dev command in your terminal?
Guna Vardhan
Guna VardhanOP4mo ago
okay
Guna Vardhan
Guna VardhanOP4mo ago
No description
Dima Grossman
Dima Grossman4mo ago
Tahnk you! I was able to replicate this with brave browser do you by chance can try this on chrome? meanwhile we check the issue with Brabe
Guna Vardhan
Guna VardhanOP4mo ago
sure thanks when i tried to test workflow i'm getting status 500 in chrome
Dima Grossman
Dima Grossman4mo ago
can you try copying your "Tunnel" url from the cli and making a request to: https://YOUR_TUNNEL.novu.sh/api/novu?action=health-check
Guna Vardhan
Guna VardhanOP4mo ago
its working thanks!
Want results from more Discord servers?
Add your server