> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ServiceNow Webhook Setup Guide

> Configure ServiceNow to deliver events to StackOne.

## Prerequisites

Before continuing, you should have already completed the following for this connector:

<Steps>
  <Step title="Configure the Connector">
    Enable the connector and set up its connector profile in your project. See <a href="/guides/explore-connectors">Managing Connectors</a>.

    <Columns cols={2}>
      <Card title="Connector Profile" href="/connectors/servicenow/guides/connector-profile/basic-auth" icon="https://stackone-logos.com/api/servicenow/filled/png" horizontal>
        ServiceNow - Basic Auth
      </Card>

      <Card title="Connector Profile" href="/connectors/servicenow/guides/connector-profile/api-key" icon="https://stackone-logos.com/api/servicenow/filled/png" horizontal>
        ServiceNow - API Key
      </Card>
    </Columns>
  </Step>

  <Step title="Link an Account">
    Connect an account using <a href="/guides/embedding-stackone-hub">StackOne Hub</a> or <a href="/guides/auth-link">Auth Link</a>.

    <Columns cols={2}>
      <Card title="Link Account" href="/connectors/servicenow/guides/link-account/basic-auth" icon="https://stackone-logos.com/api/servicenow/filled/png" horizontal>
        ServiceNow - Basic Auth
      </Card>

      <Card title="Link Account" href="/connectors/servicenow/guides/link-account/api-key" icon="https://stackone-logos.com/api/servicenow/filled/png" horizontal>
        ServiceNow - API Key
      </Card>
    </Columns>
  </Step>
</Steps>

<section data-guide-section data-guide-scopes="">
  <h2>Subscribe via the StackOne dashboard (recommended)</h2>

  <p>ServiceNow does not expose a native webhook subscription API. This connector synthesises one by installing a <strong>Business Rule</strong> (`sys_script`) per event you subscribe to — each rule runs `after` the matching row operation and POSTs a standardised JSON envelope to the StackOne Native Webhook URL via `sn_ws.RESTMessageV2`. When you subscribe through the StackOne dashboard, this happens automatically on account connection.</p>

  <Steps>
    <Step title="Select event subscriptions in the dashboard">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>The connector ships <strong>18 event handlers — one per (table, operation) pair</strong> — across 6 ServiceNow tables.</p>

        <ul>
          <li><strong>Incident</strong>: `Incident Created`, `Incident Updated`, `Incident Deleted` (table `incident`)</li>
          <li><strong>Problem</strong>: `Problem Created`, `Problem Updated`, `Problem Deleted` (table `problem`)</li>
          <li><strong>Change Request</strong>: `Change Request Created`, `Change Request Updated`, `Change Request Deleted` (table `change_request`)</li>
          <li><strong>Knowledge Article</strong>: `Knowledge Article Created`, `Knowledge Article Updated`, `Knowledge Article Deleted` (table `kb_knowledge`)</li>
          <li><strong>User</strong>: `User Created`, `User Updated`, `User Deleted` (table `sys_user`)</li>
          <li><strong>Group</strong>: `Group Created`, `Group Updated`, `Group Deleted` (table `sys_user_group`)</li>
        </ul>
      </div>
    </Step>

    <Step title="Connect the ServiceNow account">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>On account connection, the connector iterates over the events you subscribed to and installs <strong>one Business Rule per event</strong>. Each rule is scoped to a single operation (`Insert` / `Update` / `Delete` checkbox on the <strong>When to run</strong> tab) — for example, subscribing to `Incident Created` and `Incident Deleted` installs two Business Rules on the `incident` table, one with only `Insert` enabled and one with only `Delete` enabled.</p>
      </div>
    </Step>

    <Step title="Verify delivery">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Trigger a matching row change in ServiceNow (e.g. create a test incident) and confirm the event reaches your downstream consumer.</p>

        <ul>
          <li>Optional: POST `{"test": true}` to the Native Webhook URL — the `Active Check` handler returns 200 if the receiver is reachable.</li>
          <li>Confirm the Business Rules appear under <strong>System Definition > Business Rules</strong> with names of the form `StackOne Webhook - <event>` (e.g. `StackOne Webhook - incident_created`).</li>
        </ul>
      </div>
    </Step>

    <Step title="Unsubscribe">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Removing an event subscription in the dashboard deletes the corresponding Business Rule from your instance. Disconnecting the account removes all StackOne-installed Business Rules.</p>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>Install via the Create Webhook action (advanced)</h2>

  <p>For one-off subscriptions outside the dashboard event-config flow, call the `create_webhook` action directly. It installs a single Business Rule on the table you specify. Note: only the six tables with dedicated event handlers (`incident`, `problem`, `change_request`, `kb_knowledge`, `sys_user`, `sys_user_group`) are routed to a handler — webhooks on any other table will POST envelopes that the connector drops, since there is no longer a generic fallback handler.</p>

  <Steps>
    <Step title="Retrieve StackOne Native Webhook URL (only if overriding)">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>The action uses the connector's Native Webhook URL by default. Copy it from the connector profile in the StackOne dashboard only if you need to override `endpoint_url`.</p>
      </div>
    </Step>

    <Step title="Call Create Webhook">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Invoke <strong>Create Webhook</strong> with the table name. Defaults: `on_insert=true`, `on_update=true`, `on_delete=false` — override as needed. Save the `sys_id` returned in the response: it is required to delete the subscription later.</p>

        <ul>
          <li>`table_name` (required): the ServiceNow table to watch (e.g. `incident`).</li>
          <li>`endpoint_url` (optional): override the destination URL. Leave blank to use the Native Webhook URL.</li>
          <li>`on_insert` / `on_update` / `on_delete` (optional booleans): which operations should fire the webhook. Set only one to `true` to mimic a per-operation event subscription.</li>
          <li>`name` (optional): human-readable name. Defaults to `StackOne Webhook - <table>`.</li>
        </ul>
      </div>
    </Step>

    <Step title="List or remove">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Call <strong>List Webhooks</strong> to see every StackOne-managed Business Rule on the instance (identified by a `[stackone-webhook]` marker in the description). Call <strong>Delete Webhook</strong> with the `sys_id` to remove one.</p>
      </div>
    </Step>
  </Steps>
</section>

## Verify

Your Connector should now be able to receive and process events. Try triggering an event and you should see an Event appear in the Connector logs.
