2016-04-04 14:37:35 +01:00
About this document
2016-04-04 13:42:41 +01:00
==========================
2016-04-05 10:17:18 +01:00
This document is for developers, technical architects, and service managers who want to use the GOV.UK Notify platform to send notifications to users of their digital service.
2016-04-04 13:42:41 +01:00
About GOV.UK Notify
====================
2016-04-05 10:17:18 +01:00
GOV.UK Notify is a cross-government platform, currently in beta, that lets government services and agencies [?] send notifications by sms or email.
2016-04-04 13:42:41 +01:00
There are two ways to send notifications:
2016-04-05 10:17:18 +01:00
* use the [GOV.UK Notify ](https://www.notifications.service.gov.uk/ ) web application
2016-04-04 13:42:41 +01:00
* integrate your web applications or back office systems with the GOV.UK Notify API
To find out more about GOV.UK Notify, see the [Government as a Platform ](https://governmentasaplatform.blog.gov.uk/ ) blog.
Before you start
==================
To use GOV.UK Notify, you need:
2016-04-05 10:17:18 +01:00
2016-04-04 13:42:41 +01:00
* an email address from a local or central government organisation
* a mobile number for 2-factor authentication
Quick start guide to GOV.UK Notify
===================================
2016-04-05 10:17:18 +01:00
To get started:
2016-04-04 13:42:41 +01:00
1. Register for a [GOV.UK Notify ](https://www.notifications.service.gov.uk/ ) account. You will need your mobile phone for 2-factor authentication.
2016-04-05 10:17:18 +01:00
2. Add a new service.
2016-04-04 13:42:41 +01:00
2016-04-05 10:17:18 +01:00
At first your service will be in trial mode. In trial mode you will only be able to send test sms and email notifications to your own mobile number or email address. When you’ re fully integrated and ready to go live, send a request to the GOV.UK Notify team.
2016-04-04 13:42:41 +01:00
2016-04-05 10:17:18 +01:00
3. Add a template so you can send sms and email notifications. You can personalise the template using double brackets for replaceables. For example:
2016-04-04 13:42:41 +01:00
Dear ((name))
2016-04-05 10:17:18 +01:00
Your ((item)) will expire on ((date)).
2016-04-04 13:42:41 +01:00
2016-04-06 10:12:51 +01:00
4. Upload a csv file containing a header row with the replaceables in your template, and data rows with values for the replaceables.
2016-04-04 13:42:41 +01:00
5. Send an sms or email notification.
2016-04-04 14:37:35 +01:00
6. Create a new API key. This will be used to connect to the API.
2016-04-05 10:17:18 +01:00
You can provide all your developers with test keys so they can experiment in the Sandbox environment. But keep the number of keys for real integrations to a minimum number of people on your team.
2016-04-04 14:37:35 +01:00
2016-04-04 13:42:41 +01:00
Integrate the GOV.UK API into your service
============================================
2016-04-05 10:17:18 +01:00
A client (on github) will make calls to GOV.UK Notify on your behalf.
2016-04-04 14:37:35 +01:00
You can either:
2016-04-05 10:16:03 +01:00
* use a client library provided by Notify - there is currently 1 python library but more will be added in different languages
* develop your own [???]
2016-04-04 14:37:35 +01:00
2016-04-05 10:17:18 +01:00
To make an API call to a client you need:
* the service ID - this is aviailable under API keys on the [GOV.UK Notify ](https://www.notifications.service.gov.uk/ ) web application
2016-04-05 10:16:03 +01:00
* an API key - this is a secret key so save it somewhere safe; do not commit API keys to public source code repositories
2016-04-04 14:37:35 +01:00
2016-04-05 10:17:18 +01:00
2016-04-04 13:42:41 +01:00
API integration
------------------
API endpoints
----------------
2016-04-04 14:37:35 +01:00
You can use the API to:
* send notifications
* retrieve one or more notifications
* retrieve all notifications
2016-04-05 10:17:18 +01:00
To send a text notification:
2016-04-04 14:37:35 +01:00
```
POST /notifications/sms
```
```
{
'to': '+447700900404',
'template': 1
}
```
2016-04-05 10:16:03 +01:00
where ‘ to’ is the phone number and ‘ template’ is the template ID to send.
2016-04-04 14:37:35 +01:00
The response will be:
```
{
'data':{
'notification': {
'id':1
}
}
}
```
2016-04-05 10:16:03 +01:00
To get the status of a single text notification:
2016-04-04 14:37:35 +01:00
```
GET /notifications/{id}
```
```
{
'data':{
'notification': {
'status':'sent',
'createdAt':'2016-01-01T09:00:00.999999Z',
'to':'+447827992607',
'method':'sms',
'sentAt':'2016-01-01T09:01:00.999999Z',
'id':1,
'message':'...',
'jobId':1,
'sender':'sms-partner'
}
}
}
```
2016-04-05 10:17:18 +01:00
where ‘ status’ is the the status of the notification.
2016-04-04 14:37:35 +01:00
2016-04-05 10:16:03 +01:00
To get the status of all text notifications: [do we want this? why do we only explain how to get text notifciations, do we want to explain how to do the same for email notifications?]
2016-04-04 14:37:35 +01:00
2016-04-04 13:42:41 +01:00
Functional testing
---------------------
[Some info in Rosalie’ s notes.]
2016-04-05 10:17:18 +01:00
2016-04-04 13:42:41 +01:00
Security
----------
[Some info in Rosalie’ s notes.]
Privacy
--------