- Remove Java 8, 9, and 10 from supported versions. This library only supports Java 11+ from now on.
- Bump commons-io from 2.8.0 to 2.17.0
- Added fields related to cost data in response:
is_cost_data_ready: This field is true if cost data is ready, and false if it isn't (Boolean).cost_in_pounds: Cost of the notification in pounds. The cost does not take free allowance into account (Float).cost_details.billable_sms_fragments: Number of billable SMS fragments in your text message (SMS only) (Integer).cost_details.international_rate_multiplier: For international SMS rate is multiplied by this value (SMS only) (Integer).cost_details.sms_rate: Cost of 1 SMS fragment (SMS only) (Float).cost_details.billable_sheets_of_paper: Number of sheets of paper in the letter you sent, that you will be charged for (letter only) (Integer).cost_details.postage: Postage class of the notification sent (letter only) (String).
- Add a
oneClickUnsubscribeURLparameter tosendEmail. The unsubscribe URL will be added to the headers of your email. Email clients will use it to add an unsubscribe button. See https://www.notifications.service.gov.uk/using-notify/unsubscribe-links
- Bump jose4j from 0.9.3 to 0.9.6
- Remove the
isCsvparameter toprepareUpload. - Add a
filenameparameter toprepareUploadto set the document's filename upon download. See our documentation for more specific guidance.
- Bump json to 20231013 to address https://github.com/advisories/GHSA-4jq9-2xhw-jpx7.
- Remove a dependency on
commons-lang3by implementingisBlankourselves.
- Joda-Time has been removed and replaced with java.time
- The client now uses
ZonedDateTimeinstead ofDateTime
- The client now uses
- Bump jose4j from 0.7.7 to 0.9.3.
- Bump org.json to version 20230227. Although the Notify API client is unaffected by CVE-2022-45688, we bump this package to a version that fixes this vulnerability.
- Adds a new interface for specifying custom retention periods when sending a file by email:
retentionPeriodcan be set using anew RetentionPeriodDuration(int, ChronoUnit)
- Add support for new security features when sending a file by email:
confirmEmailBeforeDownloadcan be set toTrueto require the user to enter their email address before accessing the file.retentionPeriodcan be set to<1-78> weeksto set how long the file should be made available.
- Removed unused commons-cli dependency
- Updated dependencies to latest versions
- Minor patch release, changes to pom.xml including adding a license, contact details and more.
- Add
letterContactBlockto theTemplatemodel.
- We've added
letter_contact_blockto our API responses when callinggetTemplateById,getTemplateVersionandgetAllTemplates. This release updates ourTemplatemodel to include this new property.
- Add support for an optional
isCsvparameter in theprepareUpload()function. This fixes a bug when sending a CSV file by email. This ensures that the file is downloaded as a CSV rather than a TXT file.
- Fixes issue #171 with null pointer exception on reading the errorstream
- Change error messages to refer to file, not document.
- Added 400 has a default value for the httpResult value of a NotificationClientException.
- there are some cases when the exception is thrown from the client and not from the API, even though a httpResult. All the exceptions raised can be classified as 400, therefore using 400 as a default.
- Added
NotificationClient.getPdfForLetterfunction- accepts
String notificationId - returns a
byte[]containing the final printable PDF for a precompiled or templated letter
- accepts
- Updated old dependencies
- Updated code to bring in linting standards.
- Updated project properties to use UTF-8
- Updated GET and POST to use UTF-8 readers and writers
- Added
postageargument toNotificationClient.sendPrecompiledLetterandNotificationClient.sendPrecompiledLetterWithInputStream - Added
postagetoLetterResponse - Added
postagetoNotification - Added
htmltoTemplatePreview
- Allow passing of
Lists into the personalisation Map to display as a bulleted list in the message.
- Added
NotificationClient.prepareUploadmethod that can be used if you want to upload a document and send a link to that docuemnt by email.- Takes a byte[] of document contents
- You then add the returned
JSONObjectto the personalisation map. - NOTE: the personalisation map for this call needs to be HashMap<String, Object>
- which is why the
sendEmailno uses a wildcard for the generic definition of thepersonalisationHashMap
- which is why the
- Updated
Templateto havename, the name of the template as set in Notify.
- Updated
Notificationto have an Optional createdByName. If the notification was sent manually, this will be the name of the sender. If the notification was sent through the API, this will beOptional.empty(). - New method,
sendPrecompiledLetterWithInputStream, to send a precompiled letter using an InputStream rather than a file.
- Updated testEmailNotificationWithoutPersonalisationReturnsErrorMessageIT to only look for the BadRequestError rather than the json "error": BadRequestError
- Response to
sendPrecompiledLetterupdated- The response now only includes the notification id and the client reference
sendPrecompiledLetteradded to NotificationClient- The client can now send PDF files which conform to the Notify printing template
- Send a Java File object or a base64 encoded string
- 'reference' must be provided to identify the document
- Added
getTextMessages(String olderThan)method to fetch received text messages.
- Update to
NotificationsAPIClient.sendSms()- added
smsSenderId: an optional smsSenderId specified when adding text message senders under service settings, if this is not provided the default text message sender for the service will be used.smsSenderIdcan be omitted.
- added
- Update to
NotificationsAPIClient.sendEmail()- added
emailReplyToId: an optional email_reply_to_id specified when adding Email reply to addresses under service settings, if this is not provided the reply to email will be the service default reply to email.emailReplyToIdcan be omitted.
- added
- Attached source and javadoc artifacts to jar
Templatenow containspersonalisation, a map of the template placeholder names.
Notificationnow containsestimatedDelivery- Shows when the letter is expected to be picked up by Royal Mail from our printing providers.
nullfor sms and email.
NotificationClientApiinterface updated to include `sendLetter`` functionality.
sendLetteradded to NotificationClient- SendLetterResponse sendLetter(String templateId, Map<String, String> personalisation, String reference) throws NotificationClientException
personalisationmap is required, and must contain the recipient's address details.- as with sms and email,
referenceis optional.
- Template endpoints added to the NotificationClient
getTemplateById- get the latest version of a template by id.getTemplateVersion- get the template by id and version.getAllTemplates- get all templates, can be filtered by template type.generateTemplatePreview- get the contents of a template with the placeholders replaced with the given personalisation.- See the README for more information about the new template methods.
- Updated the jose4j dependency in light of the security issues: https://auth0.com/blog/critical-vulnerability-in-json-web-encryption/
- Added SSLContext to
NotificationClientconstructor, to allow clients to be created with a specified SSL Context.
- The Client UserAgent is now populated correctly.
NotificationClientExceptionnow has a getter for the httpResult,NotificationClientException.getHttpResult()- Added
NotificationClientApiinterface forNotificationClient- The interface is useful if you want to stub the
NotificationClientfor tests.
- The interface is useful if you want to stub the
- Using version 2 of the notification-api.
- Update to
NotificationClient.sendSms():- added
reference: an optional unique identifier for the notification or an identifier for a batch of notifications.referencecan be an empty string or null. - returns SendSmsResponse, this object only contains the necessary information about the notification.
- only one method signature:
public SendSmsResponse sendSms(String templateId, String phoneNumber, HashMap<String, String> personalisation, String reference) throws NotificationClientException;Wherepersonalisationcan be an empty map or null andreferencecan be an empty string or null.
- added
- Update to
NotificationClient.sendEmail():- added
reference: an optional unique identifier for the notification or an identifier for a batch of notifications.referencecan be an empty string or null. - returns SendEmailResponse, this object only contains the necessary information about the notification.
- only one method signature:
public SendEmailResponse sendEmail(String templateId, String emailAddress, HashMap<String, String> personalisation, String reference) throws NotificationClientException;Wherepersonalisationcan be an empty map or null andreferencecan be an empty string or null.
- added
- Notification class has been changed; return type of
NotificationClient.getNotificationById(id), see the README for details. NotificationClient.getAllNotifications()- Notifications can be filtered by
reference, see the README for details. - Notifications can be filtered by
olderThanId, see the README for details. - NotificationList response has changed, see the README for details.
- Notifications can be filtered by
NotificationClientremoved the constructors containing the serviceId, which is no longer needed because the api key contains the service id.