We have recently refreshed our branding across our offerings and changed the names of our pricing plans. If you have signed up before Aug 9, 2021, please click Previous plans to view your applicable plans.
We assure you that this change will not impact your product experience, and no action is required on your part.

This article provides a comprehensive set of examples of using webhooks. You can trigger webhook actions to run on automation rules only on ticket creation and ticket updates.


TABLE OF CONTENTS



Note: If you are using Customer Service Suite, go to Admin Settings > Configuration and Workflows > Ticket Automations to access Automations.


Use webhook to add private notes to tickets

Use webhook to add internal notes if they meet specific criteria. For instance, whenever a customer responds to a closed ticket, you can set up a rule to add a private note and reopen the 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 and conditions:

    Event performer (When an action performed by):  Requester
    Event: If Reply is sent

    Condition: In Tickets -> If status -> is -> closed

    Operator: Match Any of the below conditions

  5. Select the Action to be performed: 

    • Choose Trigger webhook.

    • Select Request type as POST.

    • 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.
      {

        "body” : “test”,

        “private” : false

         }

  1. Click Preview and Save.

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


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 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. Choose the following events and conditions:

    N/A

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

        "{{ticket.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

Use webhook to update a text field or the ticket description with the timestamp for when the ticket was last updated. For instance, you can use the ticket description field.

  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):

        "{{ticket.description}}” : “{{ticket.modified_on}}”,

         }

  1. Click Preview and Save.

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