Triggers
Copy page
Create webhook endpoints that allow external services to invoke your agents
Triggers create webhook endpoints that allow external services (like GitHub, Slack, Stripe, or custom applications) to invoke your agents. When a webhook is received, the payload is validated, transformed, and used to start a new conversation with the agent.
Overview
Triggers are useful for:
- Event-driven workflows - Respond to events from external services (GitHub issues, Stripe payments, etc.)
- Third-party integrations - Connect services that can send webhooks to your agents
- Automated tasks - Trigger agent actions based on external events
- Custom applications - Allow your own services to invoke agents via HTTP
Creating Triggers
Basic Trigger
Trigger with Input Validation
Use JSON Schema or Zod to validate incoming webhook payloads:
Trigger with Authentication
Triggers support flexible header-based authentication. You can require any headers with expected values:
Header values are securely hashed before storage. The original values are never stored in the database.
Configuration Options
| Option | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable name for the trigger |
description | string | No | Description of what the trigger does |
enabled | boolean | No | Whether the trigger is active (default: true) |
inputSchema | object | ZodObject | No | JSON Schema or Zod schema for payload validation |
messageTemplate | string | Yes | Template for the message sent to the agent |
authentication | object | No | Header-based authentication configuration |
signingSecret | string | No | HMAC-SHA256 secret for signature verification |
outputTransform | object | No | Payload transformation configuration |
Authentication Configuration
Each incoming request must include all configured headers with matching values. If any header is missing or has an incorrect value, the request is rejected with a 401 or 403 status.
Message Templates
Message templates use {{placeholder}} syntax to interpolate values from the webhook payload:
Nested properties are accessed with dot notation ({{customer.email}}). Array length can be accessed with .length.
Payload Transformation
Transform incoming payloads before they reach the message template using outputTransform. You can choose between two approaches:
| Approach | Best For | Complexity |
|---|---|---|
| Object Transformation | Simple field remapping | Low |
| JMESPath | Complex filtering, restructuring, array operations | High |
These options are mutually exclusive. Use either jmespath OR objectTransformation, not both. If both are provided, jmespath takes priority.
Object Transformation (Recommended for Simple Cases)
Use objectTransformation when you just need to remap fields from the payload. Each key becomes a field in the transformed output, and each value is a JMESPath path to extract from the input:
JMESPath (For Complex Transformations)
Use jmespath when you need more powerful transformations like filtering arrays, conditional logic, or complex restructuring. JMESPath is a query language for JSON:
Advanced JMESPath example - filtering and projecting arrays:
Object Transformation is converted to JMESPath under the hood. For example, { userName: "user.name" } becomes the JMESPath expression { userName: user.name }.
Signature Verification
For services that sign webhooks (like GitHub, Stripe, Slack), use signingSecret:
The framework automatically verifies HMAC-SHA256 signatures in the X-Signature-256 header.
For services like GitHub that sign webhooks, you often don't need header authentication—the signature verification provides security. Use signingSecret alone for these cases.
Webhook URL
After pushing your agent configuration, each trigger gets a unique webhook URL:
You can find the full webhook URL in the Inkeep dashboard or via the API response when creating/listing triggers.
Invocation Tracking
Every webhook invocation is tracked with:
- Invocation ID - Unique identifier for the invocation
- Status -
pending,success, orfailed - Request Payload - Original webhook payload
- Transformed Payload - Payload after transformation
- Conversation ID - ID of the conversation created
- Error Message - Error details if the invocation failed
Query invocation history via the API:
Complete Example
Here's a complete example with a GitHub webhook trigger that handles issue events:
Best Practices
- Always validate input - Use
inputSchemato ensure payloads match expected format - Use signing secrets - Verify webhook authenticity when the source supports it
- Use header auth for custom webhooks - When the source doesn't sign webhooks, use header-based authentication
- Write clear templates - Make message templates readable and include relevant context
- Handle errors gracefully - Check invocation status and logs for failed webhooks
- Use descriptive names - Name triggers clearly to identify their purpose in dashboards
- Store secrets in environment variables - Never hardcode authentication values