mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 06:38:24 -04:00
Merge pull request #470 from alphagov/better-better-send-page
Make the flow of using templates better
This commit is contained in:
@@ -183,19 +183,16 @@ def send_message_to_self(service_id, template_id):
|
||||
@user_has_permissions('manage_api_keys')
|
||||
def send_from_api(service_id, template_id):
|
||||
template = Template(
|
||||
service_api_client.get_service_template(service_id, template_id)['data']
|
||||
service_api_client.get_service_template(service_id, template_id)['data'],
|
||||
prefix=current_service['name']
|
||||
)
|
||||
payload = {
|
||||
"to": current_user.mobile_number,
|
||||
"template": template.id,
|
||||
"personalisation": {
|
||||
placeholder: "{} 1".format(placeholder) for placeholder in template.placeholders
|
||||
}
|
||||
personalisation = {
|
||||
placeholder: "..." for placeholder in template.placeholders
|
||||
}
|
||||
return render_template(
|
||||
'views/send-from-api.html',
|
||||
template=template,
|
||||
payload=json.dumps(payload, indent=4)
|
||||
personalisation=json.dumps(personalisation, indent=4) if personalisation else None
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user