<a id="servicenow-sink-connector"></a>

# ServiceNow Sink Connector for Confluent Platform

The Kafka Connect ServiceNow Sink connector is used to capture Apache Kafka® records
and sink them to a [ServiceNow Table](https://www.servicenow.com) in
real-time. Data is consumed using the [ServiceNow Table API](https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/concept/c_TableAPI.html).

#### IMPORTANT
<!-- WARNING: THIS IS A SHARED FILE AND THE SOURCE IS LOCATED IN DOCS-COMMON. DO NOT ADD TO ANY OTHER REPO. -->

Effective July 6, 2025, only self-managed connector versions that meet or exceed the minimum version listed on the
[Supported Connector Versions](https://docs.confluent.io/platform/7.8/connect/supported-connector-version.html#supported-connector-versions-till-cp-7-8)
page receive support from Confluent. Older, unsupported connector versions have been removed from Confluent Marketplace and
are no longer available for download.

<a id="servicenow-sink-connector-feature"></a>

## Features

The ServiceNow Sink connector includes the following features:

- [At least once delivery](#servicenow-sink-at-least-once)
- [Dead Letter Queue](#servicenow-sink-dead-letter-queue)
- [Multiple tasks](#servicenow-sink-multiple-tasks)
- [Multiple HTTP request methods](#servicenow-sink-http-request-methods)
- [Supports HTTPS proxy](#servicenow-sink-supports-https-proxy)
- [Result reporting](#servicenow-sink-result-reporting)
- [HTTP Basic and Mutual TLS authentication](#servicenow-sink-http-basic-and-mtls)
- [Client-side encryption](#servicenow-sink-csfle-sm)

<a id="servicenow-sink-at-least-once"></a>

### At least once delivery

This connector guarantees that records are delivered at least once from the Kafka
topic.

<a id="servicenow-sink-dead-letter-queue"></a>

### Dead Letter Queue

This connector supports the Dead Letter Queue (DLQ) functionality. For
information about accessing and using the DLQ, see [Confluent Platform
Dead Letter Queue](/platform/current/connect/concepts.html#dead-letter-queue).

<a id="servicenow-sink-multiple-tasks"></a>

### Multiple tasks

The ServiceNow Sink connector supports running one or more tasks. You can
specify the number of tasks in the `tasks.max` configuration parameter. This
can lead to performance gains when multiple files need to be parsed.

<a id="servicenow-sink-http-request-methods"></a>

### Multiple HTTP request methods

The connector supports POST, DELETE, and PUT HTTP request methods. Note that
this connector does not support PATCH as PUT and PATCH behave exactly the same
in the ServiceNow Table API. The requests method used for each specific record
is chosen dynamically:

- POST is chosen when the record key is a tombstone value (null) or if no
  `sysId` field exists in the case that the key is a struct
- DELETE is chosen when the record value is a tombstone value (null)
- PUT is chosen when there is both a valid key and value in the record

<a id="servicenow-sink-supports-https-proxy"></a>

### Supports HTTPS proxy

The connector can connect to ServiceNow using an HTTPS proxy server.

<a id="servicenow-sink-result-reporting"></a>

### Result reporting

The connector supports result reporting. For the ServiceNow Sink connector, in
the case of a successful HTTP response, the connector will report to the
configured success topic a record with key as `sysId` of the newly created
ServiceNow table record and value as a Struct object with fields
`requestMethod`, `statusCode`, and `responseString`, where
`responseString` is the response body parsed as a string. In the case of a
non-successful HTTP response, the report record’s key will be the original
`sysId` provided and the value will be a Struct object with the above
described schema. Note that in the case of a failed POST request, there will be
no `sysId` to report.

<a id="servicenow-sink-http-basic-and-mtls"></a>

### HTTP Basic and Mutual TLS authentication

The ServiceNow Sink connector supports both [HTTP Basic
Authentication](/platform/current/security/basic-auth.html) and [mutual TLS
(mTLS)](/platform/current/security/authentication/overview.html#mutual-tls-mtls).

<a id="servicenow-sink-csfle-sm"></a>

### Client-side encryption

This connector supports Client-Side Field Level Encryption (CSFLE) and Client-Side Payload Encryption (CSPE). For more information, see [Manage Client-Side Encryption](https://docs.confluent.io/platform/current/connect/manage-csfle.html).

<a id="servicenow-sink-connector-limitations"></a>

## Limitations

The ServiceNow Sink connector requires a schema for the record value. The
connector uses the schema to build the request sent to the ServiceNow Table
API and can’t process record values that lack a schema.

Using a converter that doesn’t provide a schema, such as `JsonConverter`
with `schemas.enable` set to `false`, causes the connector to fail with
the following exception:

```text
org.apache.kafka.connect.errors.ConnectException: Record value is of
unsupported type
```

To provide a schema for the record value, use a schema-based converter, such
as `AvroConverter`, `ProtobufConverter`, or `JsonSchemaConverter`. If you
must use JSON, set `value.converter.schemas.enable` to `true` and include
the schema and payload in each record, as shown in [Write JSON message
values into ServiceNow](#servicenow-sink-connector-write-json).

<a id="servicenow-sink-connector-license"></a>

## License

You can use this connector for a 30-day trial period without a license key.

After 30 days, you must purchase a connector subscription which includes [Confluent enterprise license](/platform/current/installation/license.html#enterprise-subscription-license) keys to subscribers, along with [enterprise-level support](https://www.confluent.io/subscription/) for Confluent Platform and your connectors. If you are a subscriber, you can contact [Confluent Support](https://support.confluent.io/) for more information.

For license properties, see [Confluent Platform license](connector_config.md#servicenow-sink-connector-license-config). For
information about the license topic, see
[License topic configuration](connector_config.md#servicenow-sink-license-topic-configuration).

## Configuration Properties

For a complete list of configuration properties for this connector, see
[Configuration Reference for ServiceNow Sink Connector for Confluent Platform](connector_config.md#servicenow-sink-connector-config).

For an example of how to get Kafka Connect connected to [Confluent Cloud](/cloud/current/index.html), see
[Connect Self-Managed Kafka Connect to Confluent Cloud](/cloud/current/cp-component/connect-cloud-config.html#distributed-cluster).

<a id="servicenow-sink-connector-install"></a>

## Install the ServiceNow Sink Connector

You can install this connector by using the [Confluent Hub client installation
instructions](https://docs.confluent.io/home/connect/confluent-hub/client.html) or by manually
downloading the ZIP file.

<a id="servicenow-sink-connector-prereqs"></a>

### Prerequisites

#### IMPORTANT
You must install the connector on every machine where Connect will run.

- Kafka Broker: Confluent Platform 3.3.0 or later, or Kafka 0.11.0 or later.
- Connect: Confluent Platform 4.1.0 or later, or Kafka 1.1.0 or later.
- An installation of the [Confluent Hub Client](https://docs.confluent.io/home/connect/confluent-hub/client.html). This
  is installed by default with Confluent Enterprise.
- An installation of the latest (`latest`) connector version.

  To install the `latest` connector version, navigate to your Confluent Platform
  installation directory and run the following command:
  ```bash
  confluent-hub install confluentinc/kafka-connect-servicenow:latest
  ```

  You can install a specific version by replacing `latest` with a version
  number as shown in the following example:
  ```bash
  confluent-hub install confluentinc/kafka-connect-servicenow:2.6.0
  ```

### Install the connector manually

[Download and extract the ZIP file](https://www.confluent.io/hub/confluentinc/kafka-connect-servicenow) for your
connector and then follow the manual connector installation
[instructions](/kafka-connectors/self-managed/install.html).

<a id="servicenow-sink-connector-quickstart"></a>

## Quick Start

The quick start guide uses ServiceNow Sink connector to consume records from
Kafka and send them to a ServiceNow table. This guide assumes multi-tenant
environment is used. For local testing, refer to [Running
Connect in standalone mode](/kafka-connectors/self-managed/userguide.html#configuring-and-running-workers).

1. Create a table called `test_table` in ServiceNow.
   ![image](images/servicenow_create_table.png)
2. Define three columns in the table.
   ![image](images/servicenow_define_columns.png)
3. Install the connector through the [Confluent Hub Client](https://docs.confluent.io/current/connect/managing/confluent-hub/client.html).
   ```bash
   # run from your confluent platform installation directory
   confluent-hub install confluentinc/kafka-connect-servicenow:latest
   ```
4. Start the Confluent Platform.
   ```bash
   confluent local start
   ```
5. Check the status of all services.
   ```bash
   confluent local services status
   ```
6. Create a `servicenow-sink.json` file with the following contents:

   #### NOTE
   All user-defined tables in ServiceNow start with `u_`,

   ```bash
    // substitute <> with your config
    {
       "name": "ServiceNowSinkConnector",
       "config": {
           "connector.class": "io.confluent.connect.servicenow.ServiceNowSinkConnector",
           "topics": "test_table",
           "servicenow.url": "https://<endpoint>.service-now.com/",
           "tasks.max": "1",
           "servicenow.table": "u_test_table",
           "servicenow.user": "<username>",
           "servicenow.password": "<password>",
           "key.converter": "io.confluent.connect.avro.AvroConverter",
           "key.converter.schema.registry.url": "http://localhost:8081",
           "value.converter": "io.confluent.connect.avro.AvroConverter",
           "value.converter.schema.registry.url": "http://localhost:8081",
           "confluent.topic.bootstrap.servers": "localhost:9092",
           "confluent.license": "<license>", // leave it empty for evaluation license
           "confluent.topic.replication.factor": "1",
           "reporter.bootstrap.servers": "localhost:9092",
           "reporter.error.topic.name": "test-error",
           "reporter.error.topic.replication.factor": 1,
           "reporter.error.topic.key.format": "string",
           "reporter.error.topic.value.format": "string",
           "reporter.result.topic.name": "test-result",
           "reporter.result.topic.key.format": "string",
           "reporter.result.topic.value.format": "string",
           "reporter.result.topic.replication.factor": 1
       }
   }
   ```

   #### NOTE
   For details about using this connector with Kafka Connect Reporter, see
   [Connect
   Reporter](/kafka-connectors/self-managed/userguide.html#userguide-connect-reporter).
7. Load the ServiceNow Sink connector by posting configuration to Connect REST
   server.
   ```bash
   confluent local load ServiceNowSinkConnector --config servicenow-sink.json
   ```
8. Confirm that the connector is in a `RUNNING` state.
   ```bash
   confluent local status ServiceNowSinkConnector
   ```
9. To produce some records into the `test_table` topic, first start a Kafka producer.

   #### NOTE
   All user-defined columns in ServiceNow start with `u_`

   ```bash
   kafka-avro-console-producer \
   --broker-list localhost:9092 --topic test_table \
   --property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"u_name","type":"string"},
   {"name":"u_price", "type": "float"}, {"name":"u_quantity", "type": "int"}]}'
   ```
10. The console producer is now waiting for input, so you can go ahead and
    insert some records into the topic.
    ```json
    {"u_name": "scissors", "u_price": 2.75, "u_quantity": 3}
    {"u_name": "tape", "u_price": 0.99, "u_quantity": 10}
    {"u_name": "notebooks", "u_price": 1.99, "u_quantity": 5}
    ```
11. Confirm the messages were delivered to the ServiceNow table by using
    the ServiceNow user interface.
    ![image](images/servicenow_result.png)

<a id="servicenow-sink-connector-write-json"></a>

## Write JSON message values into ServiceNow

The example settings file is shown below.

#### IMPORTANT
The ServiceNow Sink connector requires a schema for the record value, so
`value.converter.schemas.enable` must be set to `true` and each record
must include both a `schema` and a `payload`, as shown in the following
example. Schemaless JSON (`schemas.enable` set to `false`) isn’t
supported and causes the connector to fail. For more information, see
[Limitations](#servicenow-sink-connector-limitations).

1. Create a `servicenow-sink-json.json` file with the following contents.

   #### NOTE
   All user-defined tables in ServiceNow start with `u_`

   ```bash
   // substitute <> with your config
   {
       "name": "ServiceNowSinkJSONConnector",
       "config": {
           "connector.class": "io.confluent.connect.servicenow.ServiceNowSinkConnector",
           "topics": "test_table_json",
           "servicenow.url": "https://<endpoint>.service-now.com/",
           "tasks.max": "1",
           "servicenow.table": "u_test_table",
           "servicenow.user": "<username>",
           "servicenow.password": "<password>",
           "key.converter":"org.apache.kafka.connect.storage.StringConverter",
           "value.converter":"org.apache.kafka.connect.json.JsonConverter",
           "value.converter.schemas.enable": "true",
           "confluent.topic.bootstrap.servers": "localhost:9092",
           "confluent.license": "<license>", // leave it empty for evaluation license
           "confluent.topic.replication.factor": "1",
           "reporter.bootstrap.servers": "localhost:9092",
           "reporter.error.topic.name": "test-error",
           "reporter.error.topic.replication.factor": 1,
           "reporter.error.topic.key.format": "string",
           "reporter.error.topic.value.format": "string",
           "reporter.result.topic.name": "test-result",
           "reporter.result.topic.key.format": "string",
           "reporter.result.topic.value.format": "string",
           "reporter.result.topic.replication.factor": 1
       }
   }
   ```

   #### NOTE
   For details about using this connector with Kafka Connect Reporter, see
   [Connect
   Reporter](/kafka-connectors/self-managed/userguide.html#userguide-connect-reporter).
2. Load the ServiceNow Sink connector by posting configuration to Connect REST
   server.
   ```bash
   confluent local load ServiceNowSinkJSONConnector --config servicenow-sink-json.json
   ```
3. Confirm that the connector is in a `RUNNING` state.
   ```bash
   confluent local status ServiceNowSinkJSONConnector
   ```
4. To produce some records into the `test_table_json` topic, first start a
   Kafka producer.

   #### NOTE
   All user-defined columns in ServiceNow start with `u_`

   ```bash
   kafka-console-producer \
   --broker-list localhost:9092 \
   --topic test_table_json
   ```
5. The console producer is now waiting for input, so you can go ahead and
   insert some records into the topic.
   ```json
   {"schema": {"type": "struct", "fields": [{"type": "string", "optional": false, "field": "u_name"},{"type": "float", "optional": false, "field": "u_price"}, {"type": "int64","optional":false,"field": "u_quantity"}],"optional": false,"name": "products"}, "payload": {"u_name": "laptop", "u_price": 999.50, "u_quantity": 3}}
   {"schema": {"type": "struct", "fields": [{"type": "string", "optional": false, "field": "u_name"},{"type": "float", "optional": false, "field": "u_price"}, {"type": "int64","optional":false,"field": "u_quantity"}],"optional": false,"name": "products"}, "payload": {"u_name": "pencil", "u_price": 0.99, "u_quantity": 10}}
   {"schema": {"type": "struct", "fields": [{"type": "string", "optional": false, "field": "u_name"},{"type": "float", "optional": false, "field": "u_price"}, {"type": "int64","optional":false,"field": "u_quantity"}],"optional": false,"name": "products"}, "payload": {"u_name": "pen", "u_price": 1.99, "u_quantity": 5}}
   ```
