Actions Webhooks
AgentPress supports incoming webhooks from external integrations to create pending actions for agent processing. This enables automation workflows where external systems (like review platforms, CRMs, or custom integrations) can trigger agent actions.
How It Works
Section titled “How It Works”When an external event occurs in your system, AgentPress processes it through a structured pipeline:
For the recommended approach using the
@agentpress/sdkpackage, see Using the SDK.
Overview
Section titled “Overview”The webhook system uses Svix for HMAC signature verification, ensuring secure communication between external systems and AgentPress.
Endpoint Format: POST /webhooks/actions/:orgId/:webhookIdentifier
Setting Up Webhooks
Section titled “Setting Up Webhooks”Step 1: Create a Webhook Configuration
Section titled “Step 1: Create a Webhook Configuration”In the AgentPress Admin Console:
- Navigate to Actions → Webhooks tab
- Click Create Webhook
- Fill in the configuration:
| Field | Description |
|---|---|
| Name | Display name for the webhook (e.g., “My Service Reviews”) |
| Webhook Identifier | URL-safe identifier used in the endpoint (e.g., my_webhook) |
| Run As (User) | Default user for actions created by this webhook. Optional — if left empty, the webhook payload must include userId (and authProvider for external users). |
| Default Action Rule | Rule to use when processing incoming webhooks (optional) |
- Click Create
- Important: Copy and save the webhook secret from the dialog - it’s only shown once!
Your webhook URL will be:
Step 2: Create an Action Rule
Section titled “Step 2: Create an Action Rule”Before webhooks can create actions, you need at least one rule:
- Navigate to Actions → Rules tab
- Click Create Rule
- Configure the rule:
| Field | Description |
|---|---|
| Name | Display name for the rule |
| Action Type | Type of action (e.g., review_response, email_reply) |
| Agent | Which agent handles these actions |
| Instructions | Additional instructions appended to the agent prompt |
| Tools Requiring Approval | Tools that need human approval before execution |
- Save the rule
- Link it to your webhook as the default rule
Webhook Payload Structure
Section titled “Webhook Payload Structure”All webhooks must send a JSON payload with the following structure:
User Resolution
Section titled “User Resolution”When a webhook is received, AgentPress resolves which user the action runs as by checking three sources in order:
flowchart TD
A["Webhook received"] --> B{"Payload has<br/>`userId` + `authProvider`?"}
B -- Yes --> C["Resolve via external auth provider"]
C --> C1{"User found?"}
C1 -- Yes --> OK["✅ Action created with resolved user"]
C1 -- No --> FAIL["❌ 422 — user not found for given authProvider"]
B -- No --> D{"Payload has<br/>`userId` (valid UUID)?"}
D -- Yes --> E["Direct internal user lookup"]
E --> E1{"User found?"}
E1 -- Yes --> OK
E1 -- No --> FAIL2["❌ 422 — no user with this ID"]
D -- No --> F{"Webhook has<br/>default user configured?"}
F -- Yes --> G["Use webhook's default user"]
G --> G1{"User found?"}
G1 -- Yes --> OK
G1 -- No --> FAIL3["❌ 422 — configured user no longer exists"]
F -- No --> FAIL4["❌ 422 — no user resolved from any source"]
style OK fill:#166534,color:#fff
style FAIL fill:#991b1b,color:#fff
style FAIL2 fill:#991b1b,color:#fff
style FAIL3 fill:#991b1b,color:#fff
style FAIL4 fill:#991b1b,color:#fff
Example Payload
Section titled “Example Payload”Required Headers
Section titled “Required Headers”All webhook requests must include Svix signature headers:
| Header | Description |
|---|---|
svix-id | Unique message ID (e.g., msg_abc123def456) |
svix-timestamp | Unix timestamp in seconds |
svix-signature | HMAC signature in format: v1,{base64_signature} |
Sending Test Webhooks
Section titled “Sending Test Webhooks”Manual Test Script
Section titled “Manual Test Script”Create a file called test-webhook.js:
Run with:
Response Codes
Section titled “Response Codes”| Code | Description |
|---|---|
200 | Success - action created or already exists |
401 | Missing or invalid signature headers |
403 | Webhook is disabled |
404 | Webhook configuration not found |
422 | No user resolved — neither the payload nor the webhook config provided a valid user |
429 | Rate limit exceeded (100 requests/minute by default) |
500 | Internal server error |
Success Response
Section titled “Success Response”Idempotent Response (Action Already Exists)
Section titled “Idempotent Response (Action Already Exists)”Skipped Response (No Rule Configured)
Section titled “Skipped Response (No Rule Configured)”No User Resolved (422)
Section titled “No User Resolved (422)”Verifying Actions Were Created
Section titled “Verifying Actions Were Created”After sending a webhook:
- Navigate to Actions → Pending tab in the console
- You should see your new action with status “Pending”
- Click on the action to view the source data
Post-Event Callbacks
Section titled “Post-Event Callbacks”When actions complete processing, AgentPress can send signed HTTP callbacks to your configured endpoints with the result. This allows your system to react to the agent’s output — for example, posting a generated reply, updating a CRM record, or triggering a downstream workflow.
Callbacks use the same Svix HMAC signing scheme as incoming webhooks, so your server can verify their authenticity using the same approach.
For setup details and SDK-based signature verification, see Receiving Callbacks.
Local Development
Section titled “Local Development”Since webhooks require a public URL, use ngrok for local development:
Use the ngrok URL as your webhook endpoint:
Security Considerations
Section titled “Security Considerations”- Signature Verification: All webhooks are verified using Svix HMAC signatures
- Secret Rotation: Use the “Rotate Secret” button in the webhook settings to generate a new secret
- Rate Limiting: Webhooks are rate-limited to 100 requests per minute per IP by default
- Idempotency: Duplicate
externalIdvalues are detected and won’t create duplicate actions - Encryption: Webhook secrets are encrypted at rest
Troubleshooting
Section titled “Troubleshooting””Missing webhook signature headers”
Section titled “”Missing webhook signature headers””Ensure all three Svix headers are present in your request:
svix-idsvix-timestampsvix-signature
”Invalid signature”
Section titled “”Invalid signature””- Verify your webhook secret is correct
- Ensure the secret is properly base64 encoded when generating the signature
- Check that the timestamp is recent (within 5 minutes)
“Webhook not configured”
Section titled ““Webhook not configured””- Verify the
orgIdin the URL matches your organization - Verify the
webhookIdentifiermatches what you configured
”Webhook is disabled”
Section titled “”Webhook is disabled””Enable the webhook in Actions → Webhooks → click on your webhook → toggle “Enabled"
"No user resolved” (422)
Section titled “"No user resolved” (422)”A user must be resolved from at least one source:
- Include
userId(+authProviderfor external IDs) in the webhook payload, or - Configure a default user on the webhook via Actions → Webhooks → click your webhook → Run As section
If neither is provided, the webhook returns 422 and no action is created.
Action Not Appearing
Section titled “Action Not Appearing”- Check if a rule is configured and enabled
- Verify the rule is linked to the webhook as the default rule
- Check API logs for any processing errors
Rate Limit Exceeded
Section titled “Rate Limit Exceeded”Wait 60 seconds before sending more requests, or configure higher limits via environment variables:
WEBHOOK_RATE_LIMIT_WINDOW_MS(default: 60000)WEBHOOK_RATE_LIMIT_MAX_REQUESTS(default: 100)