Answered

Make decision based on API calls

  • 23 June 2021
  • 7 replies
  • 435 views

Hey Folks, I was just wanting to create a TypeForm, which actually has some dynamic data, I used the Create API to do so, but i really wanna go one step further and make api calls in between two different form slides, based on used decision, For eg, If the User enters says his/her UserID, i want to go to API fetch the Details of that user and Show up in the next form slide, is it possible with TypeForm? If so, how can we achieve this ?

icon

Best answer by picsoung 23 June 2021, 22:41

View original

7 replies

Userlevel 7
Badge +5

Hi @Micheal Thanks for stopping by, and great question! When the respondent is filling out the form, all of the fields need to be set ahead of time, so it isn’t possible to have dynamic fields/data. 

I can’t think of any easy workarounds offhand, but @picsoung might have a better idea if there is one!

Userlevel 7
Badge +5

Hi Micheal,

Thank you for your question!
Unfortunately, we are not there yet

Currently a form is static at the moment it renders, you can’t make any API calls between questions.

One way to build the flow you are describing would be to separate the flow in two forms.
Once the first form is submitted, make an API call, and redirect to the second form by passing details via hidden fields.

As a developer I have been dreaming about this possibility for many years… every day we are getting closer ;)

Appreciate the replies, it’s streamlined our decision to build the interface our self rather then use Typeform. 

 

Feels like a core user need, it doesn’t say anything negative by the majority static form and export functionality. 

Hi @picsoung - do you have any updates on the the feature referenced above?  If this is not on the roadmap anytime soon, can you provide an example on how would I build this with a 2-form approach where the second form will be built dynamically based on the answer from the first form, and how to redirect user to the second form after the first one is completed?  Thanks!

Userlevel 7
Badge +5

Hey @clx 

Unfortunately, I can’t share any specific date for this release. But there is hope it could happen in 2022 🤞

New question blocks like the recently launched Calendly block are getting us one step closer into this direction in terms of the underlying technology.

If I detail the 2-forms solution
Let’s imagine that we want to check if a user already has an account with us.

Form A collects informations (name, age, email, ...)
It redirects using Redirect on Completion or a link on a Thank you screen to a server you own (myawesomewebsite.com?email={responseEmail})

On this server, you extract the email from the query parameter
You check in your database if this email exists
you make your own secret sauce 🧑‍🍳

Then you can redirect to the Form B
You can even pass hidden fields to this Form B, like email_exists and have some logic to some something if its false…

Hope it makes sense
 

@picsoung Is there any update on this feature? It would be super cool if we could trigger a webhook in between questions. Our usecase:

First question: Please provide company number (triggers webhook with company number as payload)

If company exists in our DB, then redirect user to next question and prefill company data retrieved from our DB.

If company does not exist, redirect to a “Thank you screen” saying user needs to enter an existing company.

You mentioned that you might have. feature for something like this ready in 2022. Did you maybe manage to make that happen? :D

If not, id the previous workaround still what you recommend to make something like this happen?

 

I’d also like to know if this feature is available?

Reply