---
title: "Create a webhook"
method: POST
path: "/NotificationWebHooks"
tags: ["NotificationWebHooks"]
---

# Create a webhook

`POST /NotificationWebHooks`

## Request

- Base URL: `https://sb2api.servicechannel.com/v3`
- URL: `https://sb2api.servicechannel.com/v3/NotificationWebHooks`
- Auth: OAuth 2
  - Authorization code: `https://sb2login.servicechannel.com/oauth/authorize`
  - Token URL: `https://sb2login.servicechannel.com/oauth/token`
- TypeScript: <https://skmtc.dev/servicechannel/apis/servicechannel-api-v-3/docs/NotificationWebHooks/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new webhook for the specified [event types](/guides/wh/types-of-events/). Returns a unique webhook ID for a successful request.
            See [Event Objects](/guides/wh/event-objects/) for example notification objects and descriptions of their fields.
            <br />***Note:*** You can create webhooks using API or via the [Service Automation Admin](/guides/wh/create-and-manage-webhooks-in-UI/).
            <br />**Example Request**
            
                POST /NotificationWebHooks
                {
                  "Subscriptions": [
                    {
                      "Name": "Subscription to new WOs",
                      "EventTypes": [
                        "WorkOrderCreated"
                      ],
                      "Rules": {
                        "Trades": [
                          "GLASS"
                        ],
                        "Categories": [
                          "MAINTENANCE"
                        ],
                        "Statuses": [
                          "COMPLETED/CONFIRMED"
                        ]
                      }
                    }
                  ],
                  "Enabled": true,
                  "Name": "New WO webhook",
                  "Description": "I want to receive notifications when new WOs of GLASS trade and MAINTENANCE category are created.",
                  "Url": "https://your-company.com/webhook-target-URL"
                }

## Request body

- ServiceChannelServicesMessagingNotificationsWebHooksAddWebHookRequest
  - `Subscriptions` ServiceChannelServicesMessagingNotificationsNotificationRequestBase[]
    - `Name` string, required: The user-friendly name for the subscription.
    - `EventTypes` string[], required: The list of events to subscribe to. Events within one subscription should belong to one object.
    - `Rules` ServiceChannelServicesMessagingNotificationsNotificationSubscriptionsRules: The event rules used to receive events matching only certain criteria.
      - `Trades` string[]: The trades that the events should belong to.
      - `Categories` string[]: The categories that the events should belong to.
      - `Statuses` string[]: The statuses that the events should belong to.
  - `Enabled` boolean: Defines if the webhook is active or inactive.
  - `Name` string, required: The user-friendly name for the webhook.
  - `Description` string: The description of the webhook.
  - `Url` string, required: The URL to which the events should be delivered.

## Response `201`

The webhook is created.

- ServiceChannelServicesMessagingNotificationsWebHooksAddWebHookResponse: Add WebHook Response
  - `Id` integer: The unique webhook ID. Generated automatically and cannot be modified.
  - `SubscriptionsResponses` integer[]

## Other responses

- `400`: The request is not accepted due to bad syntax, missing parameters, insufficient data, etc. <br/>Error codes: 503 - Required data missing or incorrect
- `401`: The request is not authorized. <br/>Error codes: 504 - Missing or incorrect authentication credentials

---

[API](https://skmtc.dev/servicechannel/apis/servicechannel-api-v-3.md) - [All operations](https://skmtc.dev/servicechannel/apis/servicechannel-api-v-3/llms.txt) - [OpenAPI document](https://skmtc.dev/servicechannel/apis/servicechannel-api-v-3/revisions/d490d6596809?raw)
