![Screenshots] (http://s21.postimg.org/v474g4o1j/Screen_Shot_2016_03_26_at_3_17_47_PM.png) ![Screenshots] (http://s30.postimg.org/hv1ccew29/Screen_Shot_2016_03_26_at_3_22_53_PM.png)
##Background
At MortgageClub, we have free catered lunch everyday. Previously, (1) our assistant would ask us what we want for lunch, (2) we then go to the restaurant website (giachanhcamtuyet, for example), (3) choose what we want to eat, (4) tell the assistant, and finally (5) she would place an order on the restaurant website.
We thought that we could create a Slackbot to automate all of these steps. So our team spent 2 days to code it up as a year-end fun project. We thought it might be useful to other engineering teams in Vietnam as well so we've made it public.
##Usage
- Slack channel will receive today's menu in this format:
- Bò xốt tiêu xanh - bánh mì - 33000.0 VND
- Ba chỉ xào ruốc sả - 29000.0 VND
- Cá rô chiên giòn - 29000.0 VND
- Gà xào cari - 29000.0 VND
- Ếch xào lăn - 33000.0 VND
- Every dish has a format: {item-number} {dish-name} - {price}
Members use these command to place orders.
One dish #happylunch item-number.
- Ex: #happylunch 1
Several dishes #happylunch item-number1,{space}item-number2,{space}item-number3.
- Ex: #happylunch 1, 2, 3
##Install
-
Implement Slack's webhook
-
Implement Slack's Incoming Webhook.
-
Implement Slack's Outgoing Webhooks.
-
Outgoing's Trigger Word: #happylunch (or whatever you like).
-
Outgoing's URL: http://your-domain/orders
-
Notice: your channel you choose will be a place members place orders.
-
Deploy the Rails app to a hosting provider. Notice: if you don't use Heroku, you need to install PhantomJS in your server.
-
Set contact information, Slack's authentication token and Slack's outgoing token to environment variables.
FULLNAME='Nguyen Van A'
ADDRESS='93bis Nguyen Văn Thu, P. Da Kao, Q.1'
TELEPHONE=097990xxyy
EMAIL=nguyenvana@gmail.com
SLACK_TOKEN=xoxp-your-authentication-token-XXYY
OUTGOING_TOKEN=sk15-your-outgoing-token-XXYY
- Set up a scheduler to call below rake tasks. You can choose your ideal time.
# 8:30 AM get menu from GiaChanhCamTuyet & send menu to Slack
rake slack:get_menu
# 9:00 AM remind members who haven't ordered lunch
rake slack:remind_members_order_lunch
# 9:30 AM order lunch automatically
rake slack:order_lunch
See demo images at demo.html
See CONTRIBUTING.md.
Thank you, contributors!
MIT License. Copyright 2015-2016 MortgageClub.