TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
Redirect option on URL Webhook
Dear All

Teamdesk includes a great webhook feature, which enables Teamdesk to receive third party applications information in a very convenient way. This feature can be used with an URL function ie you get a machine call https://[webhookaddress]?param1=1234&param2=abcd and you can process information 1234 and abcd very easily.

With a small improvement, you could use this with buttons or weblinks.

If you create a link with
https://[webhookaddress]?param1=1234&param2=abcd
when you press the link, it will transmit the information
but the user will see 1) a dark screen in his web browser and 2) a zero byte file being downloaded.

The improvement I am suggesting would be to add a redirection option in the URL webhook.
ie you would redirect the user either to a fixed URL (defined in the webhook) or to an URL transmitted as a parameter of the webhook call.
Some API service providers propose this feature.

There might be simpler ways to do this - I am no expert

Kind regards,

Pierre
ID
2085
Category
Integration/API
Author

Pierre
Date Created
10/26/2024 12:29:12 PM
Date Updated
10/30/2024 9:37:22 AM
Status
New Idea
Score
20
Promoted By
VictorPierre
Comments
Pierre 10/30/2024 9:37:22 AM
Slava proposed me a workaround which addresses the question efficiently.
I quote the master for the benefit of us all:
{
For the webhook redirection, as a workaround, you can create an HTML page in the database resources with a script that:
1. Calls the webhook.
2. Redirects the user to the desired page or displays a custom message.
}

I asked an AI to generate me the html code that would do it

Et voilà


<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Confirmation Dépense</title>
</head>
<body>
<script>
// Function to get URL parameters
function getUrlParameter(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}

// Retrieve parameters
const type = getUrlParameter('type');
const mail = getUrlParameter('mail');
const record = getUrlParameter('record');
const confirm = getUrlParameter('confirm');

// Construct data for the POST request
const data = {
type: type,
mail: mail,
record: record,
confirm: confirm
};

// Send the POST request to the webhook
fetch("https://WEBHOOKURL", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => {
if (response.ok) {
// Redirect to the confirmation page
window.location.href = "https://REDIRECTIONURL/";
} else {
console.error("Error calling the webhook");
}
})
.catch(error => console.error("Network error:", error));
</script>
</body>
</html>



Feedback
 
Back to Search Results