Skip to content

Instantly share code, notes, and snippets.

@llaumgui
Created October 5, 2026 16:11
Show Gist options
  • Select an option

  • Save llaumgui/95c4cebd1519b0a4468d866d572d5340 to your computer and use it in GitHub Desktop.

Select an option

Save llaumgui/95c4cebd1519b0a4468d866d572d5340 to your computer and use it in GitHub Desktop.
n8n: from Withings to Strava
{
"name": "Withings vers Strava",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
80,
-144
],
"id": "c7e7fd51-4532-4c83-abfd-98ff2419ad07",
"name": "When clicking ‘Test workflow’"
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "27 7-12 * * *"
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
80,
112
],
"id": "d5768ceb-296c-43ac-a421-8c5877964e72",
"name": "Schedule Trigger"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "7e2cc17c-c7e2-403c-b9ca-19fb20701772",
"leftValue": "={{ $json.body.measuregrps[0].createdDt }}",
"rightValue": "={{ $('Get execution').item.json.lastOperated }}",
"operator": {
"type": "dateTime",
"operation": "after"
}
},
{
"id": "e9e05e13-8e82-4a60-84e9-03d30fba4f4f",
"leftValue": "={{ $json.body.measuregrps[0].createdDt }}",
"rightValue": "={{ $('Get execution').item.json.lastOperated }}",
"operator": {
"type": "dateTime",
"operation": "notEquals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1072,
-16
],
"id": "ca6a090c-3ab6-4a16-a68d-4f15c64fa619",
"name": "If"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d4d22b3b-763d-42e7-899a-6f0b729e40b2",
"name": "body.measuregrps[0].measures[0].value",
"value": "={{ Math.round(($('Call \\'Function Withings Getmeas\\'').item.json.body.measuregrps[0].measures[0].value / 1000) * 100) / 100 }}",
"type": "number"
},
{
"id": "395e614e-b43e-4a8d-a6fe-ac68cdf36a50",
"name": "body.measuregrps[0].created",
"value": "={{ $('Call \\'Function Withings Getmeas\\'').item.json.body.measuregrps[0].created }}",
"type": "number"
},
{
"id": "0dec3183-0b4b-4670-a87e-55e528fe61f5",
"name": "body.measuregrps[0].createdDt",
"value": "={{ new Date($('Call \\'Function Withings Getmeas\\'').item.json.body.measuregrps[0].created * 1000).toISOString() }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
848,
-16
],
"id": "71ed035c-61d3-40eb-8890-3a85622bb5cf",
"name": "Last measure"
},
{
"parameters": {
"method": "POST",
"url": "https://www.strava.com/api/v3/oauth/token",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "client_id",
"value": "={{ $('Strava Guillaume').item.json.strvCredentials.client_id }}"
},
{
"name": "client_secret",
"value": "={{ $('Strava Guillaume').item.json.strvCredentials.client_secret }}"
},
{
"name": "grant_type",
"value": "refresh_token"
},
{
"name": "refresh_token",
"value": "={{ $('Strava Guillaume').item.json.strvCredentials.refresh_token }}"
}
]
},
"options": {
"response": {}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1824,
-16
],
"id": "db483824-f0d2-4980-9708-18d96be7e9a9",
"name": "Refresh token (Strava)"
},
{
"parameters": {
"method": "PUT",
"url": "https://www.strava.com/api/v3/athlete",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $json.access_token }}"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "weight",
"value": "={{ $('If').item.json.body.measuregrps[0].measures[0].value }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2000,
-16
],
"id": "fde001d4-816a-4633-b28b-9896e3f75b11",
"name": "PUT:athlete"
},
{
"parameters": {
"content": "## Strava part",
"height": 260,
"width": 560,
"color": 3
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1584,
-96
],
"id": "eb3e5776-45e9-4efb-9d86-87cecbdcdfbe",
"name": "Sticky Note1"
},
{
"parameters": {
"constantsKeyName": "strvCredentials"
},
"type": "n8n-nodes-globals.globalConstants",
"typeVersion": 1,
"position": [
1616,
-16
],
"id": "f66ca2b5-e8c5-4514-9db6-52eb9597c6b5",
"name": "Strava Guillaume",
"credentials": {
"globalConstantsApi": {
"id": "5JbzC8nq0zlAuSjQ",
"name": "Strava Guillaume"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1328,
80
],
"id": "034aa0d4-898a-4857-b483-2c95902b83c1",
"name": "No Operation, do nothing"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "cqVkV6i24cpLq9A2",
"mode": "list",
"cachedResultUrl": "/workflow/cqVkV6i24cpLq9A2",
"cachedResultName": "Withings Getmeas (sub-workflow)"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {},
"matchingColumns": [],
"schema": [
{
"id": "item",
"displayName": "item",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "object",
"removed": false
},
{
"id": "session_bearer",
"displayName": "session_bearer",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
},
{
"id": "session_did",
"displayName": "session_did",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"options": {}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
368,
-16
],
"id": "cdcc2a59-d0ee-4c02-8142-c647e306726c",
"name": "Call 'Function Withings Getmeas'"
},
{
"parameters": {
"operation": "get",
"dataTableId": {
"__rl": true,
"value": "q5NSVD84Nc4TyKev",
"mode": "list",
"cachedResultName": "executions",
"cachedResultUrl": "/projects/pivQrn2UUQlCICXn/datatables/q5NSVD84Nc4TyKev"
},
"filters": {
"conditions": [
{
"keyName": "flow_id",
"keyValue": "withings"
}
]
},
"limit": 1
},
"type": "n8n-nodes-base.dataTable",
"typeVersion": 1.1,
"position": [
608,
-16
],
"id": "38b105d0-1558-47d5-b59a-907c85080b33",
"name": "Get execution"
},
{
"parameters": {
"operation": "update",
"dataTableId": {
"__rl": true,
"value": "q5NSVD84Nc4TyKev",
"mode": "list",
"cachedResultName": "executions",
"cachedResultUrl": "/projects/pivQrn2UUQlCICXn/datatables/q5NSVD84Nc4TyKev"
},
"filters": {
"conditions": [
{
"keyName": "flow_id",
"keyValue": "withings"
}
]
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"lastSync": "={{ $now.toISO()}}",
"lastOperated": "={{ $('Last measure').item.json.body.measuregrps[0].createdDt }}"
},
"matchingColumns": [],
"schema": [
{
"id": "flow_id",
"displayName": "flow_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"readOnly": false,
"removed": true
},
{
"id": "lastOperated",
"displayName": "lastOperated",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "lastSync",
"displayName": "lastSync",
"required": false,
"defaultMatch": false,
"display": true,
"type": "dateTime",
"readOnly": false,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.dataTable",
"typeVersion": 1.1,
"position": [
1328,
-112
],
"id": "43473a56-08ed-431d-b648-2f0d20cff201",
"name": "Update excecution"
}
],
"pinData": {},
"connections": {
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Call 'Function Withings Getmeas'",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Call 'Function Withings Getmeas'",
"type": "main",
"index": 0
}
]
]
},
"Last measure": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Update excecution",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"Refresh token (Strava)": {
"main": [
[
{
"node": "PUT:athlete",
"type": "main",
"index": 0
}
]
]
},
"Strava Guillaume": {
"main": [
[
{
"node": "Refresh token (Strava)",
"type": "main",
"index": 0
}
]
]
},
"Call 'Function Withings Getmeas'": {
"main": [
[
{
"node": "Get execution",
"type": "main",
"index": 0
}
]
]
},
"Get execution": {
"main": [
[
{
"node": "Last measure",
"type": "main",
"index": 0
}
]
]
},
"Update excecution": {
"main": [
[
{
"node": "Strava Guillaume",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "BTdvvxd2bZcjjJCc",
"saveManualExecutions": false,
"executionTimeout": 120,
"timeSavedPerExecution": 5,
"timeSavedMode": "fixed",
"availableInMCP": false
},
"versionId": "fff57b90-b907-4886-804f-925aa8bcbdef",
"nodeGroups": [],
"id": "Zf4Fw5L3q50KuKWs",
"tags": [
{
"updatedAt": "2025-02-04T12:22:03.365Z",
"createdAt": "2025-02-04T12:22:03.365Z",
"id": "FrPfG1uJo97LwMYT",
"name": "strava"
},
{
"updatedAt": "2025-02-04T12:21:57.474Z",
"createdAt": "2025-02-04T12:21:57.474Z",
"id": "lm01qlKgtDYMsXVU",
"name": "withings"
},
{
"updatedAt": "2025-02-07T09:02:59.148Z",
"createdAt": "2025-02-07T09:02:59.148Z",
"id": "V884e0yet4tKFBR8",
"name": "llaumgui"
},
{
"updatedAt": "2026-01-30T13:58:37.580Z",
"createdAt": "2026-01-30T13:58:37.580Z",
"id": "XbbT3AJeWm24DFHC",
"name": "2optimize"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment