Create a script to send data to a webhook

I have an app that gives me a webhook (not Zapier, not Make) I can send data too. I’d like to use a script in an automation that sends data to that webhook when a condition in the base is met.

I know how to create the automation, but don’t know how to write the script. Anyone that can provide help with this? I’d like the script to be editable so I could use the script in different bases, but the webhooks will be different each time.

As an alternative, I would be okay with having the webhook triggered by a formula, but I can’t get Scott’s post from February 2 to work for me in setting this up.

Anyone able to give me a hand?

Welcome to the community, @brandonhull!

Which part of my post didn’t work for you?

Please post screenshots of your setup.

What format does the app want the data to be in? Does it have documentation? Do you control what the webhook does?

In general, you use a fetch request in JavaScript. But the exact format of the data depends on what the webhook wants.

This feature of the app is in beta, coming out in a week or two. It will have some documentation and the format of the data will be JSON. I don’t think I’ll have “control” of what the webhook does, but within the app I’ll be able to select variables that can be used to map data captured in the webhook.

Thanks Kuovonne!

I don’t think I’ll be able to append data to the URL sent with the webhook, that’s the piece in question. I’ll post screenshots as soon as the feature officially goes live – it’s in a beta/staging status right now.


Sounds like you need to do a POST request with a JSON body.

I believe that Scott’s method does a GET request with url parameters.

1 Like

Ah, yes, that is correct! My method is for GET requests only.

(I actually don’t have a script on-hand for POST requests since I don’t know Javascript, but I have extensively used Make’s HTTP module to make POST requests with JSON bodies.)

As @Kuovonne intimated, the HTTP protocol used to call webhooks typically support either POST or GET; generally not both. And POST can support URIEncoded JSON in the command line if the endpoint allows it.

Without docs it’s all guesswork for the developers.

Here is the basic code you would need. Will need to update the url and body to the webhook url and body you wish to post.

let url = 'webhook url here'
let body = {
    //post body here as JSON
await fetch({
    body: JSON.stringify(body),