Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Latest commit

 

History

History

hermes

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@beatgig/hermes

Easily send notifications to Slack, Email, or SMS.

Installation

yarn add @beatgig/hermes

Example

import { sendNotification } from '@beatgig/hermes'

await sendNotification({
    channels: ['email', 'slack', 'sms'],
    email: {
      to: user.email,
      subject: 'Reset your Password',
      template: TEMPLATE_RESET_PASSWORD,
      templateData: {
        link,
      },
     apiKey: process.env.MAILGUN_API_KEY,
     domain: process.env.MAILGUN_DOMAIN
    },
   slack: {
      channel: 'testing',
      message: 'User #1234 has requested a password reset.'
      emoji: ':fire:',
      blocks: [...block data],
      token: process.env.SLACK_TOKEN
    },
   sms: {
     to: user.phone,
     message: 'A password reset request was received for your account. If this was not you, please contact us immediately.',
     accountSid: process.env.TWILIO_ACCOUNT_SID,
     token: process.env.TWILIO_TOKEN
   }
  })

Tests

yarn test