diff --git a/docs/admin/webhooks/outgoing.mdx b/docs/admin/webhooks/outgoing.mdx index 6a742d3c2..2bdc7420a 100644 --- a/docs/admin/webhooks/outgoing.mdx +++ b/docs/admin/webhooks/outgoing.mdx @@ -2,20 +2,20 @@ Outgoing webhooks can be configured on a Sourcegraph instance in order to send Sourcegraph events to external tools and services. This allows for deeper integrations between Sourcegraph and other applications. -Currently, webhooks are only implemented for events related to [Batch Changes](/batch-changes/). They also cannot yet be scoped to specific entities, meaning that they will be triggered for all events of the specified type across Sourcegraph. Expanded support for more event types and scoped events is planned for the future. Please [let us know](mailto:feedback@sourcegraph.com) what types of events you would like to see implemented next, or if you have any other feedback! +Currently, outgoing webhooks cannot yet be scoped to specific entities, meaning that they will be triggered for all events of the specified type across Sourcegraph. Expanded support for more event types and scoped events is planned for the future. Please [let us know](mailto:feedback@sourcegraph.com) what types of events you would like to see implemented next, or if you have any other feedback! > WARNING: Outgoing webhooks have the potential to send sensitive information about your repositories and code to other untrusted services. When configuring outgoing webhooks, be sure to only send events to trusted service URLs and to use the shared secret to verify any requests received. ## Adding an outgoing webhook -1. Navigate to **Site Admin > Configuration > Ougoing webhooks** +1. Navigate to **Site Admin > Configuration > Outgoing webhooks** ![Outgoing webhooks page](https://storage.googleapis.com/sourcegraph-assets/docs/images/administration/config/webhooks/outgoing-webhooks-page.png) 1. Click **+ Create webhook** ![Adding an outgoing webhook](https://storage.googleapis.com/sourcegraph-assets/docs/images/administration/config/webhooks/adding-outgoing-webhook.png) 1. Fill out the form: 1. **URL**: URL endpoint of the external service that Sourcegraph should send webhook events to. 1. **Secret**: An arbitrary secret to share between Sourcegraph and the external service. A default value is provided, but you are free to change it. - 1. **Event types**: The types of [events](#supported-event-types) that will trigger a webhook event. Currently, only events related to Batch Changes are supported. + 1. **Event types**: The types of [events](#supported-event-types) that will trigger a webhook event. 1. Click **Create** The outgoing webhook will now be created and active. To view or edit its details, or to see the log of event requests that have been sent for it, click the **Edit** button on the outgoing webhook's row. @@ -116,3 +116,50 @@ The changeset webhook event payload mirrors the [GraphQL API](/api/graphql/) `Ex "owning_batch_change_id": "QmF0Y2hDaGFuZ2U6MTcz" } ``` + +### User + +- **user:create** - Sent when a Sourcegraph user is created. + +#### Example payload + +The `user:create` webhook event is sent only after successful user creation. Failed user creation attempts do not send the event. + +```json +{ + // The payload schema version. + "version": 1, + "user": { + // The Sourcegraph database ID for the created user. + "database_id": 123, + // The Sourcegraph username for the created user. + "username": "alice", + // The display name, if set. + "display_name": "Alice", + // The avatar URL, if set. + "avatar_url": "https://example.com/avatar.png", + // The user creation timestamp. + "created_at": "2026-05-13T12:00:00Z", + // Whether the created user is a site admin. + "site_admin": false, + // Whether the created user is a service account. + "service_account": false, + // The user's verified email address, if available. + "verified_email": "alice@example.com" + }, + // The Sourcegraph database ID of the user who created this user, if available. + "created_by_user_id": 42, + // Metadata about the external account used to create the user, if available. + "external_account": { + // The external auth or service type. + "service_type": "saml", + // The external auth or service identifier. + "service_id": "https://idp.example.com" + } +} +``` + +- `version` is the payload schema version. Currently, this is `1`. +- `created_by_user_id` is omitted when there is no authenticated Sourcegraph user who created the new user. +- `user.verified_email` is only included when the user's email is verified. +- `external_account` is only included when the user was created through an external account or auth provider path. Its `service_type` may be values such as `saml`, `openidconnect`, or `scim`.