DEV Community

Colin Fay
Colin Fay

Posted on • Originally published at on

How to use your Garmin watch to tell your team you’re going for a run

Building an API in NodeJS and R to send message to Slack from yourGarmin watch.

Why on earth

ThinkR is a remote company, meaning that we all work from our home. Ontop of other cool things about remote work, this allows me to skip mylunch break and take a one hour break in the middle of the afternoon forsport. And I usually go for a run around 2 or 3 pm, but that moment inthe day is not exactly the same every day. And most of the time, Iforget to tell everyone that I’m leaving the office. I recently jokedthat my 2020 resolution was that I’ll be more strict about telling whenI arrive and leave the “office”.

I was sure it can be done straight from my watch. And guess what, itcan!

The Slack Part

The slack API is pretty amazing and allows you to use a personal webhook and a curl call to send messages to a selected channel on Slack.

Note: there are several packages in R that can be used to send messagesto Slack, for example {slackr}: &{slackteams}: But as I justwanted to make a simple, unique call, it was more straightforward towrite it directly.


  • Go to

  • Click on Start Building

  • Add an app name and add it to a workspace

  • Add a new “Incoming Webhooks”, and select the Channel to post in

And Tadaa 🎉 you now have a curl call that looks like this:

curl -X POST -H 'Content-type: application/json' 
  --data '{"text":"Hello, World!"}'

Now time to turn this into an API.

Node API

Here is a very simple API built in NodeJS:

const express = require('express')
const app = express()

app.get('/', function (req, res) {
  const request = require('request');

  const options = {
    url: '',
    json: true,
    body: {
      text: "I'm off for a run!"


app.listen(9999, function () {
  console.log('API listening on port 9999!')


And with R:


#* @get /
function() {
    url = '', 
    body = list(
      text = "I'm off for a run!"
    encode = "json"


Adding this to the watch

I discovered that Garmin has a widget called “API calls”, that let youenter an API endpoint, and the API call is done from thewatch.

I just discovered that I can send API calls from my Garmin watch and I'mvery excited about this and that also made me realized that I'mdefinitely a big

— Colin Fay 🤘 (@_ColinFay)January7,2020

So here it is, I’ve got a Widget on my watch that I can use to sendmessage on Slack 🎉

You know you're a nerd when you deploy an API that posts to Slack fromyour Garmin watch so that you can tell your team that you're going for arun instead of just… you know… typing

— Colin Fay 🤘 (@_ColinFay)January7,2020

Top comments (0)