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, Outlook, or a custom-domain IMAP/SMTP inbox.
- /check-accounts: Show connection status.
- /get-emails: List inbox emails.
- Usage:
/get-emails gmail [pageSize] [nextToken] [upload],/get-emails outlook [pageSize] [skiptoken] [upload], or/get-emails custom [pageSize] - 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 1,/open-email outlook 2, or/open-email custom 1(indexes from the latest fetch)
- Usage:
- /reply-email: Reply to a listed email.
- Usage:
/reply-email gmail 1 Thanks for the update cc:[email protected] bcc:[email protected](indexes 1–5 from latest fetch)
- Usage:
- /search-email: Search inbox and get quick open links.
- Usage:
/search-email gmail invoice,/search-email outlook project, or/search-email custom invoice
- Usage:
- /send-email: Opens modal to send email (supports send now, save as draft, send later, CC, BCC, and attachments).
- /star-email: Star/flag an email.
- Usage:
/star-email gmail 1,/star-email outlook 1, or/star-email custom 1
- Usage:
- /unstar-email: Remove star/flag from an email.
- Usage:
/unstar-email gmail 1,/unstar-email outlook 1, or/unstar-email custom 1
- Usage:
- /archive-email: Archive an email.
- Usage:
/archive-email gmail 1,/archive-email outlook 1, or/archive-email custom 1
- Usage:
- /delete-email: Move an email to trash/deleted items.
- Usage:
/delete-email gmail 1,/delete-email outlook 1, or/delete-email custom 1
- Usage:
- /move-email: Move an email to a Gmail label, Outlook folder, or custom IMAP folder.
- Usage:
/move-email gmail 1 Label Name,/move-email outlook 1 Folder Name, or/move-email custom 1 Folder Name
- Usage:
- /starred-emails: List starred/flagged emails.
- Usage:
/starred-emails gmail [limit],/starred-emails outlook [limit], or/starred-emails custom [limit]
- Usage:
- /archived-emails: List archived emails.
- Usage:
/archived-emails gmail [limit],/archived-emails outlook [limit], or/archived-emails custom [limit]
- Usage:
- /sent-emails: List sent emails.
- Usage:
/sent-emails gmail [limit],/sent-emails outlook [limit], or/sent-emails custom [limit]
- Usage:
- /unread-count: Show inbox unread count.
- Usage:
/unread-count gmail,/unread-count outlook, or/unread-count custom
- Usage:
- /disconnect-email: Disconnect one provider from your Slack account.
- Usage:
/disconnect-email gmail,/disconnect-email outlook, or/disconnect-email custom
- Usage:
- /clear-bot: Clears bot messages in the channel.
- You can connect Google, Microsoft, or a custom-domain IMAP/SMTP 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 drafts, CC, BCC, attachments, and scheduling !
- You can switch between inboxes efficiently.
Custom domain inboxes
- Use
/connect-emailand choose Custom Domain. - Enter your email address and choose your email host.
- Enter the password/app password in the next modal.
- Supported presets: Zoho Mail, Google Workspace, Microsoft 365, Namecheap Private Email, and cPanel/Webmail.
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, Nodemailer (custom SMTP)
- 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, /star-email, /unstar-email, /archive-email, /delete-email, /move-email, /starred-emails, /archived-emails, /sent-emails, /unread-count, /disconnect-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 !