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

# Service Now

> Service Now provider allows sending notifications, updates, and retrieving topology information from the ServiceNow CMDB.

## Authentication

This provider requires authentication.

* **service\_now\_base\_url**: The base URL of the ServiceNow instance (required: True, sensitive: False)
* **username**: The username of the ServiceNow user (required: True, sensitive: False)
* **password**: The password of the ServiceNow user (required: True, sensitive: True)
* **client\_id**: The client ID to use OAuth 2.0 based authentication (required: False, sensitive: False)
* **client\_secret**: The client secret to use OAuth 2.0 based authentication (required: False, sensitive: True)
* **ticket\_creation\_url**: URL for creating new tickets (required: False, sensitive: False)

Certain scopes may be required to perform specific actions or queries via the provider. Below is a summary of relevant scopes and their use cases:

* **itil**: The user can read/write tickets from the table (mandatory) ([Documentation](https://docs.servicenow.com/bundle/sandiego-platform-administration/page/administer/roles/reference/r_BaseSystemRoles.html))

## In workflows

This provider can be used in workflows.

As "step" to query data, example:

```yaml theme={null}
steps:
    - name: Query servicenow
      provider: servicenow
      config: "{{ provider.my_provider_name }}"
      with:
        table_name: {value}  # The name of the table to query.
        incident_id: {value}  # The incident ID to query.
        sysparm_limit: {value}  # The maximum number of records to return.
        sysparm_offset: {value}  # The offset to start from.
```

As "action" to make changes or update data, example:

```yaml theme={null}
actions:
    - name: Query servicenow
      provider: servicenow
      config: "{{ provider.my_provider_name }}"
      with:
        table_name: {value}  # The name of the table to create the ticket in.
        payload: {value}  # The ticket payload.
        ticket_id: {value}  # The ticket ID (optional to update a ticket).
        fingerprint: {value}  # The fingerprint of the ticket (optional to update a ticket).
```

Check the following workflow examples:

* [blogpost.yml](https://github.com/keephq/keep/blob/main/examples/workflows/blogpost.yml)
* [clickhouse\_multiquery.yml](https://github.com/keephq/keep/blob/main/examples/workflows/clickhouse_multiquery.yml)
* [create\_service\_now\_ticket\_upon\_alerts.yml](https://github.com/keephq/keep/blob/main/examples/workflows/create_service_now_ticket_upon_alerts.yml)
* [update\_service\_now\_tickets\_status.yml](https://github.com/keephq/keep/blob/main/examples/workflows/update_service_now_tickets_status.yml)

## Topology

This provider pulls [topology](/overview/servicetopology) to Keep. It could be used in [correlations](/overview/correlation-topology)
and [mapping](/overview/enrichment/mapping#mapping-with-topology-data), and as a context
for [alerts](/alerts/sidebar#7-alert-topology-view) and [incidents](/overview#17-incident-topology).

## Provider Methods

The provider exposes the following [Provider Methods](/providers/provider-methods#via-ai-assistant). They are available in the [AI Assistant](/overview/ai-incident-assistant).

* **get\_incidents** Fetch all incidents from ServiceNow (view, scopes: itil)

* **get\_incident\_activities** Get work notes and comments from a ServiceNow incident (view, scopes: itil)

  * `incident_id`: The incident number (e.g. INC0010001) or sys\_id.
  * `limit`: Maximum number of activity records to return.

* **add\_incident\_activity** Add a work note or comment to a ServiceNow incident (action, scopes: itil)

  * `incident_id`: The incident number (e.g. INC0010001) or sys\_id.
  * `content`: The text content to add.
  * `activity_type`: Either 'work\_notes' or 'comments'. Defaults to 'work\_notes'.

## Connecting with the Provider

1. Ensure that the ServiceNow instance is accessible via API.
2. Provide the necessary API credentials (`instance_url` and `api_token`) in the provider configuration.

## Additional

* `KEEP_SERVICENOW_PROVIDER_SKIP_SCOPE_VALIDATION` envirnomental variable in the backend allows to bypass scope validation.

## Useful Links

* [Service Now API documentation](https://docs.servicenow.com/bundle/xanadu-api-reference/page/build/applications/concept/api-rest.html)
