Exporting your activities from Endomondo to Strava
On October 30th Endomondo announced they would be shutting down their service on 31st December 2020 and the data would be permanently deleted after March 31, 2021.
The aim of this tutorial is to show you how to export your data from Endomondo and then import them to Strava. In fact, it’s something I’ve been doing myself over Saturday morning.
There are 3 ways to do it I know of:
1. Using Tapiriik service, which should do it automatically over time.
2. The manual way, which may be perfect if you have a pretty small number of records to move.
3. Automatic way for a huge number of files, which is also the most complex, but I’ll guide you through it step by step.
This one is pretty simple, you go to the https://tapiriik.com/ website, authorize both Strava and Endomondo and allow the service to sync data in the background.
Some people say it takes a lot of time with a free tier and speeds up after donation. I haven’t tried it myself though.
The manual synchronization
You can request data export from Endomondo, which is described in this article: https://support.endomondo.com/hc/en-us/articles/360006081933
Basically, you simply go to https://www.endomondo.com/settings/account, click the button under the “Export and Download Your Data” section and the archive will be prepared in the background. Once complete, you should receive an email with a download link.
After unzipping you should go and check the Workouts subdirectory as it contains all your recorded routes.
Uploading to Strava happens in https://www.strava.com/upload/select where you can navigate after selecting the top-right “+” button and “Upload activity”.
That way you can upload up to 25 .tcx files at once.
Automatic way — the funniest way! 🎉
The steps needed to complete the process are:
1. Export all the recorded routes from Endomondo to a universal format, e.g. .gpx files — we saw it before but why not do it automatically?
2. Enable API access on Strava.
3. Upload all the files in batches of 100 at once (Strava API limits).
Exporting activities data as .gpx files
I used endomondo-api-handler library to export all my data. My code is a simple node.js project with 2 files:
Save them on your local disk, e.g. in the exporter directory, replacing YOUR_ENDOMONDO_EMAIL and YOUR_ENDOMONDO_PASSWORD with your credentials. Also, create gpx directory inside — this is where the files will be stored.
After that all you need to do is go to the console, navigate to the exporter directory and run a couple of commands:
>mkdir gpx #if you haven't done it manually
If all goes well you’ll see the log of activities getting exported and gpx subdirectory getting filled with all the routes.
In the beginning, the script failed for me, when I debugged it, it turned out there was a problem with my password, most likely it was not properly used by the library as it was a very secure one (long, with all possible combinations). The workaround was to temporarily change Endomondo password to something easier, download the data, and change it back to the previous, safe one.
Getting API access in Strava
This is probably the most tricky section, but if you get that far you should be able to do it! Let’s start.
First, you need to register a new application here https://www.strava.com/settings/api, I called my — GPX importer.
You set an icon and the most important thing — you set “Authorization Callback Domain” as localhost
After all of this is done you should have a configuration similar to this one:
Strava uses OAuth in order to give access to specific resources. We will need to make a GET and then a POST request to get a proper API token.
First let’s make a GET request using the browser so that OAuth flow can redirect us to localhost (parameter redirect_uri). We’ll be requesting activity:write permissions.
The request is as follows — you need to replace YOUR_CLIENT_ID with “Client ID” from your Strava app summary:
The second you run it in your browser you’ll get an error saying you can’t connect to localhost… which is great news! All you need to do is to extract code= parameter for the second request.
Now, the last thing to do to get a proper token is to build and run that command:
curl -X POST https://www.strava.com/api/v3/oauth/token \
-d client_id=12345 \
-d client_secret=abcdefghijklmnopqrstuvwxyz \
-d code=YOUR_CODEabcdefghijk... \
Once it runs successfully you should get a response similar to this one
And ACCESS_TOKEN is the holy grail we were fighting for! 🎉
You might have noticed during Strava app configuration the Rate Limits of 100 requests. Each single gpx file upload is actually 1 request. So we’re going to use a script that imports our files in batches of 100 and moves them to gpx-done folder. The only thing to do is to put your ACCESS_TOKEN.
Save a file, add execution rights and run it as many times as you need to drain your files count to 0 (a multitude of 100).
>chmod +x uploader.sh
After a batch of 100 files is uploaded, wait 15 minutes and run script again.
You can actually observe your API usage here: https://www.strava.com/settings/api
After all of this, you can check if your activities uploaded successfully: https://www.strava.com/athlete/training
For me, after 6 runs it’s all there!
Hope you found it useful and all your activities are saved! :)