Send data to Webhook

How do i forward data to a webhook?

Hey there,

I am afraid you will need to be a little bit more specific here.

I think it is generally achieved by sending POST request with some specific headers.
But that’s hard to tell as you have not specified what webhook you are talking about…

1 Like

I’m trying to use Airtable Webhook to put info from a subitted form into Airtable.

I can’t send you the link to the documentation but i can copy paste some.

« You can send over any JSON object»
« If the Content-Type header is application/JSON, yes. The top level of the JSON-encoded data must be an object (as opposed to an array).

What request methods can be used in the example webhook?
Currently, only POST requests can be made.»

and are you the developer off the form?

1 Like

Yes, think i found the correct way to do this, will try later when i get home.

fetch(‘url’, {
method: ‘POST’,
body: JSON.stringify({
data
})
})

I don’t want the form itself to send the data, i need it to he server sent

Airtable WebHook Guide

Moreover, you need to add a ‘onsubmit’ event listener to your form element and prevent its default behaviour.

<form id='myForm'>
   ...
   <button type="submit">Submit</button>
</form>
document.getElementById('myForm').addEventListener('submit', (event) => {
    // prevent browser from submitting the form and page reload
    event.preventDefault();
    // collect data from the form
    // ...
    fetch(webhookURL, {
        // method
        // headers
        // body
    })
})
1 Like

works thanks for the help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.