Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/isiah-lloyd/email2slackbot
Checks IMAP server for new mail and posts it in a Slack channel
https://github.com/isiah-lloyd/email2slackbot
email imap python slack slack-bot
Last synced: 10 days ago
JSON representation
Checks IMAP server for new mail and posts it in a Slack channel
- Host: GitHub
- URL: https://github.com/isiah-lloyd/email2slackbot
- Owner: isiah-lloyd
- Created: 2017-02-04T05:16:56.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T23:40:52.000Z (almost 2 years ago)
- Last Synced: 2024-10-15T18:01:03.056Z (22 days ago)
- Topics: email, imap, python, slack, slack-bot
- Language: Python
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Email2SlackBot
Checks IMAP server for new mail and posts it in a Slack channel## How to use:
1. Create a new Incoming Webhook custom integration for your Slack channel (https://slack.com/apps/A0F7XDUAZ-incoming-webhooks)
2. `$ git clone https://github.com/isiah-lloyd/Email2SlackBot.git`
3. `$ virtualenv venv`
4. `$ source venv/bin/activate`
5. `$ pip install -r requirements.txt`
6. Enter your Webhook URL from Slack into the `settings.example.ini` file along with your email server configuration
7. Rename `settings.example.ini` to `settings.ini`
8. `$ python main.py`
9. The program is now setup and will check for new mail and post it to slack on subsequent runs
10. Run `python main.py` using a cron jobDo not modify `last_uid.txt` created by the program but if you are encountering issues it maybe a good idea to regenerate the file by deleting it.
## Storage Options
By default, the bot stores the last uid in `last_uid.txt` on your local machine. However, by setting `storage_location = s3` and setting `aws_access_key_id`, `aws_secret_access_key`, and `aws_s3_bucket_name` in your `settings.ini` you can use Amazon S3 for storage.
Ensure your `aws_s3_bucket_name` exists on S3.
## Serverless Function
Deploying to AWS Lambda or other serverless service is an option. Deploying to AWS Lambda is painless with [Serverless](https://github.com/serverless/serverless).
Node.js is required for Serverless deployment. Install Serverless with `npm install -g serverless`. Then install the devDependencies with `npm install`. Finally, deploy with `serverless deploy`.
After deployment, ensure all necessary environment variables are included with your function. You can do this on the AWS console or with the AWS cli.
All serverless configuration is handled in `serverless.yml`. By default, `serverless.yml` configures the bot to run every 10 minutes.
Quick serverless commands:
- Deploy: `serverless deploy`
- Manually invoke a function: `serverless invoke -f run -s [STAGE] -r [REGION] -l`
- View the logs for a function: `serverless logs -f run`Note: use `--aws-profile [PROFILE]` with these commands if you have more than one set of AWS credentials in your `~/.aws/credentials` file