Dynamic redirect using API connector

I want to create a signup form that captures name and email and sends to our /register endpoint. The /register endpoint returns a unique email verification link that I’d like to redirect the user to.

I see docs for using Rules + API Connectors to pre-fill fields, but can’t find any examples for this use case. Is this supported?

Hi Mike,

You can leverage the API Connector and logic rule to send the name and email to your endpoint, and write code in the logic rule’s code editor to receive the URL and redirect the user to the URL link.

Below is a quick example of how you could do it (after setting the API Connector to your endpoint):

const body = {
  name: NameInput.value, // change to your own field name and request body format
  email: EmailInput.value // change to your own field name and request body format
  // ... other request body fields if needed
}
const response = await feathery.http.post("Your Endpoint URL", body);
// process your response to obtain the link if needed
// eg. const link = response.link
window.location.href = link;

Please let us know if you have further questions. Thank you.

Thank you,
Summer

Thanks Summer. I’m running into an error where the code editor is saying ‘window’ is not defined. Any tips?

// map fields from feathery form
const body = {
  firstName: first_name.value,
  lastName: last_name.value,
  email: email.value 
  
}

//process the response
const response = await feathery.http.post("https://integrationapi.greencheckverified.com/users/marketing-user-registration", body);
const link = response.passwordUrl

window.location.href = link;

Ah I see. It’s disabled unless we upgrade to business plan.