Skip to content

jacekszubert/mail-slack-forwarding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mail-Slack forwarding - serverles lambda

This simple script allows you to quickly setup forwards from your email account to slack (both private and public channels and private messages are available in free slack version). The main requirement is to have any domain configured with AWS SES.

Requirements

  • Generate incoming webhook for your slack: slack.com/apps/A0F7XDUAZ-incoming-webhooks
  • Copy ARN of your AWS KMS key, store it in serverless.yml
  • Encrypt your webhook url with KMS: aws kms encrypt --key-id ${key_id} --plaintext hooks.slack.com/services/... (remove https:// part of the url) and paste generated value to the serverless.yml
  • In serverless.yml set also slack channel to which you want to forward emails: #channel or @person
  • If you want to set up few separate forwards, copy the part of configuration responsible for function few times (but with different names) and fill them with informations generated by the previous steps
  • Run npm install to install dependencies
  • Run serverless deploy to deploy SNS topic and Lambda function (serverless framework can be installed by npm install -g serverless)

Simple Email Service (SES)

If your emails are handled by SES whole configuration can be done in a few steps with AWS console.

Got o SES console, create a new rule with an email address which you want to use as a proxy between your real email account and slack. The name shouldn't actually exist, you can for example use following or similar convention: slack-{real-mail-name}@domain. In the next step you need to choose an action which will be triggered with each message. Choose SNS topic and name you've set in the serverless.yml and UTF-8 as an encoding. In the next steps you can just accept suggested configuration.

Forwarding rules

Generated email address can be used in nearly all email providers simply by setting up a forwarding rule. If you want to forward all the messages to slack use * wildcard. You can also use provided there filter or process and filter messages with the lambda.

Releases

No releases published

Packages

No packages published