Respond to Webhook: Redirect to custom scheme/protocol myapp://foo

Problem

I can’t seem to find a way to respond to a webhook with a redirection to a custom scheme/protocol for my app.
I’m developing an app and using N8N to automate some workflows. I’m using the Webhook and Respond to Webhook nodes. The Respond to Webhook node should redirect the app to an app-specific URI, in order to implement deep-linking. Meaning, I need to redirect to something that looks like ‘myapp://foo/bar?q=1’

Custom protocols are used in mobile apps and PWA’s. Here are some examples.

Deep linking for Android apps

Custom protocol handler for Chrome

Error message (if any)?

Invalid input for 'Redirect URL' [item 0]
'redirectURL' expects a url but we got 'myapp://foo/bar?q=1'

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.42.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: MacOS

I just figured it out.
Just respond with 302 and a Location header.

P.S.: I love how N8N just bends to your will :smiley:

6 Likes

Hi @mig82

That’s awesome and very clever :nerd_face:
Thanks for sharing your solution!

:+1:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.