Last Update: September 2023
When I tap the top of my pill case with my phone it updates my beeeminder goal automatically. I like to put a dot on the top so I remember where to tap.
NFC tag sticker attached to bottom of 3D printed pill case.
Overview
Beeminder is a powerful tool that translates long-term goals into actionable daily tasks, using financial penalties for motivation. While Beeminder is highly effective, manually entering data each time you complete a task is tedious and disruptive. I’ve solved this by using NFC tags to automate tracking tasks like taking vitamins. This tutorial is designed for iOS but can be adapted for Android.
Concept: Streamline your Beeminder tasks with NFC tags. To use custom Beeminder integrations we need to send a specially formatted URL to Beeminder. We can do this with Apple’s Shortcuts app. We can then trigger the shortcut by scanning an NFC tag with our phone.
A spool of NFC tag stickers. These are easily available and very cheap.
20 NFC Tags Available for Around $5 on Aliexpress in 2023
Technologies Used
- NFC Tags
- iPhone
- Apple’s Shortcuts App
- Beeminder API
Implementation Steps
1. Obtain an NFC Tag
Select a tag that adheres well to your desired item. Most non-metallic materials won’t interfere with the tag.
2. Identify a Beeminder Goal and get its “Slug”
Locate or create a Beeminder goal and note its name or slug. For instance, if your goal URL is https://www.beeminder.com/yourUserName/Vitamins
, “Vitamins” is the slug.
3. Get a Beeminder API Token
Located in your account settings under “Apps and API”.
4. Set Up a Shortcut
Open Apple’s Shortcuts app and add a URL action.
You can modify my URL with your actual values:
https://www.beeminder.com/api/v1/users/[yourUsername]/goals/[slug]/datapoints.json?auth_token=[token]&value=1&comment=via%20shortcuts
Notice in my example below that the slug is “nac”. That is the name of this particular goal in my account.
Add a Get contents of URL action and select the URL we just made as the URL variable.
Get contents of URL (Expanded)
Here is what that action looks like when expanded. Make sure your settings look like this.
Your shortcut should now look like this (your URL will look different because it will have your fieldnames and slug. Feel free to name it whatever you want.
Now, save your shortcut and test it.
If successful, you should see a datapoint added to your goal in the Beeminder mobile app or website.
5. Register Your NFC Tag and Test Automation
In the Shortcuts app, create an automation triggered by your NFC tag by opening the Automations tab, making a new one, and searching for NFC. From there you can scan your tag and give it any name. Choose “run immediately” and “notify when run.” Click Next then select the shortcut we made earlier. For me there’s a “My Shortcuts” section on this page and I can select my shortcut from there.
You should now be able to run your shortcut by tapping your phone to the NFC tag! You should now be able to run your shortcut by tapping your phone to the NFC tag!
Results
The system works reliably. I’ve been using this concept several times per day for various tasks: logging supplements, workouts, etc. Any wear and tear on the tags is a non-issue due to their low cost.
Future Work
I plan to integrate NFC tags into 3D-printed objects for a more seamless interaction.
FAQs
How do I replace a damaged NFC tag? Update the automation to reference the new tag. No code changes required.
Can I decrement the goal?
Yes, adjust the value
field to -1.
Can I increment by more than 1?
Yes, set the value
field accordingly.
Can I customize the comment field?
Yes, use %20
for spaces. E.g., “via%20shortcuts”.
Is this compatible with various NFC forms? Yes, as long as your phone can read it.
Which iPhones support NFC? iPhone 7 or newer.
Can I manually trigger a shortcut? Yes, just tap the shortcut in the app.
Can I use this with Android? I’m sure this can be adapted for use with Tasker or similar apps. The important part is the URL action. We basically just need to send a specially formatted URL to Beeminder when the tag is scanned.
References
- Beeminder Blog: Akrasia and Self-Binding
- The 3D print files I used for the pill containers (Note: I’ve had success scaling these in my slicer. It’s really easy to make custom sizes.)