Aug 11, 2020 02:04 AM
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?
Cheers
Matt
Mar 01, 2022 11:51 AM
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));```
Mar 02, 2022 07:46 AM
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.
Mar 05, 2022 08:50 PM
Get the cell value of the attachment field. It contains the url of the file. The format is documented here.
Mar 08, 2022 08:43 PM
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 = "https://hooks.zapier.com/hooks/catch/xxxxxx/xxxxx/?";
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]}`);
Mar 08, 2022 10:32 PM
Try using encodeURIComponent
instead of encodeURI
.
Mar 09, 2022 06:20 AM
That worked! Thank you so much :blush:
Nov 14, 2022 06:40 AM
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(
`https://api.clickup.com/api/v2/space/${spaceId}/folder?${query}`,
{
method: 'GET',
headers: {Authorization: 'test'}
}
);
const data = await resp.text();
console.log(data);
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?
Nov 14, 2022 07:43 PM
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.
Nov 15, 2022 07:28 AM
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.
Jun 30, 2023 05:50 AM
I have this exact same issue, how do I create a recordID input variable for the record ID of the triggered variable?
Thanks