You can use Terraform to create and manage Webhooks in Kubiya.
Want to know more about Webhooks in Kubiya?Learn more
Here's an example as to how to create one via Terraform:
terraform {
required_providers {
kubiya = {
source = "kubiya-terraform/kubiya"
}
}
}
provider "kubiya" {
//Your Kubiya API Key will be taken from the
//environment variable KUBIYA_API_KEY
//To set the key, please use export KUBIYA_API_KEY="YOUR_API_KEY"
}
resource "kubiya_webhook" "webhook" {
//mandatory fields
//Please specify a unique name to identify this webhook
name = "tf-webhook"
//Please specify the source of the webhook - e.g: 'pull request opened on repository foo'
source = "Github"
//Provide AI instructions prompt for the agent to follow upon incoming webhook. use {{.event.}} syntax for dynamic parsing of the event
prompt = "send john.doe@kubiya.ai a summary of all pull requests created in API-GW repo based on the commits and add the link of the pull request to the message"
//Select an Agent which will perform the task and receive the webhook payload
agent = kubiya_agent.my_agent.name
//the webhook method - slack channel, teams channel or http (chat.kubiya.ai)
metod = "Slack" / "teams" / "http"
//Please provide a destination channel for the webhook.
//relevant and mandatory for Slack and teams method only.
//For Slack, please use chaneels that starts with `#` or `@` for a user (i.e. #devops)
//for teams, use channel name (wihtout prefix #) directly, or '@' for a user tagging
destination = "john.doe@domain.ai"
//relevant only for "teams", the Team name where the channel set in destination is part of
team_name = "team_name
//optional fields
//Insert a JMESPath expression to filter by, for more information reach out to https://jmespath.org
filter = ""
}
output "webhook" {
value = kubiya_webhook.webhook
}
Once your webhook is created successfully, you webhook_url field will be accessible and will serve in any use-case.