Assistance Required; Issue with Webhook in Workflow Using API

Hi,

I’m having an issue during a workflow, which I have created, where I try to action a webhook and it doesn’t seem to work.

Screenshot below of workflow;

So when the ticket is raised, with the subject stated, it sends the email to requestor, this all works fine and has been tested.

The email body sent to the requestor contains an approve and deny link, like so;

Dear {{ticket.requester_name}},

We have received your request. Please
review the details provided and let us know if you approve or deny this request by clicking one of the links below:

[Approve]
(https://your_freshservice_domain.freshservice.com/api/v2/tickets/{{ticket.id}})

[Deny]
(https://your_freshservice_domain.freshservice.com/api/v2/tickets/{{ticket.id}})

So when the requestor selects the Deny link in the email, for this workflow. I want it to trigger the webhook action, to update a custom field named approval status and then close the ticket.

This work flow is only for the Deny link option for now, I haven’t set up the approval link workflow yet, due to not being able to get this one to work.

The webhook has been setup like this;

The content for this webhook is

{
“custom_fields”: {
“cf_approval_status”: “denied”
},
“status”: 5
}

When the requestor clicks the Deny URL they get the following error;

I have removed the proper URL and API key’s for security reasons on the above screenshot of the webhook, I have checked and these are correct.

The API key used for the webhook is for an admin role account with access to everything in the environment.

Any ideas what I’m missing? Am I using the wrong URL in the email body should it be something along the lines of;

[Deny] (https://your_freshservice_domain.freshservice.com/update_status?ticket_id={{ticket.id}}&status=denied)

Or is it something else?

Best regards,

Hello @John8908, welcome to the community. I see a couple issues with this but first, are you only wanting an approval process around incident tickets? Freshservice has built in approval functionality around service requests, perhaps that would be a better route. This would allow you to use workflow automators and choose the action “Send approval mail to” where then you can add additional actions based on “approve” or “rejected”

The workflow you have built does not have the ability to listen to a response from the requester. In fact, the way your workflow is built, the trigger webhook action should be executing every time. I imagine the reason its not setting the field to “denied” is because you are not passing the API key correctly. Try setting it to “Basic Auth” and use the API key in the “username” field, and an “X” in the password field. I bet you will see it execute immediately following the send of the email. But again, without using the built in approval workflow of a service request, you cannot set the workflow to listen for a response. Also your Approve and Deny links are the same and pointed to an API url. Your browser will do a GET request and just return JSON data of the ticket.

Sorry I don’t have better news. One thing you could do is just send them the freshservice ticket url, they will be able to get to the ticket in the portal, and if you set your “Approval Field” to be visible to requesters then the user will be able to toggle it to approved or denied. Hope that helps!

Hello, First of I recommend using the web request node, it get logged and you get respons from the request.

As @Zach say you can use the approval action and continue
Downside with using approval action is that the ticket get locked and no other event will be triggered until it’s approved.

The link generated for approval can’t be manually created.
The link you first mention are API call and then the request need to have a agent API key to send the API call.

Hmm, you don’t like to use the approval function, just want the requester to change status to Denied ?

Where did you find this ?

https://your_freshservice_domain.freshservice.com/update_status?ticket_id={{ticket.id}}&status=denied
2 Likes

Hi Zachary,

Thank you for responding, yes I have seen the send approval mail action to reporting manager option and I will be using this at some point during the workflow.

Essentially I was building a couple of work flows, with multi-stage approval built into them, so for example.

Request or ticket is raised > it goes to HR to fill in some information > then it goes back to the original requestor to approve or deny > then this goes to the requestors reporting manager to approve or deny > etc.

There is more of the flow after that but I don’t want to bore you will all the details!

So I planned on using the send approval mail action later down the flow which is why I was trying a different approach for the first approval part.

I have actually managed to resolve the below error permission now.

It turns out the user I was using for the API key had a full license for the IT agent group and the correct permissions.

However the workspace where the ticket goes into once created, was only accessible to users who had a full license for the business agent group.

After making a user in this agent group and giving it an admin permission role and generating a new API key this worked successfully.

However as you stated my approval and deny links where just the API URL, so the browser just done a GET request response and returned the JSON data of the ticket.

I didn’t realise Fresh Desk’s webhook’s weren’t designed for direct user interaction in the browser etc.

Your suggestion toward the end, might be the route I have to go down but I will think this through.

Appreciate the response, many thanks!

1 Like

Hi Daniel,

Thank you for responding,

https://your_freshservice_domain.freshservice.com/update_status?ticket_id={{ticket.id}}&status=denied

This URL was just one given by copilot when I asked it a similar question before posting here.

So I’m guessing it’s not useful then ha!

I have never seen that URL combination before :slight_smile:

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.