/
Set up organisations for referral letters SMS workflow

Set up organisations for referral letters SMS workflow

It is possible for organisations to enable a workflow to send SMS to unregistered patients upon receiving a referral letter in their record.

To do so, we need:

  • an employee to enable the workflow on the UI for the org (cf this guide)

  • PKB / the org themselves to set up a new service on GOV.UK Notify API webpage (cf this guide)

  • a dev to add the credentials and sms setup into the database

This page covers the last bullet point. To create new credential and sms properties, the notification service exposes some controllers. (see NotifyCredentialsControllerand NotifySmsPropertiesController) Hence, we only need to send requests with the right parameters to the notification service using curl.

Step 1: connecting to the right cluster

To be able to send requests using curl to the notification service, we need to connect to the right cluster and then forward the notificationservice pod port to our localhost.

Connecting to RC

gcloud container clusters get-credentials sandbox-2 --zone europe-west2-b --project develop-238811 kubectl port-forward deployment/notificationservice -n rc 40000:8080

Connecting to UK Prod

gcloud container clusters get-credentials uk-prod-1 --zone europe-west2-c --project prod-239510 kubectl port-forward deployment/notificationservice -n uk 40000:8080

Step 2: sending a request

Create or update credentials for an organisation

This is what we use to authenticate to the gov.uk notify API. What you need:

  • the organisation resourceId (Organization/<some-uuid>)

  • the serviceId

  • the apiKey

Both the serviceId and apiKey are created during the set up of the GOV.UK Notify service. (covered in this guide).

curl -X POST "localhost:40000/notify-credentials?orgResourceId=<some-org-resource-id>&serviceId=<some-uuid>&apiKey=<some-api-key>" -H "Content-Type: application/fhir+json" -v

Revoke credentials

Create or update sms properties

What you need:

  • the organisation resourceId (Organization/<some-uuid>)

  • the templateId

  • an optional senderId : this allows the org to send SMS from a specific sender display. It is optional. If it is null, the GOV.UK Notify API will use the default sender set up in the service.

Example without senderId:

Step 3: check your call was successful

You only need to read the response from the curl call you just made, however, you can also check the new rows were inserted into the db like so:

  1. From intelliJ, start the appropriate SQL Proxy ('Prod UK - Notification Service' or ‘RC - Notification Service’)

  2. Open a console ('UK - notificationservice' or ‘RC - notificationservice’)

  3. Run one of these queries to check your calls were successfull

Note: if you need to see the history of credentials used you can look into the respective tables in the ‘history’ schema.