Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(/integrations/webhooks/sync-data) update guide #1655

Merged
merged 57 commits into from
Nov 15, 2024

Conversation

victoriaxyz
Copy link
Contributor

@victoriaxyz victoriaxyz commented Oct 25, 2024

Explanation:

This PR:

@victoriaxyz victoriaxyz changed the title wip wip: /integrations/webhooks/sync-data Oct 25, 2024
@victoriaxyz victoriaxyz changed the title wip: /integrations/webhooks/sync-data wip: (/integrations/webhooks/sync-data) update guide Oct 29, 2024
@victoriaxyz victoriaxyz changed the title wip: (/integrations/webhooks/sync-data) update guide (/integrations/webhooks/sync-data) update guide Oct 29, 2024
@victoriaxyz victoriaxyz marked this pull request as ready for review October 29, 2024 19:10
@victoriaxyz victoriaxyz requested a review from a team as a code owner October 29, 2024 19:10
Copy link

Hey, here’s your docs preview: https://clerk.com/docs/pr/1655

docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
@royanger royanger self-requested a review November 1, 2024 17:40
- `user.updated`: Triggers when user information is updated via Clerk components, the Clerk Dashboard, or Backend API. Listening to this event keeps data synced between Clerk and your external database. It is recommended to only sync what you need to simplify this process.
- `user.deleted`: Triggers when a user deletes their account, or their account is removed via the Clerk Dashboard or Backend API. Listening to this event allows you to delete the user from your database or add a `deleted: true` flag.

These steps apply to any Clerk event. To make the setup process easier, it's recommended to keep two browser tabs open: one for your Clerk [**Webhooks**](https://dashboard.clerk.com/last-active?path=webhooks) page and one for your [ngrok dashboard](https://dashboard.ngrok.com).

<Steps>
### Set up ngrok

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit: After the 'Set up ngrok' section, the guide never refers to the ngrok dashboard. We could probably skip suggesting the customer keep this open.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this note in case the customer needs to access their secrets again.

docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
Comment on lines 77 to 81
Incoming webhook events have no auth information. They come from an external source and will not be signed in or signed out. To allow access, the route must be public.

The following example shows the recommended Middleware configuration for webhook routes.

```ts {{ filename: 'middleware.ts' }}
import { clerkMiddleware } from '@clerk/nextjs/server'

// Make sure that the `/api/webhooks(.*)` route is not protected here
export default clerkMiddleware()
Incoming webhook events contain no authentication information. They come from an external source and won't be signed in or signed out, so the route must be public to allow access.

export const config = {
matcher: [
// Skip Next.js internals and all static files, unless found in search params
'/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
// Always run for API routes
'/(api|trpc)(.*)',
],
}
```
To configure your Middleware, refer to the [clerkMiddleware() guide](docs/references/nextjs/clerk-middleware).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you repeat information here.
also the sentence ends wtih "so the route must be public to allow access". and then the next sentence goes into configuring your middleware.

there should be some relational information that ties these two concepts together:
"so the route must be public to allow access. If you are using clerkMiddleware(), you will need to ensure that the /api/webhooks(.*) route is public. For more information on configuring routes with clerkMiddleware(), see the reference.

also don't forget that clerkMiddleware() always needs to be in code snippets. even if it's in a link

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
Copy link
Member

@royanger royanger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left a couple of super minor notes, but those are easy to fix and then this should be good to ship. 🚀

docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
docs/integrations/webhooks/sync-data.mdx Outdated Show resolved Hide resolved
@alexisintech alexisintech merged commit 1ffb68a into main Nov 15, 2024
4 checks passed
@alexisintech alexisintech deleted the vi/docs-8861/sync-data branch November 15, 2024 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants