Callbacks for received text messages
Text messages you receive can be forwarded to a URL that you specify, using our callback feature.
Messages are forwarded as they are received.
To protect your service, we require you to provide a bearer token. We put this token in the authorisation header of the callback requests.
Once you have ‘receive text messages’ enabled, you can set up your callback on the settings page of your service.
If you don’t have ‘receive text messages’ enabled for your service, get in touch and we can turn it on for you.
Format of the callbacks
The format of the callback message you receive is JSON.
Received text messages callback
{% 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', 'Notify’s id for the received message', 'UUID'),
('source_number', 'The phone number the message was sent from', '447700912345'),
('destination_number', 'The number the message was sent to (your number)', '07700987654'),
('message', 'The received message', 'Hello Notify!'),
('date_received', 'The UTC datetime that the message was received by Notify', '2017-05-14T12:15:30.000000Z')
] %}
{% call row() %}
{% call row_heading() %} {{ key }} {% endcall %}
{{ text_field(description) }}
{{ text_field(format) }}
{% endcall %}
{% endfor %}
{% endcall %}
Status callback
{% 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', 'Notify’s 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 %}
{% endblock %}