Webhook API Endpoint Automation
Description
This automation demonstrates how to create external API endpoints using the webhook trigger type. The webhook automation exposes a GET endpoint that accepts query parameters and executes custom actions. This pattern is essential for integrating Stack9 applications with external systems, providing API access to internal functionality, and building public or private APIs. The automation can access query parameters, headers, and body data from incoming requests.
Use Case
Used in a CRM system to provide an API endpoint for retrieving customer dashboard data. External applications or frontend dashboards can call this endpoint with a customer reference number (CRN) to fetch aggregated customer information, subscription details, and activity metrics. This enables headless CRM operations and integration with external reporting tools.
Key Features
- HTTP method specification (GET, POST, PUT, DELETE)
- Custom URL path definition
- Query parameter access through trigger context
- Action chaining with parameter passing
- RESTful endpoint creation
- External system integration capability
JSON Definition
{
"key": "webhook_get_customer_dashboard_data",
"name": "Get customer dashboard data",
"entityKey": "customer",
"app": "crm",
"triggerType": "webhook",
"triggerParams": {
"method": "get",
"path": "/get-customer-dashboard-data"
},
"actions": [
{
"name": "Get customer dashboard data",
"key": "get_customer_dashboard_data",
"actionTypeKey": "get_customer_dashboard_data",
"params": {
"customer_crn": "{{trigger.query.customer_crn}}"
}
}
]
}
Notes
- The webhook path is automatically prefixed with the API base URL
- Query parameters are accessible via
trigger.query - Request body is available through
trigger.bodyfor POST/PUT requests - Headers can be accessed using
trigger.headers - The automation can return JSON responses to the caller
- Authentication and authorization should be implemented in the action
- Webhook endpoints are immediately available after deployment