/scriptable-shopping-list

Scriptable script for autogenerating shopping lists from your favorite recipes

Primary LanguageJavaScript

Scriptable Shopping List

This collection of scripts is meant to be run in the Scriptable app for iOS. It presents you with your favorite recipes and uses your selection to create a list of required ingredients as a checklist inside an Agenda project. It fetches the recipe data from a Contentful space.

Click here for a short demo video.

Prerequisites

  • Install Scriptable on your iPhone/iPad
  • Install Agenda on the same device, create an account and sign in
  • Create a Contentful account

Prepare the database

In contentful, create a space with two collections: recipes and ingredients.

The ingredients collection only needs to have a plain text title field. An example ingredient entry looks like this:

{
    "title": "Aubergines"
}

The recipes collection needs to have two fields:

  • title for storing the recipe's name (plain text)
  • ingredients for storing references to ingredients and the associated amount. Use the "JSON object" field type for this. Use the contentful-ingredients-field-app extension, if you want a nicer UI than just a JSON editor.

An example recipe entry looks like this:

{
    "title": "Mac 'n' Cheese",
    "ingredients": [
        {
            "amount": "200 g",
            "id": "<ingredient-id>"
        },
        {
            "amount": "500 ml",
            "id": "<ingredient-id>"
        }
    ]
}

Prepare the script

Copy the contents of this repo into your Scriptable folder. Usually this is the /Scriptable/ folder in your iCloud Drive. Make sure to not miss the ./recipe-shopping-list/ subfolder from this repo.

Open [Shopping List.js](./blob/master/Shopping\ List.js) and replace lines 20 and 21 with your Contentful credentials:

19  const contentful = new ContentfulClient({
20      accessToken: '<your-contentful-access-token-here>',
21      spaceId: '<your-contentful-spaceid-here>',
22      environment: 'master'
23  });

Make sure all files are synced to the device your running Scriptable and Agenda on.

You should now see a script called "Shopping List" in your Scriptable app. Run it and enjoy never having to write shopping lists again ;)

Feedback

Feel free to drop me a line via email or Twitter.