Skip to content

Create Webhook Trigger

webhooks.create_webhook_trigger(WebhookCreateWebhookTriggerParams**kwargs) -> WebhookCreateWebhookTriggerResponse
POST/agent_api_keys/webhook-trigger

Wire a webhook trigger in one call.

Registers the source’s signature-verification key (github/slack) for the agent and returns the ready-to-paste forward webhook URL plus the signing secret (shown once). The webhook then flows through the existing /agents/forward ingress, which verifies the signature against this key. Bundles the existing key-create + URL composition so a UI (or a curl) can set up a trigger without two steps.

ParametersExpand Collapse
agent_name: str

The agent the webhook drives.

forward_path: str

Subpath the agent’s own route handles, e.g. ‘github-pr/’. Appended to /agents/forward/name/{agent_name}/ to form the webhook URL.

name: str

Signature-lookup key: the repo full_name (github) or api_app_id (slack) that the forward ingress matches the incoming webhook against.

base_url: Optional[str]

Optional public agentex base URL for the returned webhook_url; defaults to the AGENTEX_PUBLIC_URL env var.

secret: Optional[str]

Signing secret. For GitHub, omit to generate one, or provide an existing webhook secret. For Slack, this is required and must be the Slack app’s Signing Secret.

source: Optional[Literal["internal", "external", "github", "slack"]]

Webhook source whose signature is verified (github or slack).

One of the following:
"internal"
"external"
"github"
"slack"
ReturnsExpand Collapse
class WebhookCreateWebhookTriggerResponse: …
agent_name: str

The agent the webhook drives.

key_id: str

The created agent API key id.

name: str

Signature-lookup key (repo full_name / api_app_id).

secret: str

The signing secret — shown once; paste into the source’s webhook config.

source: Literal["internal", "external", "github", "slack"]

Webhook source (github or slack).

One of the following:
"internal"
"external"
"github"
"slack"
webhook_path: str

The forward path to POST webhooks to.

webhook_url: Optional[str]

Full webhook URL to paste into the source (None if no base URL configured).

Create Webhook Trigger

import os
from agentex import Agentex

client = Agentex(
    api_key=os.environ.get("AGENTEX_SDK_API_KEY"),  # This is the default and can be omitted
)
response = client.webhooks.create_webhook_trigger(
    agent_name="agent_name",
    forward_path="forward_path",
    name="name",
)
print(response.key_id)
{
  "agent_name": "agent_name",
  "key_id": "key_id",
  "name": "name",
  "secret": "secret",
  "source": "internal",
  "webhook_path": "webhook_path",
  "webhook_url": "webhook_url"
}
Returns Examples
{
  "agent_name": "agent_name",
  "key_id": "key_id",
  "name": "name",
  "secret": "secret",
  "source": "internal",
  "webhook_path": "webhook_path",
  "webhook_url": "webhook_url"
}