# Webhooks

## List team webhooks

This endpoint makes an HTTP GET request to retrieve a list of webhooks from the team.

**Request Body** This request does not require a request body.

### Request

* Method: `GET`
* Endpoint: `https://api.thebrief.ai/v1/webhooks`

```bash
curl --location 'ttps://api.thebrief.ai/v1/webhooks' \
--header 'Authorization: Bearer eyJ...'
```

**Response Body**

* `response` (object)
  * `id` (number): The webhook id.
  * `name` (string): The name of the webhook.
  * `webhookUrl` (string): The URL of the webhook.
  * `createdAt` (date): webhook creation date.
  * `createdByUser` (object)
    * `id` (number): The unique identifier of the user who creates the webhook.
    * `name` (string): The name of the user who creates the webhook.
  * actions (array)
    * `actionId` (number): The action ID was added to the webhook.
    * `createdAt` (Date): The date
    * `createdByUser` (object)&#x20;
      * `id` (number): The id of the user who added the action to the webhook.
      * `name` (string): The user's name who added the action to the webhook.
    * `action` (object)&#x20;
      * `name`: the added action name.
        * `description`: the added action description<br>

## Create team webhook

This endpoint allows you to create a new team webhook.

### Request

* Method: `POST`
* Endpoint: `https://api.thebrief.ai/v1/webhooks`
* Body:
  * `name` (string, required): The name of the webhook.
  * `url` (string, required): The URL of the webhook.
  * `actions`  (array, required): The selected actions to add to webhook (for. ex: \[1, 5])

### Response

The response will be in JSON format with the following structure:

* `name` (string) - The name of the webhook.
* `id` (int) - The id of the webhook.
* `webhookUrl` (string) - The URL of the webhook.
* `actions` (array)&#x20;
  * `actionId` (number) - the id of the action
  * `createdAt` (date) - the date when action was added to the webhook
  * `createdByUser` (object)&#x20;
    * `id` (number) - the user's ID who added the action to the webhook
    * `name` (string) - the user's name who added the action to the webhook
  * `action` (object)&#x20;
    * `id` (number) - the action ID added to the webhook
    * `name` (string) - the name of the action added to the webhook
    * `description` (string) - the description of the action added to the webhook
    * `config` (string) - some config of the action added to the webhook
    * `createdAt` (Date) - the date when the action was created
* `createdAt` (Date) - the date when the webhook was created
* `createdByUser` (object)

  * `id` (number) - the ID of the user who created the webhook
  * `name` (string) - the name of the user who created the webhook

  &#x20;

```json
{
    "response": {
        "name": "Webhook name",
        "id": 1111111,
        "webhookUrl": "https://webhookurl.webhook.com",
        "actions": [
            { 
                "actionId": 12,
                "createdAt": "2024-10-03T08:36:56.978Z",
                "createdByUser": {
                    "id": 12345,
                    "name": "User name"
                }
                "action" {
                    "id": 1,
                    "name": "comment/create",
                    "description": " Comment created",
                    "config": null,
                    "createdAt": "2024-10-03T08:36:56.978Z"
                }
            }
            ...
        ]
        "createdAt": "2024-10-03T08:36:56.978Z",
        "createdByUser": {
            "id": 12345,
            "name": "User name"
        } 
    }
}
```

## Delete team webhook

This endpoint allows you to delete a team webhook.

### Request

* Method: `DELETE`
* Endpoint: `https://api.thebrief.ai/v1/webhooks`
* Body:
  * `webhookId` (integer, required): The id of the team webhook.

### Response

The response will be in JSON format:

```json
{
    "response": true
}
```

## Update team webhook

This endpoint allows you to update an existing team webhook.

### Request

* Method: `PUT`
* Endpoint: `https://api.thebrief.ai/v1/webhooks`
* Body:
  * `webhookId` (integer, required): The webhook id
  * `name` (string, optional): The new name of the webhook.
  * `url` (string, optional): The new URL of the webhook.
  * `actions`  (array, optional): The newly selected actions to add to webhook (for. ex: \[1, 2, 4])

### Response

The response will be in JSON format with the following structure:

* `name` (string) - The name of the webhook.
* `id` (int) - The id of the webhook.
* `webhookUrl` (string) - The URL of the webhook.
* `actions` (array)&#x20;
  * `actionId` (number) - the id of the action
  * `createdAt` (date) - the date when action was added to the webhook
  * `createdByUser` (object)&#x20;
    * `id` (number) - the user's ID who added the action to the webhook
    * `name` (string) - the user's name who added the action to the webhook
  * `action` (object)&#x20;
    * `id` (number) - the action ID added to the webhook
    * `name` (string) - the name of the action added to the webhook
    * `description` (string) - the description of the action added to the webhook
    * `config` (string) - some config of the action added to the webhook
    * `createdAt` (Date) - the date when the action was created
* `createdAt` (Date) - the date when the webhook was created
* `createdByUser` (object)

  * `id` (number) - the ID of the user who created the webhook
  * `name` (string) - the name of the user who created the webhook

  &#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thebrief.ai/public-api/rest-api/webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
