Re: A little help with a script to trigger a webhook

1940 0
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

Hi all,

I need a bit of help with a simple script to trigger a webhook URL. I don’t need to collect or post any info from the webhook, just to trigger it, like clicking a link.

Any ideas on what that script might look like?



29 Replies 29
5 - Automation Enthusiast
5 - Automation Enthusiast

This could potentially help me avoid the need of creating a ton of views and properly work with Zapier.

I’m creating a script that sends data to Zapier that then posts to various social media apps.

I’m facing an issue when including fields that are attachments (images).

Any recommendations on how to handle this?

Example of what I’m working with:

let config = input.config();

await fetch(url + "&instagramCopy=" + encodeURI(config.instagramCopy) + "&twitterCopy=" + encodeURI(config.twitterCopy) + "&facebookCopy=" + encodeURI(config.facebookCopy) + "&facebookMedia=" + encodeURI(config.facebookMedia));```
5 - Automation Enthusiast
5 - Automation Enthusiast

It looks like I can get the URL of the file by using a formula like so

Now the question is how to do it with the script so that I don’t have a bunch of columns for media files’ URL only to take that and add it to the script.

Get the cell value of the attachment field. It contains the url of the file. The format is documented here.

5 - Automation Enthusiast
5 - Automation Enthusiast

So I’ve managed to get this working but have run into a new issue.

When the copy I’m injecting to the webhook contains a hashtag it doesn’t work.

Anybody how to bypass this?

My current code :point_down:

let url = "";
let config = input.config();
let files = config.mediaFiles.split("https").map(x => { return "https"+x }).slice(1)

await fetch(`${url}&instagramCopy=${encodeURI(config.instagramCopy)}&twitterCopy=${encodeURI(config.twitterCopy)}&facebookCopy=${encodeURI(config.facebookCopy)}&pinterestTitle=${encodeURI(config.pinterestTitle)}&pinterestCopy=${encodeURI(config.pinterestCopy)}&facebookMedia=${files[0]}&instagramMedia=${files[1]}&pinterestMedia=${files[2]}`);

Try using encodeURIComponent instead of encodeURI.

That worked! Thank you so much :blush:

6 - Interface Innovator
6 - Interface Innovator

Hi @Justin_Barrett

Thanks for this awesome thread. I am trying to get the output on running a script that gets the folder names in Clickup, but I can’t seem to get the output code to work.

The code from Clickup’s API works when tested:

const query = new URLSearchParams({archived: 'false'}).toString();

const spaceId = 'YOUR_space_id_PARAMETER';
const resp = await fetch(
    method: 'GET',
    headers: {Authorization: 'test'}

const data = await resp.text();

but the output.set code doesn’t seem to fit in anywhere (red error). I’ve tried variations of the code but it isn’t successful when testing. Does anyone know how I can get the output with the code above?

Please share an example of what you’ve tried so far. It’s hard to know what to recommend without seeing what you’ve already attempted.

Hi Justin,

What I wanted was to do was to output the response of the script and I’ve managed to figure it out. Thanks for taking the time to reply.

I have this exact same issue, how do I create a recordID input variable for the record ID of the triggered variable?