A webhook allows external systems to trigger actions in Web Port by sending an HTTP request to a specific endpoint. This makes it possible to integrate Web Port with other systems such as CRM platforms, automation tools, monitoring services, or internal applications.
When a webhook request is received, Web Port executes a predefined call script. The request data (headers, query parameters, and JSON body) becomes available inside the script, allowing you to build custom logic and responses.
Typical use cases include:
-
Triggering actions from external systems
-
Automating workflows
-
Integrating third-party services
-
Passing data into Web Port for processing
Instructions for Using the Webhook API
To integrate with our webhook API, follow the steps below. Each call to the webhook endpoint triggers a specified call script, allowing you to customize responses based on request data.
Requirements
API Access
Access to the API is required to use this webhook functionality.
Endpoint
The webhook URL has the following format:
/api/v1/webhook/handle/{CALLSCRIPTNAME}
Replace {CALLSCRIPTNAME} with the specific name of the call script you want to execute.
The call script must be configured on our end before it can be used.
Example:
/api/v1/webhook/handle/myScriptName
Parameters Accessible in the Script
When the webhook is triggered, the following parameters are available within the call script:
Headers
All headers included in the HTTP request are accessible.
Query String Parameters
All parameters included in the query string are available.
Example:
?param1=value1¶m2=value2
Posted JSON Data
Any JSON data sent in the request body will be available in the script under the variable:
body
Making a Call to the Webhook
Prepare the Request
Set the request URL:
/api/v1/webhook/handle/{CALLSCRIPTNAME}
Replace {CALLSCRIPTNAME} with the script you want to execute.
Headers
Add any headers required for your use case.
Example:
Custom-Header: HeaderValue
Query Parameters
Add query parameters if needed.
Example:
?param1=value1¶m2=value2
JSON Body
Include a JSON payload if your script requires additional data.
Example:
{
"exampleField": "exampleValue"
}
Send the Request
Use an HTTP POST request to send data to the webhook endpoint.
Example Request
POST /api/v1/webhook/handle/myScriptName
Host: your-api-url.com
Headers:
Custom-Header: HeaderValue
Query String:
?param1=value1¶m2=value2
Body:
{
"exampleField": "exampleValue"
}
Handling Responses
The response returned from the webhook depends on the logic implemented in the specified call script.
Always check the response to verify:
-
Successful execution
-
Returned data
-
Possible error messages
Notes
-
If the specified
{CALLSCRIPTNAME}does not exist, the API will return:
404 Not Found
-
Ensure all required parameters are included in the request to avoid missing data during script execution.
Call Script Example
Below is an example call script showing how headers, query parameters, and request body data can be accessed and debugged.
// Debug specific headers
debug("Token: "+token); // Replace "token" with the actual variable name if different
// Debug specific query string parameters
try {
debug("Query Parameter 1: "+param1);
debug("Query Parameter 2: "+param2);
} catch(e)
{
}
varbodyobj="";
// Debug the body if it exists
if (body!=null)
{
try
{
// Try to parse body as JSON
bodyobj=Newtonsoft.Json.JsonConvert.DeserializeObject(body);
}
catch (e)
{
// Fallback if body is not JSON
bodyobj=body;
}
debug("Body: "+body.ToString());
}