Send POST request from a button

Hi Pesan. Sorry for my slow reply - didn’t notice your comment here.

From looking at your screen snip, I can’t see a column for the sharing link for the folder you want to open. I would suggest adding a ‘Folder URL’ column, and then using the following formula in your ‘Open’ button:

if(thisRow.[Folder URL].IsBlank(), concatenate("https://hook.integromat.com/xxxxxxxxxxx?RowID=", thisRow.[Order ID]), thisRow.[Folder URL])

Note the “xxxxxxxxx” above should be replaced with the unique identified for your webhook.

The formula above effectively says “If we don’t have a folder URL, then fire a webhook to create a folder, and include in the webhook the Order ID so that Integromat can find this row via the Coda API. Alternatively, if we do have a folder URL, then open the link in a new window”.

Once your Integromat scenario has created a folder and retrieved the sharing link for that folder, it will need to update the row in Coda, to populate the link URL in the ‘Folder URL’ column. To do that, you will obviously need Integromat to look up the relevant row in Coda, using the Coda-generated row key (your ‘Order ID’ column) which you passed to Integromat in the webhook as ‘RowID’.

I hope that helps!

Though no official http requests packs, one hack is to use the Image(url) and set the params method=POST to send to your server.

3 Likes

@Kepler_Liu this is a great idea. Have you run into any trouble with it? Does it work reliably? I guess you need to kill the Image at some point in your chain (maybe via API) so your endpoint doesn’t get hammered with the same info every time someone views the row.

That trick to close the tab is killing! Loved it!
I’m currently building a few integrations with integromat, to connect Coda with a Lead Management System and that tab hanging there was killing me!

I’m trying to set this up because I’d also love to have my tabs auto close.

But it doens’t seem to be working. Is there something else I should be doing in the response module?

image

Hey Aaron, did you ever figure this out?

If you’re having trouble with getting the window/tab to close, it’s because of browser standards. That’s likely why different people are getting different levels of success with the methods mentioned in this thread. I’ve been trying to find a workaround with no success.

Here is the error I’m getting in the Chrome browser console: “Scripts may close only the windows that were opened by them.”

More info: window.close() Restrictions – text/plain

If anyone has any better ideas, I’d love to know!

Any updates on this? We still don’t have that feature? Seems no-brainer to me

The ideal way to do this now is with a Pack. You would creat a Pack with an Action in it, which you can trigger from the button

2 Likes

Someone needs to create a post action pack where the pack params are the url, headers, and params of the api endpoint.

2 Likes

Not possible I’m afraid. A Pack has to register in advance what single domain it’s going to reach out to.

(Well… possible if the Pack proxies all requests through an outside server the Pack maker controls? There are security concerns with that though)

Wouldn’t it be possible now that we have Account-specific endpoints ?

I haven’t wrote a pack featuring this yet so not sure if it’s really possible.

Just works for different endpoints on the same domain I think. (Including subdomain of same domain)

1 Like

Anyone know of a way to send http commands to a localhost? Would be cool to be able to automate some local computer file operations via coda buttons.

Since Packs run on Coda’s servers they won’t be able to access your local machine directly. That said you could use a tool like ngrok to expose a local server to the internet, and then have your Pack connect to it there. Of course exposing your local computer to the internet comes with some risks, so proceed with caution.

An alternative approach may be to setup a cron job (or equivalent) on your local machine that uses the Coda API to fetch information from a Coda table. Your button could merely add an entry to a “Jobs” table, and then every few minutes the job on your local machine checks the table for new jobs it should run. The button wouldn’t be quite as instant, but it would be safer since your local machine would be reaching out to Coda, instead of Coda reaching into your local machine.

1 Like

Hi Eric, thanks yea would rather not go the ngrok approach, it’s also fairly complicated by nature. The table fetching idea seems like a very reasonable workaround but yes there would be some delay. Thanks for your suggestions.

1 Like