Create notification template api is failing
prathapbelli opened this issue · 1 comments
prathapbelli commented
here my code its failing to create notification template, please help if i missed anything here
getting this error
File "/Users/prathapa.belli/hotelsoft/repositories/jeeves-app/app/cli/t_novu.py", line 129, in create_novo_notification_workflow
res = novu_client.create(notification_template=notification_template)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/prathapa.belli/.virtualenvs/jeeves-test-app3.11/lib/python3.11/site-packages/novu/api/notification_template.py", line 58, in create
self.handle_request("POST", self._notification_template_url, notification_template.to_camel_case())["data"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/prathapa.belli/.virtualenvs/jeeves-test-app3.11/lib/python3.11/site-packages/novu/api/base.py", line 89, in handle_request
res.raise_for_status()
File "/Users/prathapa.belli/.virtualenvs/jeeves-test-app3.11/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url:
steps and preference settings will be optional as default values provided in NotificationTemplateFormDto class
def create_novo_notification_workflow():
General_gropup_id ="frgtger245466"
notification_template = NotificationTemplateFormDto(
name="test by prathap2",
active=True,
tags=[],
notification_group_id=General_gropup_id,
description="sample description",
critical=False,
draft=False,
)
novu_client = NotificationTemplateApi(url=novu_url, api_key=novu_api_key)
res = novu_client.create(notification_template=notification_template)
return res
prathapbelli commented
I found solution that we need to explicitly pass preference_settings
and steps
as dict and list then it will take default value for preference_settings.
preference_settings={},
steps=[]