Webhooks

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
  //Please provide a destination that starts with `#` or `@`
  destination = "john.doe@domain.ai"
  //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.

Last updated