---
sidebar:
  hidden: true
title: roboto.domain.orgs.webhook_integration
---
## Module Contents

### BeginWebhookIntegrationRequest

```python
class roboto.domain.orgs.webhook_integration.BeginWebhookIntegrationRequest(
    /,
    **data: Any,
)
```

`from roboto.domain.orgs.webhook_integration import BeginWebhookIntegrationRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L24-L40)

Bases: `pydantic.BaseModel`

Request body for `WebhookIntegrationService.begin_webhook_integration`.

Starts a webhook integration between an organization and a webhook provider.

**Parameters**

- **data** (`Any`)

**Attributes**

- **BeginWebhookIntegrationRequest.org_id** (`str`): ID of the organization to create the integration in.
- **BeginWebhookIntegrationRequest.user_config** (`dict[str, Any] | None`) = `None`: Provider-specific settings for the integration. `None` sets none.
- **BeginWebhookIntegrationRequest.webhook_events** (`list[str]`): Provider event types the integration accepts, such as `recording.imported`. Must not be empty.
- **BeginWebhookIntegrationRequest.webhook_provider** (`WebhookProvider`): Service that sends events to the integration.

### UpdateWebhookIntegrationAPIKeyRequest

```python
class roboto.domain.orgs.webhook_integration.UpdateWebhookIntegrationAPIKeyRequest(
    /,
    **data: Any,
)
```

`from roboto.domain.orgs.webhook_integration import UpdateWebhookIntegrationAPIKeyRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L62-L78)

Bases: `pydantic.BaseModel`

Request body for `PUT /v1/integrations/webhook/id/{webhook_endpoint_id}/api_key`.

Registers or replaces the API key Roboto uses to fetch data, such as recordings, from the webhook provider.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UpdateWebhookIntegrationAPIKeyRequest.webhook_provider_api_key** (`pydantic.SecretStr`): API key for the webhook provider's API.

#### UpdateWebhookIntegrationAPIKeyRequest.serialize_over_the_wire()

```python
def serialize_over_the_wire(value: pydantic.SecretStr) -> str
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L72-L78)

Serialize `webhook_provider_api_key` as its plain string value in JSON, so the request body carries it.

Pydantic calls this when it serializes the request to JSON. Other dumps and the request's `repr` keep the key masked.

**Parameters**

- **value** (`pydantic.SecretStr`)

**Returns**

- `str`

### UpdateWebhookIntegrationSecretRequest

```python
class roboto.domain.orgs.webhook_integration.UpdateWebhookIntegrationSecretRequest(
    /,
    **data: Any,
)
```

`from roboto.domain.orgs.webhook_integration import UpdateWebhookIntegrationSecretRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L43-L59)

Bases: `pydantic.BaseModel`

Request body for `PUT /v1/integrations/webhook/id/{webhook_endpoint_id}/signature_secret`.

Registers or replaces the secret Roboto checks each incoming event's signature against.

**Parameters**

- **data** (`Any`)

**Attributes**

- **UpdateWebhookIntegrationSecretRequest.webhook_secret** (`pydantic.SecretStr`): Secret the webhook provider signs its events with.

#### UpdateWebhookIntegrationSecretRequest.serialize_over_the_wire()

