mirror of
https://github.com/pocketpaw/pocketpaw.git
synced 2026-05-22 09:45:00 +00:00
Consolidate documentation from the separate pocketpaw-web repo into the main pocketpaw repo. This keeps docs and code in sync so PRs can update both atomically. - Remove docs/ from .gitignore - Remove docs' own .git (was pocketpaw/pocketpaw-web) - Add .github/workflows/deploy-docs.yml (builds from docs/ subdirectory) - Track all 120+ MDX pages, config, landing page, and public assets The separate pocketpaw-web repo can now be archived. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
99 lines
2.8 KiB
Plaintext
99 lines
2.8 KiB
Plaintext
---
|
|
title: Create Webhook Slot
|
|
description: "Create a new inbound webhook slot with an auto-generated secret for authenticating incoming payloads. Webhooks forward external data to the PocketPaw agent for processing."
|
|
api: POST /api/webhooks/add
|
|
baseUrl: http://localhost:8000
|
|
layout: '@/layouts/APIEndpointLayout.astro'
|
|
auth: bearer
|
|
section: API Reference
|
|
ogType: article
|
|
keywords: ["create webhook", "webhook secret", "inbound webhook"]
|
|
tags: ["api", "webhooks"]
|
|
---
|
|
|
|
## Overview
|
|
|
|
Creates a new inbound webhook slot. A unique secret is auto-generated for signature verification. The webhook URL follows the pattern `/webhook/inbound/{name}`.
|
|
|
|
## Request Body
|
|
|
|
<ParamTable type="body">
|
|
<Param name="name" type="string" required>
|
|
Webhook slug name (used in the URL). Must be URL-safe.
|
|
</Param>
|
|
<Param name="description" type="string">
|
|
Human-readable description of what this webhook receives.
|
|
</Param>
|
|
</ParamTable>
|
|
|
|
## Response
|
|
|
|
<ResponseField name="status" type="string">`"ok"` on success</ResponseField>
|
|
<ResponseField name="webhook" type="object">
|
|
<ResponseField name="name" type="string">Webhook name</ResponseField>
|
|
<ResponseField name="secret" type="string">Auto-generated verification secret</ResponseField>
|
|
<ResponseField name="description" type="string">Webhook description</ResponseField>
|
|
</ResponseField>
|
|
|
|
<RequestExample>
|
|
<Tabs items={["cURL", "JavaScript", "Python"]}>
|
|
<Tab title="cURL">
|
|
```bash
|
|
curl -X POST "http://localhost:8000/api/webhooks/add" \
|
|
-H "Authorization: Bearer <token>" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"name": "github-events", "description": "GitHub repository webhooks"}'
|
|
```
|
|
</Tab>
|
|
<Tab title="JavaScript">
|
|
```javascript
|
|
const response = await fetch("http://localhost:8000/api/webhooks/add", {
|
|
method: "POST",
|
|
headers: {
|
|
"Authorization": "Bearer <token>",
|
|
"Content-Type": "application/json"
|
|
},
|
|
body: JSON.stringify({
|
|
name: "github-events",
|
|
description: "GitHub repository webhooks"
|
|
})
|
|
});
|
|
const data = await response.json();
|
|
console.log(data);
|
|
```
|
|
</Tab>
|
|
<Tab title="Python">
|
|
```python
|
|
import requests
|
|
|
|
response = requests.post(
|
|
"http://localhost:8000/api/webhooks/add",
|
|
headers={"Authorization": "Bearer <token>"},
|
|
json={
|
|
"name": "github-events",
|
|
"description": "GitHub repository webhooks"
|
|
}
|
|
)
|
|
print(response.json())
|
|
```
|
|
</Tab>
|
|
</Tabs>
|
|
</RequestExample>
|
|
|
|
<ResponseExample>
|
|
<Tabs items={["200"]}>
|
|
<Tab title="200">
|
|
```json
|
|
{
|
|
"status": "ok",
|
|
"webhook": {
|
|
"name": "github-events",
|
|
"secret": "whsec_a1b2c3d4e5f6...",
|
|
"description": "GitHub repository webhooks"
|
|
}
|
|
}
|
|
```
|
|
</Tab>
|
|
</Tabs>
|
|
</ResponseExample>
|