Send a fairbinden lunch menu to Slack by expressjs
This program is to scrape daily lunch menu at Fairbinden blog and extract the main information to send to your Slack channel during weekdays.
Tech Stack
- Nodejs
- Express
- Docker
- Set up webhook channel url as export variables
NODE_ENV=PRD
WEB_HOOK_URL=https://hooks.slack.com/services/xxxxxx/xxxxx/xxxxxxxxxxxxxxxxxxxxx
CHANNEL_OFFICE_BEN=https://app.slack.com/client/xxxxxxxxxxxxxxxx
-
Deploy the code to the Source Repository
-
Create a service in the Cloud Run, connecting to the Source Repository
-
Set up a cloud scheduler to trigger the function at 10 a.m. every Weekday
- Set up webhook channel url as export variables
NODE_ENV=STG
WEB_HOOK_URL=https://hooks.slack.com/services/xxxxxx/xxxxx/xxxxxxxxxxxxxxxxxxxxx
CHANNEL_OFFICE_BEN=https://app.slack.com/client/xxxxxxxxxxxxxxxx
- Start the app locally, using docker-compose
docker-compose up
- Call the app
curl -H "Content-Type: application/json" -X POST -d '{"lunchDate":"2021-04-05T11:10+09:00"}' "localhost:8080/fairbinden"
- lunchDate
- desc: date for lunch information
- format: date string
- example: "2021-04-05T11:10+09:00"
- webHookURL: URL string
- desc: Slack incoming webhook URL
- format: URL string
- example: "https://hooks.slack.com/services/xxxxxx/xxxxx/xxxxxxxxxxxxxxxxxxxxx"