Webhook Management with Kubiya CLI
This guide provides comprehensive instructions for creating, configuring, and using webhooks with the Kubiya CLI.
Understanding Webhooks
Webhooks in Kubiya allow you to integrate with external systems, receive notifications, and trigger automation workflows from third-party services. Webhooks can be used to:
Trigger automation when code is pushed to GitHub
Execute tools in response to monitoring alerts
Process incoming data from external systems
Connect Kubiya with chat platforms like Slack
Listing Webhooks
To see all available webhooks in your organization:
For more detailed output in JSON format:
Creating Webhooks
Basic Webhook Creation
To create a new webhook:
Interactive Webhook Creation (Wizard)
For guided webhook creation with an interactive wizard:
The wizard will walk you through:
Setting a name and description
Choosing a communication method (HTTP, Slack, Teams, etc.)
Configuring templates and template variables
Setting up authentication and security
Required Parameters:
--name
: A unique name for your webhook--description
: A description of the webhook's purpose
Optional Parameters:
--tool
: ID of the tool to execute when webhook is triggered--teammate
: ID of the teammate to use for the webhook--prompt
: Custom prompt template for the webhook--secret
: Secret key for webhook verification--tags
: Tags for categorizing webhooks--method
: Communication method (HTTP, Slack, Teams)--destination
: Communication destination (for Slack/Teams)--team-name
: Microsoft Teams team name--channel-name
: Microsoft Teams channel name
Viewing Webhook Details
To get detailed information about a specific webhook:
This shows the webhook's configuration, URL, and other metadata.
Getting Webhook URL
To get the URL for a webhook:
This displays the unique URL that can be used to trigger the webhook.
Triggering Webhooks
Manual Triggering (Testing)
You can manually trigger a webhook from the CLI:
With payload data:
For formal testing with template variables:
External Triggering
External systems can trigger the webhook by sending an HTTP POST request to the webhook URL:
Updating Webhooks
To modify an existing webhook:
You can update any of the parameters you used when creating the webhook.
Deleting Webhooks
To remove a webhook:
You'll be prompted to confirm the deletion.
Importing and Exporting Webhooks
Exporting Webhooks
Export webhooks for backup or migration:
Export a specific webhook:
Importing Webhooks
Import webhooks from a JSON file:
Webhook Templates
Generate a webhook template:
This creates a template you can modify and later import.
Webhook Security
Using Webhook Secrets
When creating a webhook, you can specify a secret key:
When calling the webhook from external systems, use the secret to generate an HMAC signature:
IP Whitelisting
You can restrict webhook access to specific IP addresses:
Communication Methods
Kubiya webhooks support multiple communication methods:
HTTP Webhooks
Slack Webhooks
Microsoft Teams Webhooks
Alternatively:
Template Variables and Customization
Webhooks can use template variables in their prompts:
When you create a webhook with template variables, the CLI will show you:
The detected template variables
How to test the webhook with these variables
Webhook Logging and Monitoring
Viewing Webhook History
To see the history of webhook executions:
Debugging Webhooks
If you encounter issues with webhooks:
This provides detailed information about recent webhook calls and responses.
End-to-End Example: GitHub to Deployment Pipeline
Here's a complete workflow for creating a CI/CD pipeline using Kubiya webhooks:
Step 1: Create a Deployment Tool
First, create a tool that handles deployments (this would be in your source repository).
Step 2: Create a Webhook for GitHub
Step 3: Get the Webhook URL
Step 4: Configure GitHub Repository
In your GitHub repository settings:
Go to Settings > Webhooks > Add webhook
Set Payload URL to the Kubiya webhook URL
Set Content type to application/json
Set Secret to the same secret key used in Kubiya
Select "Just the push event"
Enable the webhook
Step 5: Test the Integration
First, test locally with the test command:
Then push a commit to your GitHub repository:
Step 6: View Webhook Execution
Check the webhook execution status:
Step 7: Set Up Notifications
Create another webhook for deployment notifications:
Then, modify your deployment tool to trigger this webhook upon completion.
Step 8: Export Your Webhook Configuration
Once you've set up your webhooks, export them for backup or to replicate in other environments:
For more information on webhook capabilities and advanced configurations, see the official documentation.
Was this helpful?