```python
def serialize_over_the_wire(value: pydantic.SecretStr) -> str
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L53-L59)

Serialize `webhook_secret` as its plain string value in JSON, so the request body carries it.

Pydantic calls this when it serializes the request to JSON. Other dumps and the request's `repr` keep the secret masked.

**Parameters**

- **value** (`pydantic.SecretStr`)

**Returns**

- `str`

### WebhookIntegrationRecord

```python
class roboto.domain.orgs.webhook_integration.WebhookIntegrationRecord(/, **data: Any)
```

`from roboto.domain.orgs.webhook_integration import WebhookIntegrationRecord`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L81-L132)

Bases: `pydantic.BaseModel`

Data record of a webhook integration, as the Roboto API returns it.

A webhook integration is an endpoint at which a third-party service, the webhook provider, sends events to an organization in Roboto. The record never contains the integration's secret or API key; it says only whether each is registered. Returned by `WebhookIntegrationService.begin_webhook_integration`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **WebhookIntegrationRecord.api_key_registered** (`bool`): Whether the API key Roboto uses to fetch data from the webhook provider is registered.

- **WebhookIntegrationRecord.created** (`datetime.datetime`): Time the integration was created.

- **WebhookIntegrationRecord.created_by** (`str`): ID of the user who created the integration.

- **WebhookIntegrationRecord.modified** (`datetime.datetime`): Time the integration was last modified.

- **WebhookIntegrationRecord.modified_by** (`str`): ID of the user who last modified the integration.

- **WebhookIntegrationRecord.org_id** (`str`): ID of the organization that owns the integration.

- **WebhookIntegrationRecord.secret_registered** (`bool`): Whether the secret Roboto checks event signatures against is registered.

- **WebhookIntegrationRecord.status** (`str`): Status of the integration: `in_progress` until its secret and API key are both registered, then `healthy`.

  Roboto rejects events sent to an integration that is `in_progress`.

- **WebhookIntegrationRecord.user_config** (`dict[str, Any] | None`) = `None`: Provider-specific settings for the integration, or `None` if none were set.

- **WebhookIntegrationRecord.webhook_endpoint_id** (`str`): Unique ID of the webhook integration, beginning with `wh_`.

- **WebhookIntegrationRecord.webhook_endpoint_url** (`str`): URL to configure in the webhook provider, to which it sends events.

- **WebhookIntegrationRecord.webhook_events** (`list[str]`): Provider event types the integration accepts, such as `recording.imported`.

  Roboto rejects events of any other type, except the provider's `ping` test events.

- **WebhookIntegrationRecord.webhook_provider** (`WebhookProvider`): Service that sends events to the integration.

### WebhookIntegrationService

```python
class roboto.domain.orgs.webhook_integration.WebhookIntegrationService(
    roboto_client: Optional[roboto.RobotoClient] = None,
)
```

`from roboto.domain.orgs.webhook_integration import WebhookIntegrationService`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L135-L193)

Client that starts webhook integrations, which let a webhook provider such as Foxglove send events to Roboto.

**Parameters**

- **roboto_client** (`Optional[roboto.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).

#### WebhookIntegrationService.begin_webhook_integration()

```python
def begin_webhook_integration(
    org_id: str,
    webhook_provider: WebhookProvider,
    webhook_events: list[str],
    user_config: dict[str, Any] | None = None,
) -> WebhookIntegrationRecord
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L148-L193)

Create a webhook integration for an organization, with the status `in_progress`.

Configure the returned record's `webhook_endpoint_url` in the webhook provider, then register the provider's signing secret and API key with Roboto. The integration becomes `healthy`, and accepts events, once both are registered.

**Parameters**

- **org_id** (`str`): ID of the organization to create the integration in.
- **webhook_provider** (`WebhookProvider`): Service that will send events to the integration.
- **webhook_events** (`list[str]`): Provider event types the integration accepts, such as `recording.imported`.
- **user_config** (`dict[str, Any] | None`): Provider-specific settings for the integration. `None` sets none.

**Returns**

- `WebhookIntegrationRecord`: Record of the new integration.

**Raises**

- [`RobotoInvalidRequestException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): `webhook_events` is empty, or no organization has the ID `org_id`.
- [`RobotoConflictException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoConflictException): The provider is Foxglove and the organization already has a Foxglove integration.

**Usage**

```python
from roboto.domain.orgs.webhook_integration import WebhookIntegrationService, WebhookProvider
service = WebhookIntegrationService()
record = service.begin_webhook_integration(
    org_id="og_12345",
    webhook_provider=WebhookProvider.Foxglove,
    webhook_events=["recording.imported"],
)
print(record.webhook_endpoint_url)
```

### WebhookProvider

```python
class roboto.domain.orgs.webhook_integration.WebhookProvider
```

`from roboto.domain.orgs.webhook_integration import WebhookProvider`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/orgs/webhook_integration.py#L17-L21)

Bases: `roboto.compat.StrEnum`

Webhook provider of a webhook integration: the third-party service that sends the integration its events.

**Attributes**

- **WebhookProvider.Foxglove** = `'foxglove'`: Foxglove, which can notify Roboto when it imports a recording or when someone creates an event in Foxglove.
