If you signed up before Aug 9, 2021, please click Previous plans to view your applicable plans.

This article provides a comprehensive set of examples of using webhooks in automation rules that run on ticket creation or ticket updates. To understand webhooks, see Using Webhooks in automation rules.


This article contains:


Note: If you are using Freshdesk Omni, go to Admin Settings > Configuration and Workflows > Ticket Automations to access Automations.

Use webhook to remove tags from all tickets instantly

Using webhooks, you can systematically eliminate tags from any tickets meeting specific criteria. 


For instance, consider a scenario where you label all tickets assigned to the Billing team as "billing." In the event that these tickets are reassigned to the Support team, the tags must be removed. However, you can avoid this manual task by configuring a rule to automatically remove such tags when a ticket is reassigned to the Support team and if the ticket priority is updated to Urgent.


This simplifies tag management, reduces manual effort, and streamlines your ticket workflows.

  1. Go to Admin > Workflows > Automations.

  2. Click on New Rule from the Ticket Updates tab.

  3. Enter the rule name.

  4. Choose the following events, conditions, and operators:

    Event performer (When an action performed by) -> Agent.

    Event: Group is updated -> From -> Billing -> To -> Customer Support

    Condition: In Tickets -> If Priority is > Urgent

    Operator: Match Any of the below conditions


  5. Select the Action to be performed: 

    • Choose Trigger webhook.

    • Select Request type as PUT.

    • Under URL, use Freshdesk’s Update ticket API call.

    • Enable Required authentication.

    • Enter the API key. You can find your API key in your profile settings.

    • Select JSON Encoding and choose Advanced Content.


    • Enter the following payload in the custom API request.

       {

          "tags": ["Example1",”Example2”,”Example3”]

      }
      Note: Replace the examples with the tags you wish to remove

  6. Click Preview and Save.

  7. After reviewing the rule, click Save and enable.


Use webhook to create a new ticket when a customer responds to a ticket

Use webhook to automatically create a new ticket whenever a customer responds to a closed ticket. 

  1.  Go to Admin > Workflows > Automations.

  2. Click New Rule from the Ticket Updates tab.

  3. Enter the rule name.

  4. Choose the following events, conditions, and operators:

    Event performer (When an action performed by):  Requester.

    Event: Reply is sent

    Condition: In Tickets -> If status -> Is -> Closed

    Operator: Match All of the below conditions


  5. Select the Action to be performed: 

    • Choose Trigger webhook.

    • Select Request type as POST.

    • Under URL, use Freshdesk’s Create ticket API call.

    • Enable Required authentication.

    • Enter the API key. You can find your API key in your profile settings.

    • Select JSON Encoding and choose Advanced Content.
      {

"email": "{{ticket.from_email}}",

"description": "{{ticket.latest_public_comment}}",

"subject": "{{ticket.subject}}",

"status": 2,  

"priority": 1, 

"group_id":{{ticket.group_id}},

"responder_id":{{ticket.agent.id}},

"type":"{{ticket.ticket_type}}"

}

  1. Click Preview and Save.

  2. After reviewing the rule, click Save and enable.


The rule creates a ticket with all the ticket properties from the existing ticket to the new ticket.


Use webhook to share tickets with other Freshdesk accounts

You can share tickets with other Freshdesk accounts using webhooks and choose the information you want to share in these tickets. 


For example, consider your support and QA teams are using separate instances of Freshdesk and share tickets between their accounts. When a customer reports a bug, the support team shares that ticket with the QA team. While the support team helps the customer with a temporary solution, the engineers in QA will be working to fix the bug.


To achieve this, you can configure automation rules to share tickets based on specific events that update a ticket. For example, create a rule to share tickets when an agent changes the ticket type to "Support". Alternatively, you can create custom fields, such as a checkbox named "Share ticket," and set up a rule to trigger ticket sharing whenever an agent selects this checkbox.


Creating a custom field:

  1. Go to Admin > Workflows > Ticket Fields.

  2. Drag and drop a checkbox field into the form and name it Share ticket.

  3. Make sure to disable the view and edit access for customers for this field before saving the field.

Creating automation with the custom field

  1. Go to Admin > Workflows > Automations > Ticket updates tab > New rule.
    Note: Since this rule requires an agent to execute an event (checking the 'Share ticket' box), this webhook should be triggered by a rule that runs on ticket updates rather than an automation that runs on ticket creation.

  2. Enter the rule name and a description.

  3. Set the trigger event as Share ticket is checked.

  4. Select the condition for which you want to create the rule.

  5. Under Actions, select Trigger Webhook. You can choose the same webhook mentioned above in the sharing all tickets section.
  6. Click Preview and Save.

  7. After you preview the rule, click Save and enable.



Use webhook to update the ticket subject

Use webhook to update the ticket subject line if they meet specific criteria. For instance, when a requester from a particular company opens a new ticket, you can add their company name to the subject.

  1. Go to Admin > Workflows > Automations.

  2. Click New Rule from the Ticket Creation tab.

  3. Enter the rule name.

  4. Under On tickets with these properties, define the companies whose tickets should be affected.

  5. Select the Action to be performed (see image below):

        "subject” : “{{ticket.company.name}} | {{ticket.subject}}”,

         }

  1. Click Preview and Save.

  2. After reviewing the rule, click Save and enable.


Use webhook to capture the last updated time in a custom text field

Use webhook to update a custom text field with the timestamp for when the ticket was last updated.


Creating a custom field:

  1. Go to Admin > Workflows > Ticket Fields.

  2. Drag and drop a single-line text field into the form with the following properties and click Save Field:

    • Label for agents: cf_last_update_time

    • Label for customers: Last updated time

    • Under Behavior for Customers, uncheck "Can View" and "Can Edit"


Fetching a custom field's label:

If you are using an existing custom field, you might need to fetch its agent label to create your webhook request body.

  1. Login as an Admin into your Freshdesk account.
  2. In a new tab in your browser, call the API endpoint for ticket fields with your Freshdesk domain:
    • https://yourDomain.freshdesk.com/api/v2/ticket_fields
  3. Type the custom field in the search bar to find the relevant property.
    • The label property contains the customer-facing label. In this example, that is "Last updated time".
    • The name property contains the agent label. In this example, that is "cf_last_update_time".


Creating the webhook automation:

  1. Go to Admin > Workflows > Automations.

  2. Click New Rule from the Ticket Updates tab.

  3. Enter the rule name.

  4. Choose the following events and conditions:

    Event performer (When an action performed by):  Agent or Requester.

  5. Select the Action to be performed (see image below):

    • Choose Trigger webhook.

    • Select Request type as PUT.

    • Under URL, use Freshdesk’s Update ticket API call.

    • Enable Requires authentication and enter your API key (found in profile settings).

    • Select JSON Encoding and choose Advanced Content.

    • Enter the following payload in the custom API request.
      {
          "custom_fields" : {
              "cf_last_updated_time" : "{{ticket.modified_on}}"
          }
      }

  1. Click Preview and Save.

  2. After reviewing the rule, click Save and enable.