# place.stream.server.createWebhook

> Create a new webhook for receiving Streamplace events.

- Kind: procedure
- Authority: server.stream.place
- Lexicon: 1
- Published by [stream.place](https://lexicon.garden/identity/did:plc:rbvrr34edl5ddpuwcubjiost), not the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.server.createWebhook)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.server.createWebhook/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.server.createWebhook/analytics)

## Procedure (`place.stream.server.createWebhook`)

Type: procedure · POST

### Input (application/json)

- `active` (boolean): Whether this webhook should be active upon creation.
  - Constraints: default: false
- `description` (string): A description of what this webhook is used for.
  - Constraints: maxLength: 500
- `events` (array, required): The types of events this webhook should receive.
  - `items` (string)
    - Constraints: enum: chat | livestream | follow | mention | stream.received
- `muteWords` (array): Words to filter out from chat messages. Messages containing any of these words will not be forwarded.
  - `items` (string)
    - Constraints: maxLength: 100
- `name` (string): A user-friendly name for this webhook.
  - Constraints: maxLength: 100
- `prefix` (string): Text to prepend to webhook messages.
  - Constraints: maxLength: 100
- `rewrite` (array): Text replacement rules for webhook messages.
  - `items` (ref)
    - Reference: `place.stream.server.defs#rewriteRule`
- `suffix` (string): Text to append to webhook messages.
  - Constraints: maxLength: 100
- `url` (string · uri, required): The webhook URL where events will be sent.

### Output (application/json)

- `webhook` (ref, required)
  - Reference: `place.stream.server.defs#webhook`

### Errors

- `InvalidUrl`: The provided webhook URL is invalid or unreachable.
- `DuplicateWebhook`: A webhook with this URL already exists for this user.
- `TooManyWebhooks`: The user has reached their maximum number of webhooks.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Create a new webhook for receiving Streamplace events.",
      "errors": [
        {
          "description": "The provided webhook URL is invalid or unreachable.",
          "name": "InvalidUrl"
        },
        {
          "description": "A webhook with this URL already exists for this user.",
          "name": "DuplicateWebhook"
        },
        {
          "description": "The user has reached their maximum number of webhooks.",
          "name": "TooManyWebhooks"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "active": {
              "default": false,
              "description": "Whether this webhook should be active upon creation.",
              "type": "boolean"
            },
            "description": {
              "description": "A description of what this webhook is used for.",
              "maxLength": 500,
              "type": "string"
            },
            "events": {
              "description": "The types of events this webhook should receive.",
              "items": {
                "enum": [
                  "chat",
                  "livestream",
                  "follow",
                  "mention",
                  "stream.received"
                ],
                "type": "string"
              },
              "type": "array"
            },
            "muteWords": {
              "description": "Words to filter out from chat messages. Messages containing any of these words will not be forwarded.",
              "items": {
                "maxLength": 100,
                "type": "string"
              },
              "type": "array"
            },
            "name": {
              "description": "A user-friendly name for this webhook.",
              "maxLength": 100,
              "type": "string"
            },
            "prefix": {
              "description": "Text to prepend to webhook messages.",
              "maxLength": 100,
              "type": "string"
            },
            "rewrite": {
              "description": "Text replacement rules for webhook messages.",
              "items": {
                "ref": "place.stream.server.defs#rewriteRule",
                "type": "ref"
              },
              "type": "array"
            },
            "suffix": {
              "description": "Text to append to webhook messages.",
              "maxLength": 100,
              "type": "string"
            },
            "url": {
              "description": "The webhook URL where events will be sent.",
              "format": "uri",
              "type": "string"
            }
          },
          "required": [
            "url",
            "events"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "webhook": {
              "ref": "place.stream.server.defs#webhook",
              "type": "ref"
            }
          },
          "required": [
            "webhook"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "place.stream.server.createWebhook",
  "lexicon": 1
}
```
