https://github.com/intrepidpursuits/lunchtrain
Lunch Train is a Slack app written in PHP to help coordinate team outings
https://github.com/intrepidpursuits/lunchtrain
Last synced: about 1 year ago
JSON representation
Lunch Train is a Slack app written in PHP to help coordinate team outings
- Host: GitHub
- URL: https://github.com/intrepidpursuits/lunchtrain
- Owner: IntrepidPursuits
- Created: 2017-08-30T23:09:12.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-31T21:27:05.000Z (almost 9 years ago)
- Last Synced: 2025-03-25T02:43:45.582Z (about 1 year ago)
- Language: CSS
- Homepage: http://slackapi.github.io/lunchtrain/
- Size: 949 KB
- Stars: 0
- Watchers: 7
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

## Lunch Train
This repo contains the code for the Slack demo app Lunch Train: http://www.lunchtrainbot.com/
Lunch Train is a Slack app that helps you schedule and coordinate team social outings like lunch trips.
### Code Overview
#### Landing page
Landing page HTML is in `index.php` and all the assets are inside these folders: js, img, fonts, font-awesome, CSS
#### Heroku Configurations
app.json, composer.json and Procfile together define the heroku app configuration.
#### Libraries
Files inside `include` directory are various small libraries that are used in Lunch Train
* config.php: Slack app configuration
* db_config.php: Database configuration
* init.php: initial load configuration
* lib_app_installs.php: methods to manage api token storage.
* lib_curl.php: handles http download requests
* lib_db.php: Database management
* lib_message.php: creates message payload for slack messages
* lib_slack.php: methods to post/update messages to slack
* lib_time_parser.php: parse natural language time inside the slash command
* lib_trains.php, lib_train_actions.php:
#### Database schema
schama.sql contains the lunch train MySQL DB schema.
#### Command & Action Requests
* Slash command requests are processed by `command.php`
* Button action requests are processed by `action.php`
* Slack Events API events are processed by `events.php`
#### Setup and Development
1. Create your config file by copying `include/config-example.php` and renaming it to `config.php`, and adding your app's credentials.
2. Setup Heroku locally: https://devcenter.heroku.com/articles/getting-started-with-php#set-up
3. Within the LunchTrain clone, run the line `heroku git:remote -a lunchtrainbot-staging`
4. Install MAMP (apache and MySQL). https://www.mamp.info/en/ and setup database using `schema.sql`
5. Add LunchTrain folder to your webroot.
6. Add the notification cron job:
`cron_leave_now_2_min_warning` is executed every minute to send 2-minute warnings and update the in-channel message that train has left. The cron is executed from `dev-sandbox`. Following is the cron config.
```
* * * * * curl "http://lunchtrainbot-staging.herokuapp.com/cron_leave_now_2_min_warning.php?env=dev"
* * * * * curl "http://lunchtrainbot.herokuapp.com/cron_leave_now_2_min_warning.php?env=prod"
```