mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Merge pull request #426 from alphagov/api-template-response
add template body, version, and subject to send_notification api
This commit is contained in:
@@ -349,7 +349,25 @@ def send_notification(notification_type):
|
||||
), queue='email')
|
||||
|
||||
statsd_client.incr('notifications.api.{}'.format(notification_type))
|
||||
return jsonify(data={"notification": {"id": notification_id}}), 201
|
||||
return jsonify(
|
||||
data=get_notification_return_data(
|
||||
notification_id,
|
||||
notification,
|
||||
template_object)
|
||||
), 201
|
||||
|
||||
|
||||
def get_notification_return_data(notification_id, notification, template):
|
||||
output = {
|
||||
'body': template.replaced,
|
||||
'template_version': notification['template_version'],
|
||||
'notification': {'id': notification_id}
|
||||
}
|
||||
|
||||
if template.template_type == 'email':
|
||||
output.update({'subject': template.subject})
|
||||
|
||||
return output
|
||||
|
||||
|
||||
@notifications.route('/notifications/statistics')
|
||||
|
||||
Reference in New Issue
Block a user