Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions app/docs/md/routing/api-routes/webhooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Webhooks
---

A webhook is a method of augmenting or altering the behavior of a web page or web application with custom callbacks.

You can use an API route to receive webhooks from third parties:

<doc-code filename="app/api/webhook.mjs">

```javascript
export async function post (req) {
try {
const data = req.body
// Process the webhook payload
// Validate payload, etc.
} catch (error) {
return {
status: 400,
}
}

return {
status: 200,
}
}
```

</doc-code>
2 changes: 1 addition & 1 deletion app/docs/nav-data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const data = [
path: '/docs/routing/api-routes/',
label: 'API Routes',
hasChildren: true,
items: [ 'middleware', 'tutorial' ],
items: [ 'middleware', 'tutorial', 'webhooks' ],
},
],
},
Expand Down
Loading