You can create an automation rule that runs on ticket creation or ticket updates to trigger a webhook call as soon as specified events occur.
This article contains: |
About Webhook calls
A webhook is a 'callback' to an application or web service that is automatically triggered in response to a specified event. In Freshdesk, a webhook lets you make an API call as part of an automation action. Webhooks use the Agent API, so they are treated as an agent performing an update.
For example, let's say you need to update a contact with their most recent satisfaction survey result. You can achieve this by:
- creating an automation rule that runs on ticket updates,
- setting it to run when a satisfaction survey result is made available, and
- having it make a webhook call (as a proxy for an agent) to update the relevant contact.
Webhooks in automations that run on ticket creation
When tickets are created, you may want to automatically update certain properties or create records in an internal CRM, among other actions. You can use webhooks within automations that run on ticket creation to make those changes automatically.
Webhooks can update properties that aren't available as standard options within automation rules. For example, you can update the ticket subject or the contact property.
Webhooks in automations that run on ticket updates
Using automation rules that run on ticket updates, you can update, modify, send notifications, and run actions within Freshdesk. For example, you can update a ticket's priority, send escalation emails, and more.
Webhooks also come in handy when you want to trigger an action in an external application or tool (as well as some updates that the automation rule can't perform, such as updating the time entry on a ticket or adding a note to a ticket). Here are some examples of scenarios in which you could use webhooks:
Example scenario | Conditions to look for | What the webhook should call |
Send out an SMS when a customer replies to a ticket | Customer replies to ticket (or adds comment) | Send comment content to third-party SMS tool |
Update inventory when a Product Return request is updated | Ticket category (a custom field) is updated to 'Product Return' | Update product info in store inventory |
Sync status for Feature Requests with internal Product Management tool | Status is updated for tickets of type 'Feature Request' | Update product management tool with ticket information |
Sound the alarm when a Bad Customer Satisfaction rating is received | Customer feedback is received, and the rating is 'Not Good' | Customize a Smart Bulb and a siren soundboard to fire up triggered by this webhook |
Set up a webhook request in an automation rule
- Navigate:
- In Freshdesk: Admin > Workflows > Automations
- In Customer Service Suite: Admin Settings > Configuration and Workflows > Ticket Automations
- Choose the Ticket Creation or Ticket Updates tab and click New Rule.
- Name your rule and set up your triggers and conditions. See Automation Examples: Using Webhooks.
- Under Perform these actions, select the Trigger Webhook option.
- Choose the Callback Request Type. Most applications typically follow these standard methods:
- GET - retrieve one or all resources. See the warning below.
- POST - create new resources. Adding a note is a POST request.
- PUT and PATCH - update a resource.
- DELETE - delete a resource.
- Specify your callback URL configured for webhook. You can make the URLs dynamic using placeholders.
- For example, to add a note to a ticket, you must specify the ticket. Your callback URL would be https://acme.freshdesk.com/api/v2/tickets/{{ticket.id}}/notes with the placeholder {{ticket.id}}.
- Toggle Requires authentication and provide your API key.
- Toggle Add custom headers to convey additional information such as security details, API version details, etc.
- A custom header has to be entered as a header-value pair following the specified format X-Sample-CustomHeader1: VALUE.
- A header containing more than one value should be separated by delimiters (other than commas and colons).
- To add a second header, enter the custom header and value pair in the next line.
- The trigger will not be executed if there are spaces in between. If a space is entered at the end of the header, it will be skipped.
- Header names are not case-sensitive. They will be handled as such regardless of the custom header name provided. The custom header values will be preserved as is.
- Create your webhook body in the Content section.
- Pick the Encoding of your request that the resource application supports (JSON, XML, or XML-Encoded). The example below is JSON.
- Select the Simple Content option to send a list of ticket properties that you want in this webhook.
- Select Advanced to write a custom API request. You can make dynamic API requests using placeholders. See Freshdesk API Reference.
- You can use requestb.in or postman - REST client (a Google Chrome extension) to test our APIs.
- The {{Triggered event}} placeholder is available only in webhooks and returns the name of the event that triggered the rule.
Warning: Webhooks run asynchronously to automations. If you make a GET call with a webhook, your automation rules won't be able to use the response.
Webhook Callback Request Limits
The number of webhook requests you can use in an hour is limited to 1000 calls. If the status codes are:
- 200-299: the callback is a success.
- 300-399: the callback will be redirected.
- Other: the callback fails. The webhook will automatically be retried once every 30 minutes, totaling 48 calls.
If a webhook call fails, Account Administrators will receive an email stating the time and reason for failure.