[ { "id": "spotify_example_flow", "type": "tab", "label": "Spotify Light Example", "disabled": false, "info": "" }, { "id": "inject_now_playing", "type": "inject", "z": "spotify_example_flow", "name": "Get Currently Playing", "props": [ { "p": "action", "v": "currentlyPlaying", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 180, "y": 120, "wires": [ [ "spotify_node" ] ] }, { "id": "inject_playback_state", "type": "inject", "z": "spotify_example_flow", "name": "Get Playback State", "props": [ { "p": "action", "v": "playbackState", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 170, "y": 180, "wires": [ [ "spotify_node" ] ] }, { "id": "spotify_node", "type": "spotify-light", "z": "spotify_example_flow", "name": "", "account": "", "action": "currentlyPlaying", "market": "", "x": 450, "y": 150, "wires": [ [ "debug_out" ] ] }, { "id": "debug_out", "type": "debug", "z": "spotify_example_flow", "name": "spotify response", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 670, "y": 150, "wires": [] }, { "id": "spotify_reauth_catch", "type": "catch", "z": "spotify_example_flow", "name": "Spotify errors", "scope": [ "spotify_node" ], "uncaught": false, "x": 180, "y": 320, "wires": [ [ "spotify_reauth_filter" ] ] }, { "id": "spotify_reauth_filter", "type": "function", "z": "spotify_example_flow", "name": "Detect re-auth", "func": "if (msg.error && msg.error.message && msg.error.message.includes('Re-authentication required')) {\n msg.payload = {\n event: 'spotify_reauth_required',\n message: msg.error.message,\n node: msg.error.source && msg.error.source.id,\n timestamp: new Date().toISOString()\n };\n return msg;\n}\n// Ignore other (transient) errors\nreturn null;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 420, "y": 320, "wires": [ [ "spotify_reauth_webhook" ] ] }, { "id": "spotify_reauth_webhook", "type": "http request", "z": "spotify_example_flow", "name": "Webhook / Notification", "method": "POST", "ret": "txt", "paytoqs": "ignore", "url": "https://example.com/your-webhook", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 700, "y": 320, "wires": [ [] ] } ]