Skip to content

Commit

Permalink
Add docs for ingest
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-onelson committed Dec 5, 2024
1 parent 723ad52 commit 9c16179
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 0 deletions.
150 changes: 150 additions & 0 deletions docs/receiving/receiving-with-ingest.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
title: Receiving Webhooks with Ingest
---

import CodeTabs from '@theme/CodeTabs';
import TabItem from '@theme/TabItem';

Receiving webhooks with [Svix Ingest] starts with creating a `Source`.

A `Source` generates an endpoint you can share with a webhook provider as a
destination for their webhooks.

Ingest supports a variety of signature verification schemes and flows used by
webhook providers. Supported values for a `Source`'s' `type` include:

- `beehiiv`
- `brex`
- `clerk`
- `github`
- `guesty`
- `hubspot`
- `incidentIo`
- `lithic`
- `nash`
- `pleo`
- `replicate`
- `resend`
- `safebase`
- `sardine`
- `shopify`
- `stripe`
- `stych`
- `svix` (that's us!)
- `zoom`

Additionally there's the option to configure a `Source` as `http` to skip
performing signature verification. This is useful for providers that have no
verification scheme and for providers whose verification scheme is not yet
supported by Ingest.

:::tip
Let us know if your webhook provider isn't yet supported so we can add it!
:::


## Create a Source

Getting started with Ingest is a matter of configuring n `Source`.

This can be done from either the API:

```shell
curl https://api.svix.com/ingest/api/v1/source \
-H "Authorization: Bearer $SVIX_TOKEN" \
-H "Content-Type: application/json" \
-d @- << EOF
{
"name": "demo",
"uid": "demo",
"type": "github",
"config": {
"secret": "<the signing secret>"
}
}
EOF
```

or from the Ingest Dashboard:

![screenshot of the Ingest Dashboard showing the overview tab for a Source named "demo"](../../static/img/ingest/source-edit.png)


## Tell your provider where to send webhooks

The `IngestSourceOut` response from the API will include an `ingestUrl` which is
the endpoint you give to your provider, telling them where to send their
webhooks.

The `ingestUrl` is also listed on the Ingest Dashboard for each `Source`.

For GitHub, as is used in this example, this is referred to as the
_"Payload URL"_.


## Managing incoming messages

In the Ingest Dashboard, the Destinations tab for your Source is where you can
configure Endpoints, view logs, inspect message payloads, etc.

![screenshot of the Ingest Dashboard showing the Destination/Endpoints tab for a Source named "demo"](../../static/img/ingest/destination-endpoints.png)

Configuring endpoints allows you to forward messages received by Ingest over to
other webhook receivers using Svix Core.

![screenshot of the Ingest Dashboard showing the Destination/Logs tab for a Source named "demo"](../../static/img/ingest/destination-logs.png)

Logs and statistics are available to help monitor for problems, replay or
recover messages.

## Managing Source Tokens

The last portion of the `ingestUrl` is a `Token` which can be
invalidated and rotated:

```shell
curl https://api.svix.com/ingest/api/v1/source/src_xxxxx/token/rotate \
-H "Authorization: Bearer $SVIX_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
```

`Token`s that are rotated stay usable for 24 hours. During
this time both the old and new `Token`s are honored by Ingest. During this
period it's important that you reconfigure your provider with the new
`ingestUrl` in order to have a seamless transition.

:::note
Token rotation for Sources can only be configured via the API.
:::


## Transformations Support

A Javascript Transformation can optionally be configured per Source. This allows
for reshaping of the payload prior to the message being forwarded to any of the
configured Endpoints.

```shell
curl https://api.svix.com/ingest/api/v1/source \
-H "Authorization: Bearer $SVIX_TOKEN" \
-H "Content-Type: application/json" \
-d @- << EOF
{
"name": "demo-transformed",
"uid": "demo-with-transformation",
"type": "github",
"config": {
"secret": "<the signing secret>"
},
"transformation": "function handler(input) { return { ...input, transformedByIngest: true }; }",
"transformationEnabled": true
}
EOF
```

:::note
Transformations for Sources can only be configured via the API.
:::

[Svix Ingest]: https://svix.com/ingest
3 changes: 3 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ module.exports = {
"receiving/using-app-portal/replaying-messages",
],
},
{
"Using Ingest": ["receiving/receiving-with-ingest"]
},
{
"Verifying Webhooks": [
"receiving/verifying-payloads/why",
Expand Down
Binary file added static/img/ingest/destination-endpoints.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/ingest/destination-logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/ingest/source-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9c16179

Please sign in to comment.