Allow service to set callback url for notifications

This commit is contained in:
chrisw
2017-12-04 15:07:11 +00:00
parent 72dd0b369f
commit 76117c148c
12 changed files with 523 additions and 268 deletions

View File

@@ -3,33 +3,44 @@
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
Callback URL
Callbacks
{% endblock %}
{% block maincolumn_content %}
<div class="grid-row">
<div class="column-five-sixths">
<h1 class="heading-large">Callback URL for received text messages</h1>
<h1 class="heading-large">Callbacks</h1>
<p>
Text messages you receive can be forwarded to your systems with our callback feature.
See our <a href="{{ url_for('.callbacks') }}">documentation on the format of the callback</a>.
</p>
<form method="post">
{% if can_receive_inbound %}
{{ textbox(
form.inbound_url,
width='1-1',
hint='Valid https URL'
) }}
{{ textbox(
form.inbound_bearer_token,
width='2-3',
hint='At least 10 characters'
) }}
{% endif %}
{{ textbox(
form.url,
width='2-3',
form.outbound_url,
width='1-1',
hint='Valid https URL'
) }}
{{ textbox(
form.bearer_token,
form.outbound_bearer_token,
width='2-3',
hint='At least 10 characters'
) }}
{{ page_footer(
'Save',
back_link=url_for('.service_settings', service_id=current_service.id),
back_link_text='Back to settings'
back_link=url_for('.api_integration', service_id=current_service.id),
back_link_text='Back to API integration'
) }}
</form>
</div>

View File

@@ -21,7 +21,7 @@
<a class="pill-separate-item" href="{{ url_for('.whitelist', service_id=current_service.id) }}">Whitelist</a>
</div>
<div class="column-one-third">
<a class="pill-separate-item" href="{{ url_for('.api_documentation', service_id=current_service.id) }}">Documentation</a>
<a class="pill-separate-item" href="{{ url_for('.api_callbacks', service_id=current_service.id) }}">Callback Url</a>
</div>
</nav>

View File

@@ -31,12 +31,14 @@
If you dont have receive text messages enabled for your service, <a href="{{ url_for('.support') }}">get in touch</a> and we can turn it on for you.
</p>
<h2 class="heading-medium">Format of the callback</h2>
<h2 class="heading-medium">Format of the callbacks</h2>
<p>
The format of the callback message you receive is JSON.
</p>
<h3 class="heading-small"> Received text messages callback </h3>
<div class="bottom-gutter-3-2">
{% call mapping_table(
caption='Callback message format',
@@ -60,4 +62,32 @@
{% endcall %}
</div>
<h3 class="heading-small"> Status callback </h3>
<div class="bottom-gutter-3-2">
{% call mapping_table(
caption='Callback message format',
field_headings=['Key', 'Description', 'Format'],
field_headings_visible=True,
caption_visible=False
) %}
{% for key, description, format in [
('id', 'Notifys id for the status receipts', 'UUID'),
('reference', 'The reference sent by the service', '12345678'),
('to', 'The email address of the recipient', 'hello@gov.uk'),
('status', 'The status of the notification', 'delivered | permanent-failure | temporary-failure | technical-failure'),
('created_at', 'The time the service sent the request', '2017-05-14T12:15:30.000000Z'),
('updated_at', 'The last time the status was updated', '2017-05-14T12:15:30.000000Z'),
('sent_at', 'The time the notification was sent', '2017-05-14T12:15:30.000000Z or nil'),
('notification_type', 'The notification type', 'email | sms | letter')
] %}
{% call row() %}
{% call row_heading() %} {{ key }} {% endcall %}
{{ text_field(description) }}
{{ text_field(format) }}
{% endcall %}
{% endfor %}
{% endcall %}
</div>
{% endblock %}

View File

@@ -120,14 +120,6 @@
{{ edit_field('Change', url_for('.service_set_inbound_sms', service_id=current_service.id)) }}
{% endcall %}
{% if can_receive_inbound %}
{% call row() %}
{{ text_field('Callback URL for received text messages') }}
{{ optional_text_field(inbound_api_url) }}
{{ edit_field('Change', url_for('.service_set_inbound_api', service_id=current_service.id)) }}
{% endcall %}
{% endif %}
{% endif %}
{% endcall %}