Sending data to a 3rd party webhook / API post

Hey I was wondering if its possible to send a data via a webhook or post to an external API once a new record is created.

I have been looking around the docs and trying to work out the best way. I am trying to output the users data to a third party.

Hi,
You can learn how to do it here .

You could have a look at something similar I did with a Wix form, Zapier Webhook and Google Calendar: https://girizano.wixsite.com/codecorner/post/writing-events-to-google-calendar-with-zapier

I believe they are asking how to post to a 3rd party endpoint, not create their own endpoints.

@oliver5975 I believe the best way to do that is with a data hook: https://www.wix.com/corvid/reference/wix-data.Hooks.html#afterInsert

Combine with a fetch call to your API https://www.wix.com/corvid/reference/wix-fetch.html or call to Zapier

Would that solution work for you?

We wanted to avoid Zapier, we just wanted to send the form submission data to a lead management system. I can see an easy way of doing this. The documentation is not really clear on how to send the details of the of the form e.g firstname. last name, email phone etc. Been struggling to find any working examples online which is why I thought I would try and raise a post.

IIf anyone has a working example of sending the data entered in a form to an external webhook or post request that would be great.

FYI - just did this. Used fetch ( https://www.wix.com/corvid/reference/wix-fetch.html#fetch ) to post data to an endpoint after registration. Worked great.

holy moly I’ve made it, thanks for your inspiration!
Here’s the code works in Dec 2022

import wixFetch from 'wix-fetch';

var variable1 = $w('#input1').value;
var variable2 = $w('#input2').value;
var variable3 = $w('#input3').value;


    const data = `&firstname=${variable1}&email=${variable2}&phone=${variable3}&`;

    fetch( "your_Webhook_URl_here", {
    "method": "post",
    "headers": {
        "Content-Type": "application/x-www-form-urlencoded"
    },
    "body": JSON.stringify(data)
    } )
    .then( (httpResponse) => {
        if (httpResponse.ok) {
        return httpResponse.json();
        } else {
        return Promise.reject("Fetch did not succeed");
        }
    } )
    .then( (json) => console.log(json.someKey) )
    .catch(err => console.log(err));