mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 20:07:37 -02:30
Notification serializers, views, and tasks
* Implement concrete Notification model for notification runs * Implement NotificationTemplate and Notification serializers and views * Implement ancillary views * Implement NotificationTemplate trigger m2m fields on all job templates via a fields mixin * Link NotificationTemplates with an org * Link notifications with the activity stream * Implement Notification celery tasks * Extend Backend field parameters to identify sender and receiver as parameters needed by the message and not the backend itself * Updates to backends to better fit the django email backend model as it relates to Messages * Implement success job chain task + notifications * Implement notifications in error job chain task
This commit is contained in:
@@ -13,7 +13,10 @@ class TwilioBackend(BaseEmailBackend):
|
||||
|
||||
init_parameters = {"account_sid": {"label": "Account SID", "type": "string"},
|
||||
"account_token": {"label": "Account Token", "type": "password"},
|
||||
"from_phone": {"label": "Source Phone Number", "type": "string"}}
|
||||
"from_number": {"label": "Source Phone Number", "type": "string"},
|
||||
"to_numbers": {"label": "Destination SMS Numbers", "type": "list"}}
|
||||
recipient_parameter = "to_numbers"
|
||||
sender_parameter = "from_number"
|
||||
|
||||
def __init__(self, account_sid, account_token, from_phone, fail_silently=False, **kwargs):
|
||||
super(TwilioBackend, self).__init__(fail_silently=fail_silently)
|
||||
@@ -34,7 +37,7 @@ class TwilioBackend(BaseEmailBackend):
|
||||
try:
|
||||
connection.messages.create(
|
||||
to=m.to,
|
||||
from_=self.from_phone,
|
||||
from_=m.from_email,
|
||||
body=m.body)
|
||||
sent_messages += 1
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user