Is it possible for third parties to send post requests through Forest?

Right now we have multiple external forms that we use for data submission. We set up the submit to send a post request to a webhook through Zapier, and we use zapier to perform logic and then create a row in our SQL database.

We’d love to cut out the middle man and send a post request directly to our API to create/manipulate data in our server/database. Is there a way to set up an endpoint for the form submissions to hit in the routes files? That way we can write the logic in Javascript vs Zapier?

Thanks so much! I know you guys field a lot of issues here, but our team has shifted all of our workflows and day to day work to Forest and it has drastically increased our efficiency! We’re excited to continue building on the platform! There should be a “praise” section on here. :slight_smile:

2 Likes

Hello @Matt :wave:

We are happy to read that you are migrating a lot of things to Forest :christmas_tree:, and that we help to increase your opts efficiency :confetti_ball::tada: Thanks for this feedback, it is a really good motivation :pray:

The short answer to your question is: Yes, this should be possible.

Knowing that you own the code generated by lumber (your agent) you can create every endpoints you want. Instead of pointing to your Zapier webhooks, you could directly point to your agent and handle the data in here (as you would do for a smart action for example). It will require some setup (authentication …) but this should definitely be possible. Your agent is an independent API server, you are free to build anything you want :building_construction:

A good solution could also be to code your forms directly as smart actions at forest. You could invite your third party actors to your project and give them access to your smart actions so everything would be centralised (no more external forms).

If you give us more details about how your external forms are build, and how they communicate with Zapier, we would be able to advise you, and guide you to integrate them directly into Forest :slight_smile:

Does this help ?

Steve.

Hey @Steve_Bunlon

That’s awesome, and yes, this does help!

These specific forms are front facing to clients/customers, so they would have to stay outside Forest. Right now we have one form that is simple HTML/CSS/JS integrated in a Wordpress site with submit logic pointing to the Zapier webhook URL.

The other forms were built in JotFrom using JotForm’s trigger in Zapier, but we are looking at converting those to React, with the similar setup of pointing the submit logic to a Zapier webhook URL. Right now the form basically points to the webhook URL as the form action with a post method. From there Zapier parses out the JSON on there end as separate fields:

<form id="formId" class="form-css" action="https://hooks.zapier.com/hooks/catch/{id}" method="post" target="hiddenFrame">
</form>

Rather than directing the submit logic to a simple webhook URL that would parse out the JSON through Zapier, would we instead hard code an http request inside of the form logic with an authentication header pointing to a REST API endpoint through our agent?

Hi @Matt,

You’re totally right.
The authentication process could potentially use a login/password created for this purpose (Which seems the better option), or a generated token (But you would have to manually update this token every now and then, when it is revoked).

Let us know if you have any other questions :slight_smile:

@jeffladiray Since the forms don’t really require any authentication currently (not the ideal solution, but we’re working with what we currently have. The forms are only used to collect new data with public access) would it be possible to just set up a route in my routes folder without authentication?

Indeed.

Since the generated project is yours, this is definitely do-able (You should be able to inject any kind of express related code in the project).
However I don’t recommand you to do like this though, since it could potentially leads to security issue (Bot spamming this service for example). Authentication is needed for all the forest-admin related routes, so this would be safer to use authentication I guess.