External License Validation Using a Webhook and Workflow
Integrating external license validation into workflows ensures that only authorized users can access specific features or services. Webhooks seamlessly integrate with third-party license validation systems, automating verification and enforcing access controls based on license status. This guide provides instructions for setting up a webhook-based license validation system, facilitating dynamic routing according to validation results.
Webhook Block in Workflow
- Configuring webhooks within workflows allows structured HTTP requests to be sent to designated endpoints, ensuring smooth integration with external services. This setup enables businesses to streamline operations, improve customer interactions, and maintain consistent data across platforms.
- To trigger a webhook, select Actions > Trigger Webhook from the context menu.
Webhook Configurations
The request configuration defines how data is transmitted to external systems. This includes defining request headers, authentication details, query parameters, and the request body. Proper configuration ensures that the webhook interacts correctly with the target system, allowing workflows to send and receive data seamlessly.
Request configuration
Supported Request Types
The following request types are supported for webhooks:
- GET – Fetch data from an external system.
- POST – Send data to an external system.
- PUT – Update data on an external system.
- PATCH – Partially update a resource.
- DELETE – Remove a resource.
Webhook Endpoints, Authentication & Request Signing
Webhook endpoints define the external system’s URL where the request will be sent, and they must be publicly accessible to handle incoming requests. If the external system requires authentication, you can configure it accordingly.
Additionally, you may need to secure webhook requests using request signing. For more details on securing webhook requests, refer to this guide.
Webhook Headers
System and custom headers are sent along with webhook data to the specified webhook endpoints.
Additionally, when creating a webhook, you have the option to include your custom headers.
System headers
By default, the headers listed below are sent with each webhook request.
Header keys | Header values |
---|---|
Host | < webhook-endpoint> |
AcceptEncoding | gzip;q=1.0,deflate;q=0.6,identity;q=0.3 |
Accept-Charset | utf-8, iso-8859-1; q=0.5, *; q=0.1 |
Content-Type | application/json; charset=utf-8 |
User-Agent | BoldDesk |
Authorization | Basic cUFEU0ZHSEpLSg== |
x-signature | v7czZPsztnM910sLP5yT6OO+mVEpVktBE5zLdzkZ+rU= |
Event-Time | 04/01/2025 11:30:37 |
Custom headers (Optional)
Custom headers are used to send additional information to the destination URL.
To add a custom header:
- Enter the key and value of the header and click Add to add it to the header record.
- To remove the header, click the Delete.
Webhook Payload
The data from the chat module are sent as a webhook payload.
Webhook payloads can be sent in two ways:
- Default Payload
- Advanced Payload
Note: Configuring a Payload is mandatory for POST requests.
Default Payload
This option automatically sends a default payload to a webhook in a predefined structure.
You can send all of them or only the required data by selecting the following options:
-
Include all fields in the payload (Optional)
When this option is enabled, all data are sent in the payload. -
Payload (Required)
The selected data are sent in the payload.
Advanced Payload
The Custom Payload text area under the Advanced option lets you input your customized payload and insert the preferred chat data from the Placeholders section.
Response Configuration
Webhook responses are stored in user-defined temporary variables, enabling dynamic workflow processing. These variables can be referenced in subsequent workflow steps, enabling dynamic decision-making and data processing.
Steps to Map the Response to Temporary Variables
- Enter the temporary variable key and specify the response mapping value.
- Click Add to save it in the response mapping record.
- To remove a record, click Delete.
Note : For GET requests, response mapping must be configured to properly structure the retrieved data and make it accessible within the workflow.
Using Webhook for External License Validation
Creating Workflow
-
Navigate to Admin > Chat > Workflow > Conversation Created and click Add Workflow.
-
Enter the required details and click Next.
-
In the Designer, select the Initial Block, then click the Add icon to open the context menu.
-
From the context menu, select Actions > Toggle Customer Input.
-
Enable Disable user input to restrict customers and agents from posting messages in the conversation, then click Add.
-
Configure the collect the Email using the Customer Details Block. Refer to more details: How to Request the Customer’s Email After Their First Message?
Configuring webhook
-
Navigate to Actions > Trigger Webhook.
-
Configure Request Parameters
- Select the Request Type as Get.
- Enter the API endpoint (e.g., https://example.com/check_licensed_user/{{chat.requester.email}}) in the Destination URL.
-
Configure response mapping to store the API result in a temporary variable (e.g., isLicensedUser), then click Add.
-
For successful requests, configure the success path by adding a conditional branch using Branching > Branch via Condition.
-
Define the condition
isLicensedUser Is true
:
- True Path: Set Priority to High.
- False Path: Set Priority to Medium.
- For failed requests, configure the failure path and set Priority to Low.
- Use Actions > Send Message to communicate appropriate messages for each path.
- Conclude each workflow path with an Exit block, and finally, Activate the workflow.