diff --git a/awxkit/awxkit/api/pages/notification_templates.py b/awxkit/awxkit/api/pages/notification_templates.py index 24cd404658..6c080bd0fc 100644 --- a/awxkit/awxkit/api/pages/notification_templates.py +++ b/awxkit/awxkit/api/pages/notification_templates.py @@ -48,7 +48,7 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base): except (exc.MethodNotAllowed): pass - def payload(self, organization, notification_type='slack', **kwargs): + def payload(self, organization, notification_type='slack', messages=not_provided, **kwargs): payload = PseudoNamespace( name=kwargs.get('name') or 'NotificationTemplate ({0}) - {1}' .format( notification_type, @@ -56,6 +56,8 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base): description=kwargs.get('description') or random_title(10), organization=organization.id, notification_type=notification_type) + if messages != not_provided: + payload['messages'] = messages notification_configuration = kwargs.get( 'notification_configuration', {}) @@ -129,6 +131,7 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base): description='', notification_type='slack', organization=Organization, + messages=not_provided, **kwargs): if notification_type not in notification_types: raise ValueError( @@ -140,6 +143,7 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base): notification_type=notification_type, name=name, description=description, + messages=messages, **kwargs) payload.ds = DSAdapter(self.__class__.__name__, self._dependency_store) return payload @@ -150,12 +154,14 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base): description='', notification_type='slack', organization=Organization, + messages=not_provided, **kwargs): payload = self.create_payload( name=name, description=description, notification_type=notification_type, organization=organization, + messages=messages, **kwargs) return self.update_identity( NotificationTemplates(