Articles in this section
Category / Section

Approval Webhook

Published:

Use case overview

By creating a webhook, approval fields can be sent as payload to an API or an HTTP request-catching application in real-time.

How does it work?

An approval webhook can be triggered based on events of an approval request. To learn more about approval events captured by webhook, refer to this article.

Approval payload

When creating a webhook, you have two options to select the payload structure:

  • Default - Sends the approval fields in a predefined format.
  • Advanced- Alters your payload structure, which is often framed in JSON format.

Approval_payload_webhook.png

To learn more about webhook creation and its features, refer to this article.

Approval fields that are available to choose from default and advanced options are as follows:

S. No Default fields Properties Placeholders in Advanced option
1 Approval ticket – Details of ticket on which the approval request created. Ticket ID, Ticket Subject, Ticket Status –ID, Name {{approval.Ticket.Id}}, {{approval.Ticket.Subject}}, {{approval.Ticket.Status.Id}}, {{approval.Ticket.Status.Name}}
2 Approval Request ID - {{approval.ApprovalId}}
3 Subject - {{approval.Subject}}
4 Description - {{approval.Description}}
5 Status ID, Name {{approval.Status.Id}}, {{approval.Status.Name}}
6 Type ID, Name {{approval.Type.Id}}, {{approval.Type.Name}}
7 Approvers – List of approvers in a single approval request. User ID, Name, Email ID, Status–ID, Name, Comment, Approved Time, Created Time, Last Modified Time {{approval.Approvers.UserId}}, {{approval.Approvers.Name}}, {{approval.Approvers.EmailId}}, {{approval.Approvers.Status.Id}}, {{approval.Approvers.Status.Name}}, {{approval.Approvers.Comment}},{{approval.Approvers.ApprovedOn}}, {{approval.Approvers.CreatedOn}}, {{approval.Approvers.LastModifiedOn}}
8 Created By User ID, Email ID {{approval.CreatedBy.UserId}}, {{approval.CreatedBy.EmailId}}
9 Last Modified By User ID, Email ID {{approval.LastModifiedBy.UserId}}, {{approval.LastModifiedBy.EmailId}}
10 Created Time - {{approval.CreatedOn}}
11 Last Modified Time - {{approval.LastModifiedOn}}

Trigger approval webhook conditionally

S. No Condition Operator Value Description
1 Approval Status Is, In Requested, Approved, Rejected, Cancelled Captures the Approval Request Completed event based on which status the request is completed.
2 Approval Name Is, Contains, Start with, Ends with Text field. Note: Not case sensitive Filters the approval requests based on its subject.

Webhook_Condition.png

Sample payload

Default option

When all fields are included, the payload sent for an Approval Request Created event might resemble the below,

{
 "eventModule": "Approval",
 "eventType": "ApprovalRequestCreated",
 "eventTime": "2020-09-19T10:32:00.0018818Z",
 "orgId": 1,
 "orgName": "Digital Edge",
 "payload": {
   "type": {
     "id": 1,
     "name": "Everyone"
   },
   "subject": "Mac OS Laptop request",
   "status": {
     "id": 1,
     "name": "Requested"
   },
   "lastModifiedOn": "2020-09-19T10:31:57.925881Z",
   "lastModifiedBy": {
     "userId": 7,
     "emailId": "james.anderson@organization.com"
   },
   "description": "In Need of a Mac OS Laptop due to work domain change",
   "createdOn": "2020-09-19T10:31:57.925881Z",
   "createdBy": {
     "userId": 7,
     "emailId": "james.anderson@organization.com"
   },
   "approvers": [
     {
       "name": "Claire Watson",
       "emailId": "claire.watson@organization.com",
       "userId": 11,
       "status": {
         "id": 1,
         "name": "Requested"
       },
       "comment": null,
       "approvedOn": null,
       "createdOn": "2020-09-19T10:31:57.925881Z",
       "lastModifiedOn": "2020-09-19T10:31:57.925881Z"
     },
     {
       "name": "Jordan Green",
       "emailId": "jordan.green@organization.com",
       "userId": 13,
       "status": {
         "id": 1,
         "name": "Requested"
       },
       "comment": null,
       "approvedOn": null,
       "createdOn": "2020-09-19T10:31:57.925881Z",
       "lastModifiedOn": "2020-09-19T10:31:57.925881Z"
     },
     {
       "name": "Mark Antony",
       "emailId": "mark.antony@organization.com",
       "userId": 15,
       "status": {
         "id": 1,
         "name": "Requested"
       },
       "comment": null,
       "approvedOn": null,
       "createdOn": "2020-09-19T10:31:57.925881Z",
       "lastModifiedOn": "2020-09-19T10:31:57.925881Z"
     }
   ],
   "ticket": {
     "id": 45321,
     "subject": "Replacement for old windows laptop with new Mac OS Laptop",
     "status": {
       "id": 2,
       "name": "Open"
     }
   },
   "approvalId": 2541
 }
} 

Advanced option

The Custom Payload text area under the advanced option lets you input your customized payload and insert preferred approval data from the placeholder section. This section appears when you click on Insert Placeholders.

Insert_Placeholder.png

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied