Garmin LiveTrack & Slack Integration Instructions

Merab Tato Kutalia
2 min readJun 17, 2020

This is a hacky way of doing the thing that Garmin should have supposed to do.

Garmin and Slack Integration

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:

  • Garmin
  • Gmail
  • Slack
  • Go lang to glue everything together

Step 1

Enable LiveTrack from Garmin Connect mobile app. Add Email recipient, we can use Gmail aliases as well like

testuser+garminlivetrack@gmail.com

Garmin will send link with the location to that address.

Step 2

There are two ways to get this mail

  1. Pub/Sub using Google cloud and Gmail API
  2. 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.

Step 3

Create a project on Google Cloud and enable Gmail API

Step 4

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).

Step 5

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)
markAsRead(srv, lastMessageId)

and modify scope for Gmail API in main function to :

gmail.GmailModifyScope

This will require to obtain an access token again.

Step 6

Create Slack App : https://api.slack.com/apps

Give permissions: users.profile:write, users:write.

Install to your workspace and copy access token.

Step 7

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 :

--

--

Merab Tato Kutalia

Android GDE, Software Engineer, specializing in Android