Sending different kinds of API post requests depending on user input | Community
Skip to main content
Question

Sending different kinds of API post requests depending on user input


hello,

I’m very new to Typeform. I’m the developer of a new website that needs to collect information about companies, construction projects, rental housing etc and I’m thinking maybe Typeform could do a good job here but I’m not sure if it is advanced enough for this.

So lets say the user opens the form, and it asks for personal info etc first. Then the user needs to put in if he wants to register a company, a construction project or wants to rent out his housing. Could there be different kinds of forms depending on what he chooses. And in the end of this customer journey, could there be different kinds of API calls to supabase (the backend we are using with a postgres database) to post this data?

Also, could the form be in two different languages?

I’m using next.js as the framework for this, and I’ve seen some nice embedds of typeform to react. :-)

Please give me all the tips, comments and suggestions you can think about.

Thank you!

9 replies

Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14905 replies
  • August 29, 2024

Hi @HankStar Welcome to typeform and our little corner of the internet! It’s lovely to have you here. 

As for creating different forms, you could do something like this or you could use logic jumps to show questions that apply based on the previous answers they’ve given!

If you only have a few questions they need to answer, then I think the logic jump option is good. However, if there will be a lot more questions to answer, then I would definitely send them to a new form. 

As for languages, we actually have a translation tool that can translate the form based on the language your customer’s browser is in! You can read more about this here

Tagging @mathio and @picsoung for tips on embedding!


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • September 2, 2024

Hello @HankStar 

we offer React Embed SDK @typeform/embed-react that works with Next.js. Make sure to render it client-side only, as the SDK does not support rendering server-side because it relies on browser APIs.

You can use callbacks if you want to integrate it more tightly with your website, just make sure to wrap them in useCallback to avoid unnecessary re-renders.


  • Author
  • Explorer
  • 3 replies
  • September 2, 2024

thanks @mathio, I think I have an understanding of how to embed the typeform. What I am unsure about is how much I can control the form from the data, depending on what “route” the user took, because it needs to be posted into different kinds of places of our database depending on what choices the user picked.

Also, one route, or choice the user took might be needed to be posted into the CRM as a lead, while other choices or routes in the typeform needs to be posted into a database. So how much control do I have of managing the data when the user has completed the form. Because depending on what route the user took, and what data he posted, it needs to be posted into different plances.


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • September 4, 2024

We support webhooks. You can receive responses as JSON from your form in your custom endpoint and build your functionality based on responses to save the data where necessary.


  • Author
  • Explorer
  • 3 replies
  • September 4, 2024

@mathio do you have some kind of example or tutorial of doing this with a react-app? If it is possible, I really think you could leverage of having it!


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • September 6, 2024

React is frontend library. You will need to receive webhooks on backend. It is possible to build such endpoint eg. in JavaScript if that is your preference.

You can find an example payload in our developer docs. You can also create a webhook for testing purposes in the “Connect” tab of your form’s admin UI and send test requests to your endpoint:

 

You can also find some example projects in our developer portal community page (eg. there are few built in JavaScript / Node.js).


  • Author
  • Explorer
  • 3 replies
  • September 12, 2024

@mathio you are right. I am using Next.js a full-stack library. Hoping I could use typeform with that. Are there any tutorials for this?


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • September 12, 2024

You can find some resources here:


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14905 replies
  • September 18, 2024

Hi @HankStar Happy Wednesday! Were you able to use any of the suggestions above? Let us know!


Reply