Slack Mail is a slack bot which helps the user to access their email, not only accessing but also do most of the tasks like a normal inbox without leaving Slack
- Go to Slack and search for Slack Mail or directly access it by clicking Slack Mail.
- Over there you need to login first using /connect-email
- Click your provider, for now its only Google & Microsoft.Once you authorize the access you will be able to use the full potential of the bot bot
Commands
- /connect-email: Connect Gmail or Outlook.
- /check-accounts: Show connection status.
- /get-emails: List inbox emails.
- Usage:
/get-emails gmail [pageSize] [nextToken] [upload]or/get-emails outlook [pageSize] [skiptoken] [upload] - Defaults to 5; max 50. Include
uploadto also upload attachments to Slack.
- Usage:
- /open-email: View full content of a specific email.
- Usage:
/open-email gmail 1or/open-email outlook 2(indexes from the latest fetch)
- Usage:
- /reply-email: Reply to a listed email.
- Usage:
/reply-email gmail 1 Thanks for the update(indexes 1–5 from latest fetch)
- Usage:
- /search-email: Search inbox and get quick open links.
- Usage:
/search-email gmail invoiceor/search-email outlook project
- Usage:
- /send-email: Opens modal to send email (supports attachments, schedule).
- /clear-bot: Clears bot messages in the channel.
- You can connect Google or Microsoft Account.
- You can access the last 5 emails from your primary inbox.
- Attachments are supported in emails, so if there are any you can access it.
- You can send emails from slack itself with attachments !
- You can switch between inboxes efficiently.
git clone https://github.com/adhyys07/slack_Mail.git
cd slack_Mail
npm install
Framework / Packages
- Node.js + Express (API and routes)
- Slack Bolt (Slack commands + views)
- Google APIs (Gmail send/read/attachments)
- Microsoft Graph (Outlook send/read/attachments)
- Redis (token store)
- Axios (HTTP), IMAP client
- Heroku (For Bot Hosting)
Environment Variables
SLACK_BOT_TOKEN=your_slack_bot_token
SLACK_SIGNING_SECRET=slack_bot_signing_secret
GOOGLE_CLIENT_ID=google_client_id
GOOGLE_CLIENT_SECRET=google_client_secret
GOOGLE_REDIRECT_URI=https://server_url/auth/google/callback
MS_CLIENT_ID=microsoft_client_id
MS_CLIENT_SECRET=microsoft_client_secret
MS_REDIRECT=https://server_url/auth/microsoft/callback
REDIS_URL=your_db_url
BASE_URL=https://server_url
PORT=3000
PORT=3000
- Create a Slack App: https://api.slack.com/apps → "Create New App" → From scratch.
- Basic info: Add name/icon and choose your workspace.
- OAuth & Permissions:
ns:
- Scopes (Bot Token):
commands,chat:write,files:write,im:history(if needed), plus any others your flows require. - Install to Workspace → copy
SLACK_BOT_TOKEN.
- Scopes (Bot Token):
- App Credentials: copy
SLACK_SIGNING_SECRET. - Slash Commands:
- /connect-email, /get-emails, /open-email, /reply-email, /send-email, /search-email, /clear-bot
- For each command set the Request URL to:
https://your-server.com/slack/events
- Event Subscriptions:
- Enable events; Request URL:
https://your-server.com/slack/events - Subscribe to bot events if needed (e.g.,
app_home_openedif you add a home tab).
- Enable events; Request URL:
- Interactivity & Shortcuts:
ts:
- Enable and set Request URL:
https://your-server.com/slack/events
- Enable and set Request URL:
- Environment:
- Set
SLACK_BOT_TOKENandSLACK_SIGNING_SECRETin your hosting environment.
- Set
- Deploy:
- Ensure your server (Express + Bolt) listens on
/slack/eventsand that your public BASE_URL matches the URLs above.
- Ensure your server (Express + Bolt) listens on
- Reinstall after scope or command changes.
I have used AI for bug fixing and code suggestions, also at some place to modify some features for this bot !