- Fix a bug where an internal API client function isn't being exposed in the library.
- Add support for providing a custom underlying Axios client via
setClient
.
- The
sendEmail
function can now be passedoneClickUnsubscribeURL
as an optional argument.
- Remove the default
is_csv
boolean parameter fromprepareUpload
. This method now accepts a file and an options map with the following options. For more specific information please read the documentation.filename
(string) - specify the document's filename upon downloadconfirm_email_before_download
(boolean) - require the user to enter their email address before the file can be downloaded.retention_period
(string) - how long Notify should make the file available to the user for.
- Bump axios from 1.2.6 to 1.6.1
- Fix a few cases of assignment to undeclared (global) variables
- Bump axios to the 1.x branch to address CVE-2023-45857. Due to underlying changes in Axios you may have to explicitly set the
protocol
property when constructing yourproxyConfig
object, if using a proxy.
- Bump word-wrap from 1.2.3 to 1.2.4 to address CVE-2023-26115.
- Bump semver from 5.7.1 to 5.7.2
- Fix a bug with default behaviour for
confirmEmailBeforeDownload
, which coalesced false to null.
- Remove support for node versions below v14.17.3.
- Bump jsonwebtokens from 8.5.1 to 9.0.0 to mitigate CVE-2022-23529. We don't believe this CVE affects any use-cases of notifications-node-client; this update is out of best-practice rather than any direct concern.
- Remove support for node versions below v12.
- Bump follow-redirects from 1.14.7 to 1.15.2
- Upgrade ansi-regex dependencies to mitigate CVE-2021-3807.
- Support strings in calls to
prepareUpload
.fs.readFile
can return strings if an encoding is provided, and the client didn't handle these correctly.
-
Add support for new security features when sending a file by email:
confirmEmailBeforeDownload
can be set totrue
to require the user to enter their email address before accessing the file.retentionPeriod
can be set to<1-78> weeks
to set how long the file should be made available.
-
The
isCsv
parameter toprepareUpload
has now been replaced by anoptions
parameter. The implementation has been done in a backwards-compatible way, so if you are just sendingtrue/false
values as the seecond parameter, that will continue to work. Though we still recommend updating to use the new options format.
Remove underscore.js dependencyr new send a file features)
Upgrade axios version from ^0.21.1 to ^0.25.0
- Upgrade axios version from 0.19.2 to 0.21.1
- Allow any compatible version of axios to be used (0.21.1 to <1.0.0)
- Allow any compatible version of jsonwebtoken to be used (8.2.1 to <9.0.0)
Correct incorrect description of parameter to be used by NotifyClient.setProxy
Remove unintentional global nature of variable version
We have replaced the use of the npm request-promise package with axios as the npm request package has been deprecated. This makes the following breaking changes:
-
The
response
object
returned by a successful API call is now in the form of an axios response. This has a different interface to a request response. For example:response.body
becomesresponse.data
response.statusCode
becomesresponse.status
-
The
err
object
returned by an unsuccessful API call has a different interface. For example,err.error
becomeserr.response.data
. See the axios documentation for further details on error handling. -
To configure the use of a proxy you should pass the proxy configuration as an
object
rather than a URL. For details, see the axios client. -
We now return native promises rather than bluebird promises. You will not need to make any changes unless you are using some of the additional methods found on bluebird promises that do not exist on native promises.
- Added
letter_contact_block
to the responses forgetTemplateById
,getTemplateByIdAndVersion
andgetAllTemplates
.
- Add support for an optional
isCsv
parameter 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.
- Remove
__dirname
global call from api client
- Add homepage to package.json
- Refer to files, not documents, in error messages
- Add
notifyClient.getPdfForLetterNotification(notificationId)
- Returns a Buffer with pdf data
- Will raise a BadRequestError if the PDF is not available
- Added an optional postage argument to
sendPrecompiledLetter
- Moved documentation to https://docs.notifications.service.gov.uk/node.html (generated from DOCUMENTATION.md)
- Made formatting consistent across documentation.
- Added a function to send precompiled letter through the client.
- the new function uses a helper function to check if the file size is within the 5MB limit and to encode the file using base64. Then a POST request to our API is made with the file data and user reference.
- instructions for the new functionality added to the documentation.
- Added instructions for uploading a document to be linked to from an email notification.
- Created a helper function
prepareUpload
as a part of this development. This function encodes the document that is to be uploaded with base64 and returns a dictionary with prepared document as a value (the way our API is prepared to receive it). It also checks if the provided file is not larger than 2MB. The function throws an error if the file is too big.
- Created a helper function
- Added
name
to the response forgetTemplateById()
andgetTemplateByIdAndVersion()
- These functions now return the name of the template as set in Notify
- Added
created_by_name
to the response for.getNotificationById()
and.getNotifications()
:- If the notification was sent manually this will be the name of the sender. If the notification was sent through the API this will be
null
.
- If the notification was sent manually this will be the name of the sender. If the notification was sent through the API this will be
- Added new method:
getReceivedTexts
- get one page of text messages (250) per call
- Updated
sendSms
,sendEmail
andsendLetter
to take anoptions
object as a parameter.personalisation
,reference
,smsSenderId
andemailReplyToId
now need to be passed to these functions insideoptions
.
- Removed the unused
Crypto
dependency
- Updated
sendSms
method with optional argument:smsSenderId
- specify the identifier of the sms sender (optional)
- Added new method:
sendLetter
- send a letter
- Updated
sendEmail
method with optional argument:emailReplyToId
- specify the identifier of the email reply-to address (optional)
- Added new method:
setProxy(proxyUrl)
- specify the URL of a proxy for the client to use (optional)
-
Added new methods for managing templates:
getTemplateById
- retrieve a single templategetTemplateByIdAndVersion
- retrieve a specific version for a desired templategetAllTemplates
- retrieve all templates (can filter by type)previewTemplateById
- preview a template with personalisation applied
-
Update README to describe how to catch errors
-
Using v2 of the notification-api.
-
Update to
notifyClient.sendSms()
:- Added
reference
: an optional identifier you generate if you don’t want to use Notify’sid
. It can be used to identify a single notification or a batch of notifications. - Updated method signature:
- Added
notifyClient.sendSms(templateId, phoneNumber, personalisation, reference);
* Where `personalisation` and `reference` can be `undefined`.
- Update to
notifyClient.sendEmail()
:- Added
reference
: an optional identifier you generate if you don’t want to use Notify’sid
. It can be used to identify a single notification or a batch of notifications. - Updated method signature:
- Added
notifyClient.sendEmail(templateId, emailAddress, personalisation, reference);
* Where `personalisation` and `reference` can be `undefined`.
NotificationClient.getAllNotifications()
- Notifications can now be filtered by
reference
andolderThanId
, see the README for details. - Updated method signature:
- Notifications can now be filtered by
notifyClient.getNotifications(templateType, status, reference, olderThanId);
* Each one of these parameters can be `undefined`
Changelog not recorded - please see pull requests on github.