Automated Meal Planning with Trello
How I built a random meal generator and a meal planner inside Trello
For those who didn’t get a chance to join the livestream last week, I created an automated meal planner in Trello! (If you want to watch the whole process, here’s the livestream - skip the first 20 min as it’s just me waiting around and testing OBS things.)
If you don’t want to watch an hour-ish of my brain (and phew I don’t blame you), then keep on reading. I’m going to walk you through what I built and how you can use the template if you’re interested.
You’re probably gonna wanna read this in your browser and not your email client, so if you’re in your inbox right now and yeet over to a browser, just head here.
Prefer to watch a video?
I created this 8 min version showing a demo and walkthrough, but since there’s a lot of automation and it doesn’t easily copy and paste over, you’ll still have to build those rules, so you might want to stick around as I’m going to make some gifs that show you each rule so you can quickly assemble this for yourself!
Quick highlights about what it does
This board is one of the coolest ones I’ve ever made - not to brag.
But it …
Randomly generates 3 meals with the click of a button.
Swap a meal and get another
Generate a shopping list based on meals you approve for the week!
Ready to start using it? Let’s get started!
Copy the template
Start over here by copying the Automated Meal Planning Template.
Quick note about the structure of this board:
The first list is a “Shopping List”, you can manually add things in here, but we also will build some automation to put things in there. Each item is a card.
“Meals On Deck” is basically your queue for “next up” meals and what you’re planning to make.
Each of the following lists are “types” of meals. I went with Generic, Quick, Meatless, New, and Sides. But you can make these whatever you want. Just make sure be consistent in how you reference them so the automation works, and if you’re not very comfortable with Butler/Trello automation yet, I recommend sticking with what I’ve got for now so you can use the exact same rules I have, then you can customize them later when you’re more comfortable with the automation!
Add your recipes
This is the fun part! Add your recipes to the lists in here. If it’s a new recipe you haven’t tried, move it under “New”. If it fits your definition of quick and you’ve done it before, put it in the “Quick” list. If meatless, etc… If it doesn’t really fit any other category, just store it in “Generic”.
If you hate going through recipe links to find the ingredients and descriptions, check out this handy Chrome Extension that will bring up a pop up on a recipe page that shows you the key stuff. You can just copy and paste that into the description of your Trello card.
🚨 Super important!! When you’re adding recipes, you’ll need a checklist for each of the ingredients in order to be able to create that shopping list.
If you already have a list of ingredients highlighted, you can copy and paste the whole list of ingredients once and Trello will make it separate items for each recipe, like this.
Okay let’s add all the rules!
This is the hardest step, so I’m going to make a gif showing you how each Butler rule should work. I’m also going to explain what each rule does you you can decide if you want to implement it or not.
We’ll start with what I think are the most important ones.
Custom Fields
** Do you have Trello Standard or higher? If so, I recommend using a Custom Field called “Origin” as I have some rules set up around that field. It will help map a card back to its original list. This board is definitely useful without it, but it’s a really handy feature to just apply a label and send a card back where it came from originally.
If you have Trello Standard when you create a board from this template, it should copy over the custom field. When you click “Show menu” in the top right and click “Custom Fields” it should look like this
(If it doesn’t, just click, “add” and type origin then select type of “text”. It’s up to you if you prefer to show it on the front of the card or not. I do, but it’s total preference and won’t mess the workflows up either way.)
Okay, now let’s build a rule to automatically set this custom field. Go to automation, then “rules”, and add a new rule, just like this:
Random meal picker buttons
Now head to the Board Buttons section of Automation, and click “create new”.
Totally up to you how many of these you want to do, but I created a button for each type of meal (quick, meatless, generic, new, and sides). They’re all the same type of button, so once you make the first one, just copy the rule and change the list it originates from.
This rule says when the button is clicked to randomly move one card from x list to the “Meals on Deck” list.
You can even select an icon for the button if you want (where I click “icon”).
Now just copy that rule and then swap out the list name for “Generic”
And just change the title and select “Generic” instead of “New”.
Go ahead and do this again for Meatless, and once more for “Sides”. (If you have any other lists with meal types, you can make it for them too.
Okay, one more board button! This one will pick a random meal from every list (or however many lists you set it to.)
This is just like the other buttons we’ve set… you just add all of those actions in one list. So it should look like this.
Create a “veto” rule
If you want to be able to send back a meal that was randomly generated, this is really easy to do if you already set up the origin rule and custom fields. If you haven’t done that, go back and do that.
Once that rule is available, you’ll just need to create one rule. You could technically make this as a card button if you wanted to but I preferred a label. The trigger is up to you! (You could make a “rejects” list and if a card moves into that then it moves back to its original list.) Totally up to you what the trigger is, but here’s how I set it up by adding a label trigger.
The actions are just to move it back to the list with the name in the origin custom field (since that was set when it was added to the board). And I added an additional label to remove that label when it’s done.
Woohoo!
So now by this point, you have a recipe bank, a random meal generator, and a way to send back a recipe and pick one new one from a genre/category!
Rules for creating a shopping list
Okay, this part gets a little hairy, but stick with me. It’s really just a couple of rules.
🚨 First of all, remember when you added your recipes? I want to once again reiterate that you need to have the ingredients listed in a checklist in the card. This can be tedious, but it’s essential for building out this grocery list. 🚨
Creating the list
Now, we’ll make a rule that says when a meal is approved (again, you make this trigger anything you want, but I am going with adding a label), to add the items in the checklist of that card as new cards under the Shopping List.
You might be like - wait! I want to automate this so that it happens whenever a card is added to Meals On Deck! Then I don’t have to add a label! I initially started with this, but got really annoyed when it would start adding ingredients and I wasn’t even sure I wanted that meal. So I decided to add a trigger and wait until I’d actually agreed I want that meal it picked for me.
Note! To find the “for each item in checklist” command, you’ll need to go to the “cascade” section. I always forget where it is, so hopefully, this helps you if you’re stuck.
Use the {checklistitemname} variable for card name as that will grab the name of the checklist item and create a card with that name.
Adding labels for grocery store section
This one is a bit advanced, but I’ll walk you through it and I find it really helpful! Feel free to skip this at first if you want, and you can add it back in later. You’ll also likely need to edit this from time to time as you think of more things you want to include in the categories.
Also, special shoutout to @milynnus in the Atlassian Community for helping me figure this one out!
I wanted to add labels to cards based on what part of the grocery store they’re in. Although I could have gone wild with this, I stuck with produce, dairy, meat, and other. Instead of making a rule for each type of ingredient, I wanted to make one rule that worked for several ingredients, and the way to do that is just like this!
**Note! It is case-sensitive, so I duplicated each item with a capitalized and non-capitalized version.
** Other note! You can add as many as you want in here! Hopefully, the syntax makes sense, but it’s basically just item|anotherItem| etc.
** Okay one last note. I originally made this trigger “when a card is added to a board with content that contains …” but I ended up changing to “when a card is added to the Shopping list with a name that contains …” because I realized I actually only wanted this to do it with Shopping list items and not meal names that often include those items in the recipe name.
If you want to copy and paste the syntax here ya go
`regex:/.*(egg|milk|cookies|cream|cheese|yoghu|Egg|Milk|Cookies|Cream|Cheese|Yoghu).*/`
Create a board button for sorting cards by grocery section
To make it easy to see all these shopping list items grouped together, just create a board button that sorts all the cards in the Shopping List by label.
Bonus Rules
I have a few more rules that are not required, but I am finding helpful, so feel free to use if you’d like, but at this point you’ve already got the key ones!
Auto archive things you have at home from shopping list
I don’t want things like salt to my grocery list, so I create a rule to automatically archive salt. I’m probably going to more things like olive oil, pepper, etc. here.
Auto-generate meals each week
I created a calendar rule for every week on Friday at 5pm it will basically do the same thing my “pick week’s meals” button will do.
This way, by 5pm on Friday, i don’t even have to click anything, I just go to my Trello board and meals are sitting there ready for me to approve, then create a shopping list for the weekend.
And that’s really about it!
Troubleshooting
Okay followed all the rules and it’s not working? Here are some ways to troubleshoot.
Make sure you added ALL the rules. I generally specified if something was optional, but if something is not working as expected, make sure you actually added the rule for that.
Here’s a checklist of the rules you should have in place and what they do so if something isn’t working, see what rule it’s associated with and troubleshoot from there.
Board Buttons
Pick week of meals (grabs a random card from each of the lists)
Pick New meal (grabs a random card from “New” list)
Pick Quick meal (grabs a random card from “Quick” list)
Pick Generic meal (grabs a random card from “Generic” list)
Pick Meatless meal (grabs a random card from “Meatless” list)
Pick Side (grabs a random card from “Sides” list)
Sort Shopping List (sorts all the cards in Shopping list by label).
Rules
When card is added to board, update custom field “Origin” with {cardlistname}
When the return label is added to a card, move to {{%origin}} list
When approved label is added to a card, for each checklist item, create a new card with title {checklistitemname} in the Shopping List
3 “when card contains regex rules…” that add labels to cards based on if they’re produce, dairy, or meat. Should look like this
When the name of a card in list "Shopping List" contains "salt", archive the card
Calendar Rules
Every friday at 5:00 pm, move 1 randomly-selected cards from key lists to your Meals on Deck list (same as the action for your “pick weekly meals” button)
Make sure your syntax is correct. Make sure the rules look the same in your Butler/Automation section as mine do in the screenshots. I recommend only customizing and changing the code if you are comfortable with Butler! If you are not, then do everything exactly as I’ve got it laid out at first, and as you get more comfortable you can modify it based on your preferences!
Post in the Atlassian Community (in the Trello section). Make a post in the Atlassian Community, and mention what you’re trying to do and what is actually happening. Feel free to tag me in the post and I’ll be more likely to see it, but even if I don’t see it, someone else will likely be able to help you out! (You can reference this post if that helps)
Comment below or send me an email. If you’re stuck, just comment on here or send me an email and I’ll be happy to help you out with whichever part isn’t working!
That's brilliant, I am most definitely going to try this.
Oh hey, you've changed my life... blown my mind... was just here for the meal planning (which is FIRE) but learned how to use regex and not have to replicate all my rules for automations! You're the best.
Just a few things I learned that might make life easier for folks doing this in the future;
1. The format for the regular expression is regex:/.*(item|item).*/ this is what goes into the field in Trello.
2. ChatGPT has saved me 20 years of my life by formatting long raw ingredients lists into categories (like dairy, deli, meat, pantry, etc) and generating the regular expressions
3. Trello doesn't seem to like spaces in these regular expressions, so you will need to use dashes; both in the rule, AND in the ingredients lists, AND in recipe titles. For example, olive-oil. This matters for me because I want rules for the shopping list to automatically categorise groceries into supermarket departments (like freezer, dry goods, deli, and so on). The deal is: I do the grocery list in an easily usable way and my partner goes to the store, so it's a big one!
4. You can use the flag "i" to let trello ignore case sensitivity. For example regex:/.*(chicken).*/i will recognise both Chicken and chicken (and probably ChiCkEn. But I'm not a psychopath).
5. I just used chat GPT to create the regular expressions for my rules using a very long and unformatted list of grocery items that I copied from my regular shopping list. Just saying, for any folks out there typing it out item by item!p0-