This is a hacky way of doing the thing that Garmin should have supposed to do.
Disclaimer: Post is intended for developers or tech-savvy people.
As you are here it means you have also encountered a problem with Garmin LiveTrack as it provides 0 integration support and no API for devs.
Let’s jump into it:
What we need:
- Go lang to glue everything together
Enable LiveTrack from Garmin Connect mobile app. Add Email recipient, we can use Gmail aliases as well like
Garmin will send link with the location to that address.
There are two ways to get this mail
- Pub/Sub using Google cloud and Gmail API
- Crontab to query inbox and get new Garmin mails.
The last one looks easier, so I used it. Pub/Sub was kind of overkill for this simple project.
Create a project on Google Cloud and enable Gmail API
Go Quickstart | Gmail API | Google Developers
Complete the steps described in the rest of this page to create a simple Go command-line application that makes…
Download GO packages which will help to access Gmail API.
Follow the link and use that script to authorize the application and obtain an access token from Google (later we will modify this script).
Go samples for G Suite products. Contribute to gsuitedevs/go-samples development by creating an account on GitHub.
Now we need to fetch mails from Gmail which is sent from Garmin and is in unread status. Every mail we check will be marked as read, so unread mails will be the most recent. add those functions to the script from the previous step and invoke accordingly.
lastMessageId := getLastMessageId(srv)
base64Data := getLastMessageData(srv, lastMessageId)
and modify scope for Gmail API in main function to :
This will require to obtain an access token again.
Create Slack App : https://api.slack.com/apps
Install to your workspace and copy access token.
this function will update Slack status for the next 3 hours as “Gone Cycling” with the corresponding emoji and set a user presence as “away”. Tune options as you like.
now add this script to Crontab and that's it 🤘
Dummy and easy integration, at least works for me.
Feel free to add as many features as you wish,
here is the full script, just copy & paste :