{
 "blyg": "0.4",
 "id": "0nhwhy3mfdzdkfegyn32qws5nx",
 "kind": "thread",
 "origin": "https://notionparallax.co.uk/",
 "page": "https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power",
 "author": {
  "name": "Ben Doherty",
  "url": "https://notionparallax.co.uk/"
 },
 "created": "2016-01-11T21:00:03Z",
 "updated": "2016-01-11T21:00:03Z",
 "version": 1,
 "content_md": "# Connecting Rescue time to Habitica: How to reward yourself for doing useful things without using up all your brain power\n\n\n<style type=\"text/css\">\nfigure {\n    width: 33em;\n    margin: auto;\n}\nsvg.prod-graph {\n    width: 63vh;\n    height: 31vh;\n}\n.post img {\n    margin: 1em 0;\n}\nspan.name {\n    color: red;\n}\nspan.direction {\n    color: green;\n}\n</style>\n<p>I like <a href=\"https://habitica.com\" title=\"formerly Habit RPG\">Habitica</a> a lot. I find that it's good at <a href=\"http://habitica.wikia.com/wiki/Adapting_HabitRPG_for_ADHD\">directing my attention</a> and motivating me to do things that are aligned with my goals[^1]. I also use <a href=\"https://www.rescuetime.com\">Rescue Time</a>, it's job is to tell me what I really do with my life. It stops me lying to myself about what my days look like.\n     \n</p>\n<figure>\n<svg markdown=\"0\" class=\"prod-graph\" xmlns=\"http://www.w3.org/2000/svg\" preserveaspectratio=\"none\" viewbox=\"0 0 310 181\" height=\"181\">\n    <g transform=\"matrix(1 0 0 .89485 20 129.754)\">\n        <line class=\"ybaseline\" y1=\"-64.3\" y2=\"-64.3\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-61.3\" text-anchor=\"left\">10h</text>\n        <line class=\"ybaseline\" y1=\"-86.9\" y2=\"-86.9\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-83.9\" text-anchor=\"left\">20h</text>\n        <line class=\"ybaseline\" y1=\"-109.6\" y2=\"-109.6\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-106.6\" text-anchor=\"left\">30h</text>\n        <line class=\"ybaseline\" y1=\"-132.2\" y2=\"-132.2\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-129.2\" text-anchor=\"left\">40h</text>\n        <line class=\"ybaseline\" y1=\"-19\" y2=\"-19\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-16\" text-anchor=\"left\">10h</text>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#c5392f\">\n            <rect width=\"3\" height=\"14.1\" y=\"-30\" x=\"142.7\" />\n            <rect width=\"3\" height=\"16.5\" y=\"-16.5\" x=\"148.1\" />\n            <rect width=\"3\" height=\"10.9\" y=\"-24.7\" x=\"153.5\" />\n            <rect width=\"3\" height=\"15.3\" y=\"-30\" x=\"158.8\" />\n            <rect width=\"3\" height=\"12.7\" y=\"-33.6\" x=\"164.2\" />\n            <rect width=\"3\" height=\"7.1\" y=\"-28.3\" x=\"169.6\" />\n            <rect width=\"3\" height=\"5\" y=\"-30.9\" x=\"174.9\" />\n            <rect width=\"3\" height=\"11.9\" y=\"-31.8\" x=\"180.3\" />\n            <rect width=\"3\" height=\"12.3\" y=\"-34.3\" x=\"185.7\" />\n            <rect width=\"3\" height=\"16.1\" y=\"-36.4\" x=\"191\" />\n            <rect width=\"3\" height=\"9.7\" y=\"-37.1\" x=\"196.4\" />\n            <rect width=\"3\" height=\"10.2\" y=\"-24.4\" x=\"201.8\" />\n            <rect width=\"3\" height=\"4.3\" y=\"-39.9\" x=\"207.2\" />\n            <rect width=\"3\" height=\"12.4\" y=\"-36.5\" x=\"212.5\" />\n            <rect width=\"3\" height=\"12.3\" y=\"-27.9\" x=\"217.9\" />\n            <rect width=\"3\" height=\"19.1\" y=\"-33.9\" x=\"223.2\" />\n            <rect width=\"3\" height=\"16.5\" y=\"-35.3\" x=\"228.6\" />\n            <rect width=\"3\" height=\"14.7\" y=\"-30.3\" x=\"234\" />\n            <rect width=\"3\" height=\"11.5\" y=\"-30.3\" x=\"239.3\" />\n            <rect width=\"3\" height=\"10.5\" y=\"-24.4\" x=\"244.7\" />\n            <rect width=\"3\" height=\"16.6\" y=\"-31.2\" x=\"250.1\" />\n            <rect width=\"3\" height=\"20.8\" y=\"-29\" x=\"255.5\" />\n            <rect width=\"3\" height=\"21\" y=\"-22.4\" x=\"260.8\" />\n            <rect width=\"3\" height=\"11.9\" y=\"-17.8\" x=\"266.2\" />\n            <rect width=\"3\" height=\"15.7\" y=\"-24.5\" x=\"271.6\" />\n            <rect width=\"3\" height=\"12.3\" y=\"-33.6\" x=\"276.9\" />\n        </g>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#92343b\">\n            <rect width=\"3\" height=\"11.7\" y=\"-41.7\" x=\"142.7\" />\n            <rect width=\"3\" height=\"25.1\" y=\"-41.7\" x=\"148.1\" />\n            <rect width=\"3\" height=\"17\" y=\"-41.7\" x=\"153.5\" />\n            <rect width=\"3\" height=\"11.6\" y=\"-41.7\" x=\"158.8\" />\n            <rect width=\"3\" height=\"8.1\" y=\"-41.7\" x=\"164.2\" />\n            <rect width=\"3\" height=\"13.3\" y=\"-41.7\" x=\"169.6\" />\n            <rect width=\"3\" height=\"10.8\" y=\"-41.7\" x=\"174.9\" />\n            <rect width=\"3\" height=\"9.8\" y=\"-41.7\" x=\"180.3\" />\n            <rect width=\"3\" height=\"7.3\" y=\"-41.7\" x=\"185.7\" />\n            <rect width=\"3\" height=\"5.3\" y=\"-41.7\" x=\"191\" />\n            <rect width=\"3\" height=\"4.5\" y=\"-41.7\" x=\"196.4\" />\n            <rect width=\"3\" height=\"17.2\" y=\"-41.7\" x=\"201.8\" />\n            <rect width=\"3\" height=\"1.7\" y=\"-41.7\" x=\"207.2\" />\n            <rect width=\"3\" height=\"5.2\" y=\"-41.7\" x=\"212.5\" />\n            <rect width=\"3\" height=\"13.7\" y=\"-41.7\" x=\"217.9\" />\n            <rect width=\"3\" height=\"7.7\" y=\"-41.7\" x=\"223.2\" />\n            <rect width=\"3\" height=\"6.3\" y=\"-41.7\" x=\"228.6\" />\n            <rect width=\"3\" height=\"11.4\" y=\"-41.7\" x=\"234\" />\n            <rect width=\"3\" height=\"11.4\" y=\"-41.7\" x=\"239.3\" />\n            <rect width=\"3\" height=\"17.3\" y=\"-41.7\" x=\"244.7\" />\n            <rect width=\"3\" height=\"10.4\" y=\"-41.7\" x=\"250.1\" />\n            <rect width=\"3\" height=\"12.6\" y=\"-41.7\" x=\"255.5\" />\n            <rect width=\"3\" height=\"19.2\" y=\"-41.7\" x=\"260.8\" />\n            <rect width=\"3\" height=\"23.9\" y=\"-41.7\" x=\"266.2\" />\n            <rect width=\"3\" height=\"17.1\" y=\"-41.7\" x=\"271.6\" />\n            <rect width=\"3\" height=\"8\" y=\"-41.7\" x=\"276.9\" />\n        </g>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#655568\">\n            <rect width=\"3\" height=\"36.4\" y=\"-78\" x=\"142.7\" />\n            <rect width=\"3\" height=\"43.6\" y=\"-85.3\" x=\"148.1\" />\n            <rect width=\"3\" height=\"24.6\" y=\"-66.3\" x=\"153.5\" />\n            <rect width=\"3\" height=\"9.7\" y=\"-51.3\" x=\"158.8\" />\n            <rect width=\"3\" height=\"13.7\" y=\"-55.3\" x=\"164.2\" />\n            <rect width=\"3\" height=\"14.3\" y=\"-55.9\" x=\"169.6\" />\n            <rect width=\"3\" height=\"8.2\" y=\"-49.9\" x=\"174.9\" />\n            <rect width=\"3\" height=\"20.1\" y=\"-61.7\" x=\"180.3\" />\n            <rect width=\"3\" height=\"12.1\" y=\"-53.8\" x=\"185.7\" />\n            <rect width=\"3\" height=\"12.2\" y=\"-53.9\" x=\"191\" />\n            <rect width=\"3\" height=\"10.9\" y=\"-52.6\" x=\"196.4\" />\n            <rect width=\"3\" height=\"15.5\" y=\"-57.1\" x=\"201.8\" />\n            <rect width=\"3\" height=\"3.5\" y=\"-45.1\" x=\"207.2\" />\n            <rect width=\"3\" height=\"8.8\" y=\"-50.5\" x=\"212.5\" />\n            <rect width=\"3\" height=\"23.6\" y=\"-65.2\" x=\"217.9\" />\n            <rect width=\"3\" height=\"15.6\" y=\"-57.3\" x=\"223.2\" />\n            <rect width=\"3\" height=\"23.6\" y=\"-65.2\" x=\"228.6\" />\n            <rect width=\"3\" height=\"28.5\" y=\"-70.2\" x=\"234\" />\n            <rect width=\"3\" height=\"16.3\" y=\"-58\" x=\"239.3\" />\n            <rect width=\"3\" height=\"14\" y=\"-55.6\" x=\"244.7\" />\n            <rect width=\"3\" height=\"22.3\" y=\"-63.9\" x=\"250.1\" />\n            <rect width=\"3\" height=\"35\" y=\"-76.7\" x=\"255.5\" />\n            <rect width=\"3\" height=\"26.3\" y=\"-67.9\" x=\"260.8\" />\n            <rect width=\"3\" height=\"18\" y=\"-59.6\" x=\"266.2\" />\n            <rect width=\"3\" height=\"15.3\" y=\"-56.9\" x=\"271.6\" />\n            <rect width=\"3\" height=\"5.5\" y=\"-47.1\" x=\"276.9\" />\n        </g>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#395b96\">\n            <rect width=\"3\" height=\"36.8\" y=\"-114.8\" x=\"142.7\" />\n            <rect width=\"3\" height=\"20.9\" y=\"-106.2\" x=\"148.1\" />\n            <rect width=\"3\" height=\"10.3\" y=\"-76.6\" x=\"153.5\" />\n            <rect width=\"3\" height=\"16.3\" y=\"-67.6\" x=\"158.8\" />\n            <rect width=\"3\" height=\"15\" y=\"-70.3\" x=\"164.2\" />\n            <rect width=\"3\" height=\"5.8\" y=\"-61.7\" x=\"169.6\" />\n            <rect width=\"3\" height=\"21\" y=\"-70.9\" x=\"174.9\" />\n            <rect width=\"3\" height=\"14.1\" y=\"-75.8\" x=\"180.3\" />\n            <rect width=\"3\" height=\"27.4\" y=\"-81.2\" x=\"185.7\" />\n            <rect width=\"3\" height=\"16.4\" y=\"-70.3\" x=\"191\" />\n            <rect width=\"3\" height=\"15.9\" y=\"-68.5\" x=\"196.4\" />\n            <rect width=\"3\" height=\"12.6\" y=\"-69.7\" x=\"201.8\" />\n            <rect width=\"3\" height=\"9.2\" y=\"-54.3\" x=\"207.2\" />\n            <rect width=\"3\" height=\"13.5\" y=\"-64\" x=\"212.5\" />\n            <rect width=\"3\" height=\"20.3\" y=\"-85.6\" x=\"217.9\" />\n            <rect width=\"3\" height=\"13.6\" y=\"-70.9\" x=\"223.2\" />\n            <rect width=\"3\" height=\"12.7\" y=\"-78\" x=\"228.6\" />\n            <rect width=\"3\" height=\"14.6\" y=\"-84.7\" x=\"234\" />\n            <rect width=\"3\" height=\"14.5\" y=\"-72.5\" x=\"239.3\" />\n            <rect width=\"3\" height=\"21.4\" y=\"-77\" x=\"244.7\" />\n            <rect width=\"3\" height=\"21.5\" y=\"-85.5\" x=\"250.1\" />\n            <rect width=\"3\" height=\"37.2\" y=\"-113.8\" x=\"255.5\" />\n            <rect width=\"3\" height=\"14\" y=\"-82\" x=\"260.8\" />\n            <rect width=\"3\" height=\"18.6\" y=\"-78.2\" x=\"266.2\" />\n            <rect width=\"3\" height=\"21.2\" y=\"-78.1\" x=\"271.6\" />\n            <rect width=\"3\" height=\"10.4\" y=\"-57.5\" x=\"276.9\" />\n        </g>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#2f78bd\">\n            <rect width=\"3\" height=\"30.2\" y=\"-145\" x=\"142.7\" />\n            <rect width=\"3\" height=\"11.8\" y=\"-118\" x=\"148.1\" />\n            <rect width=\"3\" height=\"1.9\" y=\"-78.5\" x=\"153.5\" />\n            <rect width=\"3\" height=\"3.8\" y=\"-71.4\" x=\"158.8\" />\n            <rect width=\"3\" height=\"13.7\" y=\"-84\" x=\"164.2\" />\n            <rect width=\"3\" height=\"36.9\" y=\"-98.6\" x=\"169.6\" />\n            <rect width=\"3\" height=\"47.9\" y=\"-118.8\" x=\"174.9\" />\n            <rect width=\"3\" height=\"6.1\" y=\"-81.9\" x=\"180.3\" />\n            <rect width=\"3\" height=\"1.4\" y=\"-82.6\" x=\"185.7\" />\n            <rect width=\"3\" height=\"18.6\" y=\"-88.9\" x=\"191\" />\n            <rect width=\"3\" height=\"5.4\" y=\"-73.9\" x=\"196.4\" />\n            <rect width=\"3\" height=\"4.3\" y=\"-74\" x=\"201.8\" />\n            <rect width=\"3\" height=\"1.7\" y=\"-56\" x=\"207.2\" />\n            <rect width=\"3\" height=\"2.3\" y=\"-66.3\" x=\"212.5\" />\n            <rect width=\"3\" height=\".5\" y=\"-86.1\" x=\"217.9\" />\n            <rect width=\"3\" height=\"1.2\" y=\"-72.1\" x=\"223.2\" />\n            <rect width=\"3\" height=\".5\" y=\"-78.5\" x=\"228.6\" />\n            <rect width=\"3\" height=\"4.4\" y=\"-89.1\" x=\"234\" />\n            <rect width=\"3\" height=\"4.2\" y=\"-76.7\" x=\"239.3\" />\n            <rect width=\"3\" height=\"17.2\" y=\"-94.2\" x=\"244.7\" />\n            <rect width=\"3\" height=\"31.2\" y=\"-116.7\" x=\"250.1\" />\n            <rect width=\"3\" height=\"15.1\" y=\"-128.9\" x=\"255.5\" />\n            <rect width=\"3\" height=\"19.4\" y=\"-101.4\" x=\"260.8\" />\n            <rect width=\"3\" height=\"8.4\" y=\"-86.7\" x=\"266.2\" />\n            <rect width=\"3\" height=\"3.7\" y=\"-81.8\" x=\"271.6\" />\n            <rect width=\"3\" height=\"1.7\" y=\"-59.2\" x=\"276.9\" />\n        </g>\n        <line x2=\"290\" y2=\"-41.7\" y1=\"-41.7\" x1=\"12.1\" class=\"ybaseline\" stroke=\"#c9cccf\" stroke-width=\".9\" />\n    </g>\n</svg>\n<figcaption>This graph is my productivity over the last 6 months. (As reported by Rescue Time.) It's inaccurate because it mostly isn't tracking my laptop[^2], but as I do most of my unproductive time in phone and tablet land it's probably well recorded there.\n</figcaption>\n</figure>\n<p>I've tried manually inputting habits in the past. If I worked well for an hour I'd give myself a point. But if I was really working I'd forget to put in the point, and if I was actually just barely working I'd remember. Generally reinforcing the wrong habit.</p>\n<h2>Enough intro, onto the nerd stuff!</h2>\n<p>IFTTT and Zapier both have a connection to Rescue Time. They both have a way of emitting cURL commands too. IFTTT through the Maker channel and Zapier through webhooks.</p>\n<p>That means that if I do something in real life then I can be rewarded or punished in Habitica land.</p>\n<figure>\n<img src=\"https://notionparallax.co.uk/assets/zaps.png\" alt=\"zaps\" class=\"alignnone size-full wp-image-2723\" />\n<figcaption>I've started off with a reward for reading. I get a point for each time I accrue 20 minutes of reading a kindle book or articles in Pocket.\n</figcaption>\n</figure>\n<h2>How do I unlock this sorcery?</h2>\n<p>I'll do this for Zapier because it's easier to test, but the same holds for IFTTT[^3]. You can also swap out Rescue Time for any other trigger too. So if you want to get a reward when you go into the gym's geofence then you can.</p>\n<p>Obvious stuff: get a Zapier/IFTTT and Habitica account.</p>\n<p>You are going to need to get your <a href=\"https://habitica.com/#/options/settings/api\">Habitica API details; they live here</a>. (The _User ID_ and _API Token_.)</p>\n<p>Once you've got your ingredients all ready then you can get going!</p>\n<p>Pick something you want to be rewarded (or punished) for. Something that Rescue Time tracks. Then make <a href=\"https://www.rescuetime.com/categories\">a custom subcategory for it</a>.[^4] Then set a <a href=\"https://www.rescuetime.com/goals\">new goal</a>. </p>\n<figure>\n<img src=\"https://notionparallax.co.uk/assets/goal.png\" alt=\"goal\" class=\"alignnone size-full wp-image-2726\" />\n<figcaption>Set it to the category you want and then how long you need to spend doing it before the trigger fires.\n</figcaption>\n</figure>\n<p>You're all done in Rescue Time now.</p>\n<p>Go to Zapier and <a href=\"https://zapier.com/app/editor\">make a new Zap</a>. </p>\n<p><img src=\"https://notionparallax.co.uk/assets/zap1.png\" alt=\"zap1\" class=\"alignnone size-full wp-image-2729\" /></p>\n<p>Set it to be triggered by your goal.</p>\n<p><img src=\"https://notionparallax.co.uk/assets/zap2-1.png\" alt=\"zap2\" class=\"alignnone size-medium wp-image-2728\" /></p>\n<p>Now for the voodoo part. There is a good page on the <a href=\"http://habitica.wikia.com/wiki/Application_Programming_Interface\">Habitica wiki that explains everything I'm about to say</a>. I was having a severe stupid when I was reading it, so in case my words are useful, then here they are.</p>\n<p>The call to the API is a POST like this:</p>\n<p><code>https://habitica.com/api/v2/user/tasks/<span class=\"name\">read20minutes</span>/<span class=\"direction\">up</span></code></p>\n<p>The bit in red is the name of the habit. (Multiple triggers can aim at the same habit.) The green bit is either <code>up</code> or <code>down</code> depending on where you want your score to go.</p>\n<p>That goes into the URL field.</p>\n<p>This is the part that I spent all the time on. Your authentication details go in the header, not the body. That's right at the end of section 5. Make 2 new key, value pairs with your details.</p>\n<figure>\n<img class=\"alignnone size-full wp-image-2730\" src=\"https://notionparallax.co.uk/assets/keys.png\" alt=\"keys\" />\n<figcaption>That's <code>x-api-user: xxxxx</code> and <code>x-api-key: xxxxx</code> if you are playing along at home.\n</figcaption>\n</figure>\n<p>That's it! don't change anything else and you'll be just fine.</p>\n<p>Test it in step 6, name it in step 7 and away you go!</p>\n<p>When you test it you should see a new Habitica habit show up. Then if you test it again it'll go green. (Unless you're a punisher and you picked <code>down</code>!)</p>\n<p>And that is that.</p>\n<p>If you have any clever ideas for other things to join up then let me know. I'm a total sucker for this stuff.</p>\n\n[^1]: i.e. it gets me to do things that the good version of myself thinks are useful. The things that--given some time to think about it and plan--I would want to be doing.\n[^2]: Rescue Time for Linux is a process that you need to start manually. I'm sure that's the Linux way, but it's super annoying. \"Just make a startup script\" sure, one day.\n[^3]: Now that I've got it working, I'd actually make it in IFTTT, Zapier is pretty crippled unless you pay real money for it.\n[^4]: You can put other activities into that category if you want them measured on the same timer if you like.\n",
 "content_html": "<h1>Connecting Rescue time to Habitica: How to reward yourself for doing useful things without using up all your brain power</h1>\n<style type=\"text/css\">\nfigure {\n    width: 33em;\n    margin: auto;\n}\nsvg.prod-graph {\n    width: 63vh;\n    height: 31vh;\n}\n.post img {\n    margin: 1em 0;\n}\nspan.name {\n    color: red;\n}\nspan.direction {\n    color: green;\n}\n</style>\n\n<p>I like <a href=\"https://habitica.com\" title=\"formerly Habit RPG\">Habitica</a> a lot. I find that it’s good at <a href=\"http://habitica.wikia.com/wiki/Adapting_HabitRPG_for_ADHD\">directing my attention</a> and motivating me to do things that are aligned with my goals<sup id=\"fnref:1\" role=\"doc-noteref\"><a href=\"https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power#fn:1\" class=\"footnote\" rel=\"footnote\">1</a></sup>. I also use <a href=\"https://www.rescuetime.com\">Rescue Time</a>, it’s job is to tell me what I really do with my life. It stops me lying to myself about what my days look like.\n   <br />\n</p>\n<figure>\n  <svg class=\"prod-graph\" xmlns=\"http://www.w3.org/2000/svg\" preserveaspectratio=\"none\" viewbox=\"0 0 310 181\" height=\"181\">\n    <g transform=\"matrix(1 0 0 .89485 20 129.754)\">\n        <line class=\"ybaseline\" y1=\"-64.3\" y2=\"-64.3\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-61.3\" text-anchor=\"left\">10h</text>\n        <line class=\"ybaseline\" y1=\"-86.9\" y2=\"-86.9\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-83.9\" text-anchor=\"left\">20h</text>\n        <line class=\"ybaseline\" y1=\"-109.6\" y2=\"-109.6\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-106.6\" text-anchor=\"left\">30h</text>\n        <line class=\"ybaseline\" y1=\"-132.2\" y2=\"-132.2\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-129.2\" text-anchor=\"left\">40h</text>\n        <line class=\"ybaseline\" y1=\"-19\" y2=\"-19\" x2=\"289\" x1=\"6.5\" stroke=\"#f2f5f7\" />\n        <text class=\"ylabel\" x=\"-16\" y=\"-16\" text-anchor=\"left\">10h</text>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#c5392f\">\n            <rect width=\"3\" height=\"14.1\" y=\"-30\" x=\"142.7\" />\n            <rect width=\"3\" height=\"16.5\" y=\"-16.5\" x=\"148.1\" />\n            <rect width=\"3\" height=\"10.9\" y=\"-24.7\" x=\"153.5\" />\n            <rect width=\"3\" height=\"15.3\" y=\"-30\" x=\"158.8\" />\n            <rect width=\"3\" height=\"12.7\" y=\"-33.6\" x=\"164.2\" />\n            <rect width=\"3\" height=\"7.1\" y=\"-28.3\" x=\"169.6\" />\n            <rect width=\"3\" height=\"5\" y=\"-30.9\" x=\"174.9\" />\n            <rect width=\"3\" height=\"11.9\" y=\"-31.8\" x=\"180.3\" />\n            <rect width=\"3\" height=\"12.3\" y=\"-34.3\" x=\"185.7\" />\n            <rect width=\"3\" height=\"16.1\" y=\"-36.4\" x=\"191\" />\n            <rect width=\"3\" height=\"9.7\" y=\"-37.1\" x=\"196.4\" />\n            <rect width=\"3\" height=\"10.2\" y=\"-24.4\" x=\"201.8\" />\n            <rect width=\"3\" height=\"4.3\" y=\"-39.9\" x=\"207.2\" />\n            <rect width=\"3\" height=\"12.4\" y=\"-36.5\" x=\"212.5\" />\n            <rect width=\"3\" height=\"12.3\" y=\"-27.9\" x=\"217.9\" />\n            <rect width=\"3\" height=\"19.1\" y=\"-33.9\" x=\"223.2\" />\n            <rect width=\"3\" height=\"16.5\" y=\"-35.3\" x=\"228.6\" />\n            <rect width=\"3\" height=\"14.7\" y=\"-30.3\" x=\"234\" />\n            <rect width=\"3\" height=\"11.5\" y=\"-30.3\" x=\"239.3\" />\n            <rect width=\"3\" height=\"10.5\" y=\"-24.4\" x=\"244.7\" />\n            <rect width=\"3\" height=\"16.6\" y=\"-31.2\" x=\"250.1\" />\n            <rect width=\"3\" height=\"20.8\" y=\"-29\" x=\"255.5\" />\n            <rect width=\"3\" height=\"21\" y=\"-22.4\" x=\"260.8\" />\n            <rect width=\"3\" height=\"11.9\" y=\"-17.8\" x=\"266.2\" />\n            <rect width=\"3\" height=\"15.7\" y=\"-24.5\" x=\"271.6\" />\n            <rect width=\"3\" height=\"12.3\" y=\"-33.6\" x=\"276.9\" />\n        </g>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#92343b\">\n            <rect width=\"3\" height=\"11.7\" y=\"-41.7\" x=\"142.7\" />\n            <rect width=\"3\" height=\"25.1\" y=\"-41.7\" x=\"148.1\" />\n            <rect width=\"3\" height=\"17\" y=\"-41.7\" x=\"153.5\" />\n            <rect width=\"3\" height=\"11.6\" y=\"-41.7\" x=\"158.8\" />\n            <rect width=\"3\" height=\"8.1\" y=\"-41.7\" x=\"164.2\" />\n            <rect width=\"3\" height=\"13.3\" y=\"-41.7\" x=\"169.6\" />\n            <rect width=\"3\" height=\"10.8\" y=\"-41.7\" x=\"174.9\" />\n            <rect width=\"3\" height=\"9.8\" y=\"-41.7\" x=\"180.3\" />\n            <rect width=\"3\" height=\"7.3\" y=\"-41.7\" x=\"185.7\" />\n            <rect width=\"3\" height=\"5.3\" y=\"-41.7\" x=\"191\" />\n            <rect width=\"3\" height=\"4.5\" y=\"-41.7\" x=\"196.4\" />\n            <rect width=\"3\" height=\"17.2\" y=\"-41.7\" x=\"201.8\" />\n            <rect width=\"3\" height=\"1.7\" y=\"-41.7\" x=\"207.2\" />\n            <rect width=\"3\" height=\"5.2\" y=\"-41.7\" x=\"212.5\" />\n            <rect width=\"3\" height=\"13.7\" y=\"-41.7\" x=\"217.9\" />\n            <rect width=\"3\" height=\"7.7\" y=\"-41.7\" x=\"223.2\" />\n            <rect width=\"3\" height=\"6.3\" y=\"-41.7\" x=\"228.6\" />\n            <rect width=\"3\" height=\"11.4\" y=\"-41.7\" x=\"234\" />\n            <rect width=\"3\" height=\"11.4\" y=\"-41.7\" x=\"239.3\" />\n            <rect width=\"3\" height=\"17.3\" y=\"-41.7\" x=\"244.7\" />\n            <rect width=\"3\" height=\"10.4\" y=\"-41.7\" x=\"250.1\" />\n            <rect width=\"3\" height=\"12.6\" y=\"-41.7\" x=\"255.5\" />\n            <rect width=\"3\" height=\"19.2\" y=\"-41.7\" x=\"260.8\" />\n            <rect width=\"3\" height=\"23.9\" y=\"-41.7\" x=\"266.2\" />\n            <rect width=\"3\" height=\"17.1\" y=\"-41.7\" x=\"271.6\" />\n            <rect width=\"3\" height=\"8\" y=\"-41.7\" x=\"276.9\" />\n        </g>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#655568\">\n            <rect width=\"3\" height=\"36.4\" y=\"-78\" x=\"142.7\" />\n            <rect width=\"3\" height=\"43.6\" y=\"-85.3\" x=\"148.1\" />\n            <rect width=\"3\" height=\"24.6\" y=\"-66.3\" x=\"153.5\" />\n            <rect width=\"3\" height=\"9.7\" y=\"-51.3\" x=\"158.8\" />\n            <rect width=\"3\" height=\"13.7\" y=\"-55.3\" x=\"164.2\" />\n            <rect width=\"3\" height=\"14.3\" y=\"-55.9\" x=\"169.6\" />\n            <rect width=\"3\" height=\"8.2\" y=\"-49.9\" x=\"174.9\" />\n            <rect width=\"3\" height=\"20.1\" y=\"-61.7\" x=\"180.3\" />\n            <rect width=\"3\" height=\"12.1\" y=\"-53.8\" x=\"185.7\" />\n            <rect width=\"3\" height=\"12.2\" y=\"-53.9\" x=\"191\" />\n            <rect width=\"3\" height=\"10.9\" y=\"-52.6\" x=\"196.4\" />\n            <rect width=\"3\" height=\"15.5\" y=\"-57.1\" x=\"201.8\" />\n            <rect width=\"3\" height=\"3.5\" y=\"-45.1\" x=\"207.2\" />\n            <rect width=\"3\" height=\"8.8\" y=\"-50.5\" x=\"212.5\" />\n            <rect width=\"3\" height=\"23.6\" y=\"-65.2\" x=\"217.9\" />\n            <rect width=\"3\" height=\"15.6\" y=\"-57.3\" x=\"223.2\" />\n            <rect width=\"3\" height=\"23.6\" y=\"-65.2\" x=\"228.6\" />\n            <rect width=\"3\" height=\"28.5\" y=\"-70.2\" x=\"234\" />\n            <rect width=\"3\" height=\"16.3\" y=\"-58\" x=\"239.3\" />\n            <rect width=\"3\" height=\"14\" y=\"-55.6\" x=\"244.7\" />\n            <rect width=\"3\" height=\"22.3\" y=\"-63.9\" x=\"250.1\" />\n            <rect width=\"3\" height=\"35\" y=\"-76.7\" x=\"255.5\" />\n            <rect width=\"3\" height=\"26.3\" y=\"-67.9\" x=\"260.8\" />\n            <rect width=\"3\" height=\"18\" y=\"-59.6\" x=\"266.2\" />\n            <rect width=\"3\" height=\"15.3\" y=\"-56.9\" x=\"271.6\" />\n            <rect width=\"3\" height=\"5.5\" y=\"-47.1\" x=\"276.9\" />\n        </g>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#395b96\">\n            <rect width=\"3\" height=\"36.8\" y=\"-114.8\" x=\"142.7\" />\n            <rect width=\"3\" height=\"20.9\" y=\"-106.2\" x=\"148.1\" />\n            <rect width=\"3\" height=\"10.3\" y=\"-76.6\" x=\"153.5\" />\n            <rect width=\"3\" height=\"16.3\" y=\"-67.6\" x=\"158.8\" />\n            <rect width=\"3\" height=\"15\" y=\"-70.3\" x=\"164.2\" />\n            <rect width=\"3\" height=\"5.8\" y=\"-61.7\" x=\"169.6\" />\n            <rect width=\"3\" height=\"21\" y=\"-70.9\" x=\"174.9\" />\n            <rect width=\"3\" height=\"14.1\" y=\"-75.8\" x=\"180.3\" />\n            <rect width=\"3\" height=\"27.4\" y=\"-81.2\" x=\"185.7\" />\n            <rect width=\"3\" height=\"16.4\" y=\"-70.3\" x=\"191\" />\n            <rect width=\"3\" height=\"15.9\" y=\"-68.5\" x=\"196.4\" />\n            <rect width=\"3\" height=\"12.6\" y=\"-69.7\" x=\"201.8\" />\n            <rect width=\"3\" height=\"9.2\" y=\"-54.3\" x=\"207.2\" />\n            <rect width=\"3\" height=\"13.5\" y=\"-64\" x=\"212.5\" />\n            <rect width=\"3\" height=\"20.3\" y=\"-85.6\" x=\"217.9\" />\n            <rect width=\"3\" height=\"13.6\" y=\"-70.9\" x=\"223.2\" />\n            <rect width=\"3\" height=\"12.7\" y=\"-78\" x=\"228.6\" />\n            <rect width=\"3\" height=\"14.6\" y=\"-84.7\" x=\"234\" />\n            <rect width=\"3\" height=\"14.5\" y=\"-72.5\" x=\"239.3\" />\n            <rect width=\"3\" height=\"21.4\" y=\"-77\" x=\"244.7\" />\n            <rect width=\"3\" height=\"21.5\" y=\"-85.5\" x=\"250.1\" />\n            <rect width=\"3\" height=\"37.2\" y=\"-113.8\" x=\"255.5\" />\n            <rect width=\"3\" height=\"14\" y=\"-82\" x=\"260.8\" />\n            <rect width=\"3\" height=\"18.6\" y=\"-78.2\" x=\"266.2\" />\n            <rect width=\"3\" height=\"21.2\" y=\"-78.1\" x=\"271.6\" />\n            <rect width=\"3\" height=\"10.4\" y=\"-57.5\" x=\"276.9\" />\n        </g>\n        <g transform=\"matrix(1.89176 0 0 1 -241.974 0)\" class=\"level\" fill=\"#2f78bd\">\n            <rect width=\"3\" height=\"30.2\" y=\"-145\" x=\"142.7\" />\n            <rect width=\"3\" height=\"11.8\" y=\"-118\" x=\"148.1\" />\n            <rect width=\"3\" height=\"1.9\" y=\"-78.5\" x=\"153.5\" />\n            <rect width=\"3\" height=\"3.8\" y=\"-71.4\" x=\"158.8\" />\n            <rect width=\"3\" height=\"13.7\" y=\"-84\" x=\"164.2\" />\n            <rect width=\"3\" height=\"36.9\" y=\"-98.6\" x=\"169.6\" />\n            <rect width=\"3\" height=\"47.9\" y=\"-118.8\" x=\"174.9\" />\n            <rect width=\"3\" height=\"6.1\" y=\"-81.9\" x=\"180.3\" />\n            <rect width=\"3\" height=\"1.4\" y=\"-82.6\" x=\"185.7\" />\n            <rect width=\"3\" height=\"18.6\" y=\"-88.9\" x=\"191\" />\n            <rect width=\"3\" height=\"5.4\" y=\"-73.9\" x=\"196.4\" />\n            <rect width=\"3\" height=\"4.3\" y=\"-74\" x=\"201.8\" />\n            <rect width=\"3\" height=\"1.7\" y=\"-56\" x=\"207.2\" />\n            <rect width=\"3\" height=\"2.3\" y=\"-66.3\" x=\"212.5\" />\n            <rect width=\"3\" height=\".5\" y=\"-86.1\" x=\"217.9\" />\n            <rect width=\"3\" height=\"1.2\" y=\"-72.1\" x=\"223.2\" />\n            <rect width=\"3\" height=\".5\" y=\"-78.5\" x=\"228.6\" />\n            <rect width=\"3\" height=\"4.4\" y=\"-89.1\" x=\"234\" />\n            <rect width=\"3\" height=\"4.2\" y=\"-76.7\" x=\"239.3\" />\n            <rect width=\"3\" height=\"17.2\" y=\"-94.2\" x=\"244.7\" />\n            <rect width=\"3\" height=\"31.2\" y=\"-116.7\" x=\"250.1\" />\n            <rect width=\"3\" height=\"15.1\" y=\"-128.9\" x=\"255.5\" />\n            <rect width=\"3\" height=\"19.4\" y=\"-101.4\" x=\"260.8\" />\n            <rect width=\"3\" height=\"8.4\" y=\"-86.7\" x=\"266.2\" />\n            <rect width=\"3\" height=\"3.7\" y=\"-81.8\" x=\"271.6\" />\n            <rect width=\"3\" height=\"1.7\" y=\"-59.2\" x=\"276.9\" />\n        </g>\n        <line x2=\"290\" y2=\"-41.7\" y1=\"-41.7\" x1=\"12.1\" class=\"ybaseline\" stroke=\"#c9cccf\" stroke-width=\".9\" />\n    </g>\n</svg>\n  <figcaption>\n    <p>This graph is my productivity over the last 6 months. (As reported by Rescue Time.) It’s inaccurate because it mostly isn’t tracking my laptop<sup id=\"fnref:2\" role=\"doc-noteref\"><a href=\"https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power#fn:2\" class=\"footnote\" rel=\"footnote\">2</a></sup>, but as I do most of my unproductive time in phone and tablet land it’s probably well recorded there.</p>\n  </figcaption>\n</figure>\n<p>I’ve tried manually inputting habits in the past. If I worked well for an hour I’d give myself a point. But if I was really working I’d forget to put in the point, and if I was actually just barely working I’d remember. Generally reinforcing the wrong habit.</p>\n<h2>Enough intro, onto the nerd stuff!</h2>\n<p>IFTTT and Zapier both have a connection to Rescue Time. They both have a way of emitting cURL commands too. IFTTT through the Maker channel and Zapier through webhooks.</p>\n<p>That means that if I do something in real life then I can be rewarded or punished in Habitica land.</p>\n<figure>\n  <p><img src=\"https://notionparallax.co.uk/assets/zaps.png\" alt=\"zaps\" class=\"alignnone size-full wp-image-2723\" /></p>\n  <figcaption>\n    <p>I’ve started off with a reward for reading. I get a point for each time I accrue 20 minutes of reading a kindle book or articles in Pocket.</p>\n  </figcaption>\n</figure>\n<h2>How do I unlock this sorcery?</h2>\n<p>I’ll do this for Zapier because it’s easier to test, but the same holds for IFTTT<sup id=\"fnref:3\" role=\"doc-noteref\"><a href=\"https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power#fn:3\" class=\"footnote\" rel=\"footnote\">3</a></sup>. You can also swap out Rescue Time for any other trigger too. So if you want to get a reward when you go into the gym’s geofence then you can.</p>\n<p>Obvious stuff: get a Zapier/IFTTT and Habitica account.</p>\n<p>You are going to need to get your <a href=\"https://habitica.com/#/options/settings/api\">Habitica API details; they live here</a>. (The <em>User ID</em> and <em>API Token</em>.)</p>\n<p>Once you’ve got your ingredients all ready then you can get going!</p>\n<p>Pick something you want to be rewarded (or punished) for. Something that Rescue Time tracks. Then make <a href=\"https://www.rescuetime.com/categories\">a custom subcategory for it</a>.<sup id=\"fnref:4\" role=\"doc-noteref\"><a href=\"https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power#fn:4\" class=\"footnote\" rel=\"footnote\">4</a></sup> Then set a <a href=\"https://www.rescuetime.com/goals\">new goal</a>. </p>\n<figure>\n  <p><img src=\"https://notionparallax.co.uk/assets/goal.png\" alt=\"goal\" class=\"alignnone size-full wp-image-2726\" /></p>\n  <figcaption>\n    <p>Set it to the category you want and then how long you need to spend doing it before the trigger fires.</p>\n  </figcaption>\n</figure>\n<p>You’re all done in Rescue Time now.</p>\n<p>Go to Zapier and <a href=\"https://zapier.com/app/editor\">make a new Zap</a>. </p>\n<p><img src=\"https://notionparallax.co.uk/assets/zap1.png\" alt=\"zap1\" class=\"alignnone size-full wp-image-2729\" /></p>\n<p>Set it to be triggered by your goal.</p>\n<p><img src=\"https://notionparallax.co.uk/assets/zap2-1.png\" alt=\"zap2\" class=\"alignnone size-medium wp-image-2728\" /></p>\n<p>Now for the voodoo part. There is a good page on the <a href=\"http://habitica.wikia.com/wiki/Application_Programming_Interface\">Habitica wiki that explains everything I’m about to say</a>. I was having a severe stupid when I was reading it, so in case my words are useful, then here they are.</p>\n<p>The call to the API is a POST like this:</p>\n<p><code>https://habitica.com/api/v2/user/tasks/<span class=\"name\">read20minutes</span>/<span class=\"direction\">up</span></code></p>\n<p>The bit in red is the name of the habit. (Multiple triggers can aim at the same habit.) The green bit is either <code>up</code> or <code>down</code> depending on where you want your score to go.</p>\n<p>That goes into the URL field.</p>\n<p>This is the part that I spent all the time on. Your authentication details go in the header, not the body. That’s right at the end of section 5. Make 2 new key, value pairs with your details.</p>\n<figure>\n  <p><img class=\"alignnone size-full wp-image-2730\" src=\"https://notionparallax.co.uk/assets/keys.png\" alt=\"keys\" /></p>\n  <figcaption>\n    <p>That’s <code>x-api-user: xxxxx</code> and <code>x-api-key: xxxxx</code> if you are playing along at home.</p>\n  </figcaption>\n</figure>\n<p>That’s it! don’t change anything else and you’ll be just fine.</p>\n<p>Test it in step 6, name it in step 7 and away you go!</p>\n<p>When you test it you should see a new Habitica habit show up. Then if you test it again it’ll go green. (Unless you’re a punisher and you picked <code>down</code>!)</p>\n<p>And that is that.</p>\n<p>If you have any clever ideas for other things to join up then let me know. I’m a total sucker for this stuff.</p>\n\n<div class=\"footnotes\" role=\"doc-endnotes\">\n  <ol>\n    <li id=\"fn:1\" role=\"doc-endnote\">\n      <p>i.e. it gets me to do things that the good version of myself thinks are useful. The things that–given some time to think about it and plan–I would want to be doing. <a href=\"https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power#fnref:1\" class=\"reversefootnote\" role=\"doc-backlink\">&#8617;</a></p>\n    </li>\n    <li id=\"fn:2\" role=\"doc-endnote\">\n      <p>Rescue Time for Linux is a process that you need to start manually. I’m sure that’s the Linux way, but it’s super annoying. “Just make a startup script” sure, one day. <a href=\"https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power#fnref:2\" class=\"reversefootnote\" role=\"doc-backlink\">&#8617;</a></p>\n    </li>\n    <li id=\"fn:3\" role=\"doc-endnote\">\n      <p>Now that I’ve got it working, I’d actually make it in IFTTT, Zapier is pretty crippled unless you pay real money for it. <a href=\"https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power#fnref:3\" class=\"reversefootnote\" role=\"doc-backlink\">&#8617;</a></p>\n    </li>\n    <li id=\"fn:4\" role=\"doc-endnote\">\n      <p>You can put other activities into that category if you want them measured on the same timer if you like. <a href=\"https://notionparallax.co.uk/2016/connecting-rescue-time-to-habitica-how-to-reward-yourself-for-doing-useful-things-without-using-up-all-your-brain-power#fnref:4\" class=\"reversefootnote\" role=\"doc-backlink\">&#8617;</a></p>\n    </li>\n  </ol>\n</div>\n",
 "content_hash": "sha256:cf9dc756bfe3b42a048b1e908cd63aae65daa78e37483f77c05db4aab33558a4",
 "media": [],
 "changelog": [
  {
   "version": 1,
   "at": "2016-01-11T21:00:03Z",
   "note": null
  }
 ],
 "transclusions": []
}