A Webhook also called a web callback or HTTP push API is a way for an app to provide other applications with real-time information. WebHooks allow you to integrate with external applications or trigger an external workflow when specific events happen in the publisher’s application.
This feature is available for all plans.
HappyFox WebHooks contains information pertaining to a ticket when the following events happen:
-
A ticket is created in HappyFox.
-
A ticket is edited in HappyFox.
-
When a smart-rule is triggered in HappyFox.
To enable integration with Webhooks, do the following:
-
Log in to HappyFox.
-
Go to Apps >> Goodies >> Webhooks.
-
Click "Install"
-
Make Sure "Webhook Status” is "Enabled". Also, note down your webhook key.
Setting up a Webhook and Trigger options:
While creating a Webhook URL, you can specify whether the webhook should be triggered during ticket creation or ticket updates or task completion. Once defined and saved, a webhook URL will be triggered only when a ticket is updated or created or both (As Specified). Ensure the URL is setup receive a HTTP POST request.
What will I receive at the remote end?
You will receive a JSON representation of the ticket details along with information about the type of event (Ticket created or ticket updated). You can receive the call at your end and perform an appropriate action.
Webhooks and Smart rules
You can now even configure a webhook as a Smart rule action. This way, you can integrate with an external service whenever certain conditions are met on one or more tickets.
Steps:
-
Go to Automate >> Smart Rules.
-
Click " Create a Smart Rule".
-
Choose "Trigger Webhook' as the action to be performed by the Smart Rule.
-
Enter the Webhook URL.
-
Define conditions that govern when the Smart Rule should be triggered automatically.
-
Enter the name and description for the Smart Rule. Choose applicable categories and associate an appropriate Work Schedule.
-
Click "Finish Creating a Smart Rule".
Webhooks log
HappyFox also keeps a log of all the webhooks sent with the timestamps. You can see the webhook details in the log section too. in the event that some webhooks have failed to post, you can select them from the logs and resend them.
Sample webhook payload data JSON
{
"display_id": "#N200002432",
"assignee_name": null,
"uuid": "2c541bef0ba34da79722d2f74af42118",
"event_type": "Ticket Updated",
"due_date": null,
"status_name": "New",
"client_details": {
"name": "Blog",
"primary_phone": null,
"phones": [],
"pending_tickets_count": 8,
"id": 27736,
"tickets_count": 8,
"email": "john@example.com",
"custom_fields": [
{
"name": "User ID",
"required": false,
"value": null,
"visible_only_to_staff": false,
"type": "Text",
"order": 1
},
{
"name": "Staff or Student",
"required": false,
"value": null,
"visible_only_to_staff": false,
"type": "Dropdown",
"order": 2
},
{
"name": "Department",
"required": false,
"value": null,
"visible_only_to_staff": false,
"type": "Text",
"order": 3
},
{
"name": "Roles",
"required": false,
"value": null,
"visible_only_to_staff": false,
"type": "Multiple Option",
"order": 4
},
{
"name": "Allow ticket creation",
"required": false,
"value": "12",
"visible_only_to_staff": false,
"type": "Dropdown",
"order": 5
},
{
"name": "user.Department",
"required": false,
"value": null,
"visible_only_to_staff": false,
"type": "Text",
"order": 6
},
{
"name": "Badge",
"required": false,
"value": null,
"visible_only_to_staff": false,
"type": "Number",
"order": 7
},
{
"name": "Ring Name",
"required": false,
"value": "12",
"visible_only_to_staff": false,
"type": "Text",
"order": 8
},
{
"name": "InternalID",
"required": false,
"value": null,
"visible_only_to_staff": true,
"type": "Text",
"order": 9
},
{
"name": "Field Agent ID",
"required": false,
"value": "12",
"visible_only_to_staff": false,
"type": "Text",
"order": 10
},
{
"name": "Preferred Contact Method",
"required": false,
"value": "12",
"visible_only_to_staff": false,
"type": "Dropdown",
"order": 11
},
{
"name": "Is deleted?",
"required": false,
"value": null,
"visible_only_to_staff": true,
"type": "Dropdown",
"order": 12
}
],
"assets": []
},
"ticket_fields": [
{
"name": "City",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Dropdown"
},
{
"name": "Crawl status",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Dropdown"
},
{
"name": "Area",
"required": true,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": true,
"type": "Dropdown"
},
{
"name": "Date Quote Sent",
"required": false,
"value": null,
"visible_only_to_staff": true,
"compulsory_on_completion": false,
"type": "Date"
},
{
"name": "Value approximation",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": true,
"type": "Text"
},
{
"name": "Snooze",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Dropdown"
},
{
"name": "Snooze date",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Date"
},
{
"name": "Solving Path",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Text"
},
{
"name": "Request Type",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Dropdown"
},
{
"name": "Contractor Email",
"required": false,
"value": null,
"visible_only_to_staff": true,
"compulsory_on_completion": false,
"type": "Dropdown"
},
{
"name": "Assigned Asset Name",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": true,
"type": "Text"
},
{
"name": "Date Field",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Date"
},
{
"name": "Sub-Category",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Dropdown"
},
{
"name": "Quick steps (select only when done)",
"required": false,
"value": null,
"visible_only_to_staff": true,
"compulsory_on_completion": false,
"type": "Multiple Option"
},
{
"name": "Date/Time",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": true,
"type": "Text"
},
{
"name": "Select Disease",
"required": false,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Multiple Option"
},
{
"name": "Contact Group",
"required": false,
"value": null,
"visible_only_to_staff": true,
"compulsory_on_completion": false,
"type": "Text"
},
{
"name": "Resolution Note",
"required": true,
"value": null,
"visible_only_to_staff": false,
"compulsory_on_completion": false,
"type": "Text"
}
],
"subject": "Build systems",
"update": {
"priority_change": null,
"time_spent": null,
"duedate_change": null,
"category_change": null,
"update_id": 7400,
"message": null,
"assignee_change": {
"new": " HappyFox QAE",
"old": ""
},
"status_change": null,
"contact_change": null
},
"last_update": "2023-01-23 3:00:05",
"time_spent": null,
"created_on": "2023-01-23 3:00:05",
"contact_ticket_url": "https://acme.happyfox.com/ticket/2432",
"assets": [],
"ticket_id": 2432,
"completed_task_name": null,
"webhook_id": 3,
"priority_name": "Medium",
"agent_ticket_url": "https://acme.happyfox.com/staff/ticket/2432",
"category_name": "Stored Procedure"
}
Webhooks Key
In the webhook payload, a field called "UUID", will be seen and this field is uniquely generated for every request. We (HappyFox) sign (HMAC-SHA1) every request payload (which contains this UUID field) with the key mentioned in the Apps>>Goodies>>Webhooks page, and we display the subsequent signature of each request with the associated payload in our Webhooks log page. The signature is available in the X-Happyfox-Webhook-Signature header of the incoming Webhook.
This can be used to verify that this webhook was in fact sent from HappyFox's server. No specific action is required for this with each request. As a side note, this UUID field from the request can be stored and compared to ensure that each request is processed only once if required.
Note: While processing the received web-hook at your end, please hash the entire payload data to validate if the sender is HappyFox.
Manage Webhooks:
Once you have created webhooks, you can choose to manage them.
-
Go to Apps >> Goodies >> Webhooks.
-
Click "Manage".
-
Choose to "Activate/Deactivate", "edit" or "delete" individual webhooks that you have created.
If you are using Classic HappyFox, please refer the attachement.