This repository hosts a Flask web service for Funding Service Design Notification System, handling notifications including magic links and emails.
This service depends on:
- utils
- Gov Notify
Refer to the steps as required
api key is required for a service to communicate with GOV.UK Notify service
- Refer to the link here to create a new api key as required
Production api key (DO NOT USE IT LOCALLY)
- The production api key must always be kept secure hence it is added to the Github secrets.
Test api key (for local use)
- The test api key can be temporarily added to the config file or export it to the local environment for testing purposes only. Make sure to remove the test api key from config file before committing any changes.
Set it as an environment variable e.g.
Note: For unit (integration) testing, you also need to set this in
// pragma: allowlist secret export GOV_NOTIFY_API_KEY="api-key-value
pytest.ini
Template is required for a service to communicate with GOV.UK Notify service.
Typically, a template contains information in a text format, with attributes enclosed in double parentheses, such as ((attribute name)). These attribute will then be required for a service to make a call to that unique template.
- Refer to the link here to create a new template
Once a template is created using the GOV.UK Notify service, it generates a unique template ID. This ID can then be directly incorporated into the configuration file. Then this template ID can be used across the service and to make a call to the GOV.UK Notify service.
- For example APPLICATION_RECORD_TEMPLATE_ID is added here
When an applicant submits their application, we send a file containing the application's questions and answers back to the applicant and at the end of the assessment, once the QA section is completed, we make files available for download containing the application's questions and answers. There is a functionality within the utils-service here, which is employed by both the notification service and assessment frontend to facilitate this task.
To ensure that questions and answers are mapped correctly and formatted for better readability, especially when creating a new fund, it's essential to review the questions & answers. The text file can be located in GOV.UK Notify service after the application submission.
The dev team recently carried out some work to organise and arrange the questions and answers, making it easier for all services to use them. The notification service may not require the mapping and formatting, so instead, the formatting can happen in the application-store. Then, the notification service can simply act as a dumb service to send messages to users without needing to do extra organising.
Instantiate a notifications_client object using the notification api key. Next, utilise the preferred service, like send_email_notification, to access the email service.
For this service (notifications_client.send_email_notification), you'll need to some required attributes such as email_address, template_id, email_reply_to_id etc.
Based on the attributes set on the template during its creation, ensure that all attribute values are added to personalisation.
- To connect with GOV.UK Notify service and post contents, refer to this example.
For more information, refer to the documentation here.
- Refer to the documentation here
`uv run flask run`
Note: This service is an internal service so it doesn't have the frontend.
Paketo is used to build the docker image which gets deployed to our test and production environments. Details available here
Go to relevant service. See example
Place brief descriptions of Pipelines here
- Deploy to Gov PaaS - This is a simple pipeline to demonstrate capabilities. Builds, tests and deploys a simple python application to the PaaS for evaluation in Dev and Test Only.
Details on how our pipelines work and the release process is available here
Copilot is used for infrastructure deployment. Instructions are available here, with the following values for the notification store:
- service-name: fsd-notification
- image-name: funding-service-design-notification