# updateWebhook

```graphql
mutation UpdateWebhook($input: UpdateWebhookInput!) {
  updateWebhook(input: $input) {
    id
    projectId
    name
    source
    target {
      kind
      id
      conversationMode
      conversationId
    }
    promptTemplate
    eventFilter {
      mode
    }
    status
    runtimeTargetKind
    runtimeTargetEnvironmentId
    runtimeTargetBranchId
    definitionSource
    sourceTriggerId
    sourcePath
    sourceHash
    ingressId
    webhookUrl
    createdByUserId
    enabledAt
    disabledAt
    disabledReason
    createdAt
    updatedAt
  }
}
```

Change the name, target, prompt template, event filter or status of a webhook, for example to enable or disable deliveries; returns the updated webhook. Requires project.agents.write.

## Arguments

| Name                     | Type                    | Required | Description                                                                                                                                                                                                                                                         |
| ------------------------ | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `input`                  | UpdateWebhookInput!     | Yes      |                                                                                                                                                                                                                                                                     |
| `input.projectReference` | String                  |          |                                                                                                                                                                                                                                                                     |
| `input.id`               | ID!                     | Yes      | Webhook definition id. A missing webhook fails with RESOURCE\_NOT\_FOUND. Updates require project.agents.write. When target is omitted, a stored conversation-backed target (create\_new or existing conversation mode) still requires project.conversations.write. |
| `input.name`             | String                  |          |                                                                                                                                                                                                                                                                     |
| `input.target`           | WebhookTargetInput      |          |                                                                                                                                                                                                                                                                     |
| `input.promptTemplate`   | String                  |          |                                                                                                                                                                                                                                                                     |
| `input.eventFilter`      | WebhookEventFilterInput |          |                                                                                                                                                                                                                                                                     |
| `input.status`           | WebhookStatus           |          | One of `draft`, `enabled`, `disabled`.                                                                                                                                                                                                                              |

## Variables

```json
{
  "input": {
    "id": "string"
  }
}
```

## Responses

| Status | Description                                   |
| ------ | --------------------------------------------- |
| 200    | The WebhookDefinition! in data.updateWebhook. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation UpdateWebhook($input: UpdateWebhookInput!) {\n  updateWebhook(input: $input) {\n    id\n    projectId\n    name\n    source\n    target {\n      kind\n      id\n      conversationMode\n      conversationId\n    }\n    promptTemplate\n    eventFilter {\n      mode\n    }\n    status\n    runtimeTargetKind\n    runtimeTargetEnvironmentId\n    runtimeTargetBranchId\n    definitionSource\n    sourceTriggerId\n    sourcePath\n    sourceHash\n    ingressId\n    webhookUrl\n    createdByUserId\n    enabledAt\n    disabledAt\n    disabledReason\n    createdAt\n    updatedAt\n  }\n}",
  "variables": {
    "input": {
      "id": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "updateWebhook": {
      "id": "string",
      "projectId": "string",
      "name": "string",
      "source": "string",
      "target": {
        "kind": "agent",
        "id": "string",
        "conversationMode": "create_new",
        "conversationId": "string"
      },
      "promptTemplate": "string",
      "eventFilter": {
        "mode": "all"
      },
      "status": "draft",
      "runtimeTargetKind": "string",
      "runtimeTargetEnvironmentId": "string",
      "runtimeTargetBranchId": "string",
      "definitionSource": "string",
      "sourceTriggerId": "string",
      "sourcePath": "string",
      "sourceHash": "string",
      "ingressId": "string",
      "webhookUrl": "https://example.com",
      "createdByUserId": "string",
      "enabledAt": "string",
      "disabledAt": "string",
      "disabledReason": "string",
      "createdAt": "string",
      "updatedAt": "string"
    }
  }
}
```
