Let the slack free feature work for us like paid feature. There is a hack for you.
I was inspired by this project. Thanks to the author. https://github.com/kossiitkgp/email-to-slack
- stay slack free plan.
- one click to deploy. (use Heroku Button)
- attachments is OK.
-
Generate the email for forwarding to slack from "Preferences -> Messages and Media -> Bring emails into Slack" ex email:
[something]@[workspace].slack.com
this is the free slack feature.
-
Setup forwarding in gmail. Gmail sends a email to slack with the link to confirm. This email shows up in the slackbot. Click on the link and accept forwarding.
-
Send a sample mail to account to test whether it gets forwarded correctly. This email should show up in the slackbot dm.
- Go to api.slack.com/apps and create a new Slack app.
- Save the following details: App ID and Verification token
- In "Sidebar -> OAuth and Permissions" give the permissions for:
chat:write
,im:history
in User Token Scopes
- Then Install the app from "Sidebar -> OAuth and Permissions"
- get 7 vars. These will be used in the next step.
Config Variable | Description |
---|---|
APP_ID |
You get this when you create the app |
VERIFICATION_TOKEN |
You get this when you create the app |
TEAM_ID |
ID of your slack workspace. |
USLACKBOT_CHANNEL |
The ID of the direct messaging channel between you and @slackbot |
VERIFICATION_TOKEN |
You get this when you create the app |
SEND_TO_CHANNEK |
The ID of the channel that u want to send |
USER_TOKEN |
User OAuth Toekn, on OAuth& Permissions page |
Use button can deploy to heroku quickly. please input all 7 config vars.
- Navigate to "Sidebar -> Event Subscription" and turn on.
- Put the link to the deployed server in "Request URL".
- Subscribe to
message.im
in Subscribe to events on behalf of users
Viola the setup is complete!
Make sure you have Node.js installed.
$ git clone https://github.com/eskimo220/email----slack.git # or clone your own fork
$ cd email----slack
$ npm install
$ npm run dev
Your app should now be running on localhost:3000.
Sometimes We want to send the email to multiple channels under certain conditions, Use the DECODE vars.
FROM_OR_TO_EMAIL_ADDRESS1,CHANEL_ID1,FROM_OR_TO_EMAIL_ADDRESS2,CHANEL_ID2