- August 13, 2017
- 1 min read
Updates To Foodtruck Bot
I made few enhancements over the weekend to seattle food truck bot. If you haven't read my previous post on seattle food truck bot I suggest you head over to this link
- Monday - Friday update a channel in slack with food trucks available for a specific number of locations
- T-Mobile has multiple locations (Factoria, Bothell etc.) where we get food trucks for lunch. By automatically updating trucks for these locations we no longer need someone asking the bot to show trucks at these locations daily, Mon-Friday
How this is Implemented
- Pretty simple, I found a golang package that implements cron spec parser and a job runner. For more information see
- Created a function that takes collection of locations as input and return a formatted message that can be posted to Slack channel. Using the Cron scheduler functionality in the cron package mentioned above, scheduled execution of this function at 8AM Mon-Fri and post message to slack channel configured. See sample code below
if len(locations) > 0 && channel != "" {
fmt.Println("Creating a new instance of Cron Scheduler")
c = cron.New()
c.AddFunc("0 0 08 * * mon-fri", func() {
fmt.Println("Executing func in Cron")
message, err := showTrucksForLocations(locations)
if err != nil {
fmt.Println("Failed to get trucks for locations")
} else {
log.Println("Message : ", message)
responseHandler(channel, message)
}
})
//Start the Cron
fmt.Println("Starting Cron")
c.Start()
}- Screenshot below shows slack message posted to "#food" channel by the BOT for T-Mobile Factoria and Bothell locations.
- Format time as AM/PM
- Previously when the bot shows trucks at a specified location it use to display time in 24hr format. This is now changed to show time as AM/PM. See example in screenshot below
Deployment
If you are deploying this bot in a docker container, when you run the container LOCATION_IDS and CHANNEL environment variables need to be set as shown in example below
docker run -d -e SLACK_TOKEN=<replace with token> -e LOCATION_IDS=<replace with comma delimited location ids you are interested> -e CHANNEL=<replace with slack channel> rprakashg/foodtruck-slack-botIf you are deploying this bot in heroku as I have done for our team, you can simply configure CHANNEL and LOCATION_IDS in heroku for the app under Config Variables in Settings tab as shown in screenshot below
Cheers,
Ram
Related Posts
RAM GOPINATHAN
September 17, 2026
Onboarding Edge Devices to FlightCTL with FIDO Device Onboarding
How I wired FDO's owner service, a bootc image layering go-fdo-client on the FlightCTL agent base, and two Ansible playbooks together so edge devices enroll into FlightCTL with zero manual steps.
RAM GOPINATHAN
September 14, 2026
Provisioning Devices and Onboarding to FlightCTL
Building a bootc image with the FlightCTL agent, baking it into an AMI, and provisioning EC2 test devices that inject their enrollment credentials via cloud-init and show up as pending enrollments in FlightCTL.
RAM GOPINATHAN
September 12, 2026
Deploying FlightCTL on EKS: Edge Fleet Management with Keycloak OIDC
A step-by-step walkthrough of standing up FlightCTL on Amazon EKS with Keycloak OIDC auth, ALB ingress, and a dedicated NLB for mTLS device enrollment.