What3words API integration - Get the w3w address for a draft's creation location


#1

If you’re not familiar with it, what3words, is one of those rather wonderful instances where technology solves a mundane problem - easily share the specific location of where you are / need people to go. So rather than a post/zip code which, can be hugely unreliable, each 3m x 3m square on the planet is given its own unique 3 word address. For example, the centre of Stonehenge is:

///workbook.remark.galloping
http://w3w.co/workbook.remark.galloping

So, as Drafts already records the location of a draft’s creation/modification, I was wondering if it would be possible to tie this into the what3words API? It would be very handy to be able to share locations of historical and current drafts in this user-friendly format.


#2

This can easily be done with an action. I’m not sure what you want to do with the what3words response, but I’ve created an example action that lets you copy it or open in what3words.

Here’s a link to the action:
https://actions.getdrafts.com/a/1M2

It will prompt for your developer API key and store it in Drafts credentials thereafter. I hope this helps!

Nick


#3

This is fantastic. Many thanks for your time. I got it working with no issues.

In terms of use cases, this is what I was envisaging:

  1. Current: Send from Drafts a templated message which includes w3w URL. E.g.

"I am waiting here. Give me a call if any issues.

http://w3w.co/workbook.remark.galloping"

So you don’t write anything in Drafts itself - just run an action which includes templated text and calls w3w based on current location. You can then share via share sheet.

The only benefit here over the w3w app is that you can include a message opposed to just the link when you share with w3w app. Admittedly an iOS shortcut could cover this off.

  1. Historical/noting specific location details: This is where I see it being more beneficial going forward.

You may have taken a draft/notes pertinent to a specific location when at that location. E.g. “This stile had been blocked off on the x walk,” or “should have gone for the fish and chips as the portions were massive.” So when sharing this draft, it would be handy to have an action that rendered it something like:

"As discussed, here are the notes I made:

‘[[original_draft_content]]’

[[original_draft_creation time]]

w3w URL for original draft"

Hope this better articulates the use cases I envisaged.


#4

I updated the action to see if it gets closer to what you were looking for. You could set up a “share & delete” action for either of these, so that the new drafts don’t hang around for long.

https://actions.getdrafts.com/a/1M2

I had never heard of what3words, so thanks for that.

Nick


#5

Marvellous. Thanks for your help.

Sounds as if w3w are gathering a fair bit of momentum now. Mercedes are on board and TomTom are to adopt 3 word addressing too. It’s a very clever idea and I love the work they have done in Africa etc.