/arxiv-crawler

arxiv crawling slack bot runnnig on AWS Lambda

Primary LanguagePython

arxiv-crawler

Arxiv crawling slack bot runnnig on AWS Lambda

日本語のREADME -> https://qiita.com/kamata1729/items/eb7b8a30749138a66788

What this slack bot does

  1. Get new arxiv cs.CV papers publiched in the last day (If you want to change this category, please change search_query argument of arxiv_crawl.get_new_arxiv_papers)
  2. Translate its abstract into Japanese
  3. Post message to slack workspace like below:

Usage

1. Create slack bot

1.1 Create slack app & bot user

Open https://api.slack.com/apps?new_app=1 to create slack app
Then, go to Bot users tab and create bot user of the app

1.2 Add permission to your slack bot

Open OAuth & Permissions and select permission scope like below image.
Your bot needs chat:write:bot permission.

1.3 Install slack bot to your workspace

install bot to your workspace.
after installing, do not forget to memo the access tokens in below image.

2. Setup Google Translation API

Go to https://cloud.google.com/ and enable Google Translation API
After that, you have to get API key.
This API costs some money, so I recommend you to register free trial

3. Upload scripts to AWS Lambda

3.1 Make zip file

run below to create arxiv_crawler.zip

bash make_zip.sh

3.2 Upload zip file to AWS Lambda

Create your lambda function and upload arxiv_crawler.zip
The function handler should be specified as arxiv_crawl.lambda_handler

3.3 set enviroment params

Like below image, set parameters.
CHANNEL_ID is the id of the slack channel which this bot will post messages

3.4 Set CloudWatch Events trigger

Add CloudWatch Events trigger from the left-side list

Define trigger role of the CloudWatch Events like below:
Under cron(0 6 * * ? *), bot will post message once a day at 15:00 PM (JST)