How to use notifications-node-client - 3 common examples

To help you get started, we’ve selected a few notifications-node-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alphagov / paas-admin / src / lib / notify / notify.client.ts View on Github external
constructor(config: IConfig) {
    this.client = new NotifyClient(config.apiKey);
    /* istanbul ignore next */
    this.templates = config.templates || {};
  }
github ministryofjustice / apvs-external-web / app / routes / dev / gov-notify.js View on Github external
router.post('/dev-gov-notify', function (req, res) {
    // using old style of url/clientid/apikey, this will be replaced in future with single constructor key arg
    var notifyClient = new NotifyClient(
      'https://api.notifications.service.gov.uk',
      '11030d6a-c042-4857-aa68-99f0c7fa9352',
      process.env.APVS_NOTIFY_API_KEY // API Key
    )
    var reference = req.body.reference
    var personalisation = {reference: reference}

    if (req.body.sendemail) {
      var emailAddress = req.body.email
      var emailTemplateId = '508b23b3-3f1c-45c2-bdc7-db90e3fae8b0' // comes from Notify site
      notifyClient.sendEmail(emailTemplateId, emailAddress, personalisation)
    } else {
      var phoneNumber = req.body.phone
      var textTemplateId = 'adf6c0bf-513a-4fe4-8023-0ae4ab55e1a1'
      notifyClient.sendSms(textTemplateId, phoneNumber, personalisation)
    }
github alphagov / pay-selfservice / app / services / clients / notification_client.js View on Github external
var q = require('q'),
  NotifyClient = require('notifications-node-client').NotifyClient,
  notifyClient = !!process.env.NOTIFICATIONS_ENABLED && new NotifyClient(
    process.env.NOTIFY_BASE_URL,
    process.env.NOTIFY_SERVICE_ID,
    process.env.NOTIFY_SECRET
  );


module.exports = {
  /**
   * @param {String} templateId
   * @param {String} emailAddress
   * @param {Object} personalisation
   *
   * @returns {Promise}
   */
  sendEmail: function(templateId, emailAddress, personalisation) {
    var deferred = q.defer();

notifications-node-client

GOV.UK Notify Node.js client

MIT
Latest version published 3 months ago

Package Health Score

82 / 100
Full package analysis

Popular notifications-node-client functions

Similar packages