First: I have no experience with āNotionā.
Second: Close a tab/window with javascript works only if the window is open with javascript - not by a response html page with js: window.close().
If you can use html, there are 2 ways:
I prefer working asynchronously with ajax (fetch(), axios, jQuery, etcā¦). The page can continue to be used and data from the server can be processed.
The second: Open a pop-up and close it with javascript, but Pop-ups are not a nice thing (in my world )
With this html, you have an input field to fill in an url and two buttons for ajax and pop-up. The pop-up function has a timeout. Here you have to check how low this can be so that the webhook is executed and not aborted (user/js close window).
Your n8n webhook need additional header: Access-Control-Allow-Origin: * (or better the page-url) to call with XHR from other origins and an immidiately callback with 204 āNo contentā (or other) so that the process is not aborted when closing tab/pop-up/window.
I hope this brings you a little further in your search for a solution.
Thank you for the quick reply @BillAlex - yes so essentially notion just allows you to insert a link and then will open a new tab with that link (doesnāt work like a real button in any way unfortunately).
With that in mind (I do hope that I havenāt missed anything in the post above), is there then a way to close that new window that has been opened once the webhook request has been received and accepted.
I have the same scenario, Iām trying to rebuild an automation made with Make. Iāve set up a button in Airtable with the webhook url and I want that once triggered the open tab close automatically. Iāve tried to set a respond webhook with a body but didnāt work If some one have an idea to how to fix that.
Ps: I retested the process with Airtable and Nocodb and both worked with Make