Add External REST API in Sprinklr

Updated 

Sprinklr enables you to configure external REST APIs directly within its platform, removing the need for custom development. The External API module provides the flexibility to switch between SOAP and REST API protocols.

This guide will walk you through the process of connecting a REST External API in Sprinklr, along with detailed instructions on how to test, edit, and delete a REST API connection.

Once configured, you can call third-party (external) APIs during workflow execution across various capabilities such as Bots, Guided Workflows, Agent Consoles, Care Consoles, Automation, and more. This new feature enhances automation and eliminates manual processes, boosting productivity.

Note: Configuration is required. Please contact the Managed Services team for further assistance.

Prerequisites

You need to add an External Authentication Credential in Sprinklr. For more information, refer to Add an External Authentication Credential in Sprinklr.

Note:

  • For static APIs, external authentication credentials are not required.

  • You can register an External API in Sprinklr only if you are a Global Admin or Global User.

  • If you are an administrator and wish to grant users permission to add an external API, create a role with the following permissions and assign it to the correct user or user group.

Add an External REST API

Follow these steps to configure external REST API in Sprinklr:

Step 1: Access External API Module

  • Click the New Tab Space Add New Tab Icon icon . 

  • Under the Platform Module, click All Settings within Listen.

  • In the Platform Settings window, click Manage Customer in the left pane and select External API from the list of options in the right pane. You can also search for it using the search bar.

Step 2: Choose the REST API Tab

  • On the External API's dashboard, you will see tabs for different API protocols at the top left. Select the REST API tab to switch to the REST API record manager.

  • Here, you will see a list of all existing REST APIs that have been configured.

Step 3: Add a New REST API

  • Click the "Add External API" button located at the top right corner of the page to create a new REST API configuration.

  • Select the "Using Open API Spec" option from the drop-down menu. A validation screen will open after the click.

Step 4: Validate REST API Details

On the validation screen, configure the API details.


Below is the breakdown of required fields:

Name

Description

External Service Name

Enter the name of the external service.

Description (optional)

Provide a description for the external service.

Authentication Credential

Enter the required authentication credential.

Endpoint URL

Enter the URL of the REST API endpoint. This URL will override the URL configured in OpenAPI Spec document.

PCI (Checkbox)

Select this checkbox to indicate that the API handles PCI-sensitive data.

OpenAPI Specification

Enter the service schema in JSON format.

In the 18.2 release, we introduced a tool to convert Postman response collections to OpenAPI specs for testing APIs on the platform. Follow these steps:

1.At the bottom of the configuration page, click Convert Postman Collection to OpenAPI spec.

2.Enter either the Postman collection URL or the Postman collection JSON script.

3.Insert the JSON and click Convert.

4.The Postman response will be successfully converted to OpenAPI spec with a confirmation message.

5.Click Validate in the bottom right corner of the External API window.

6.After validating the OpenAPI, you can view and verify the endpoint details fetched by the API.

Click the "Validate" button after entering all the necessary information. This will validate the REST API specification to ensure everything is correctly configured.

Step 5: Add Additional Information of REST API

After successfully validating the REST API, the API name will appear in the left-hand menu. Click on the API connection name to open a detailed configuration screen where you can define additional elements for the REST API.

These fields provide flexibility, enabling you to tailor how you interact with the REST API, from sending requests to processing responses.

Name

Description

Headers

Define custom headers to be sent with the API request.

  • Field: Name of the header (e.g., Authorization, Content-Type).

  • Type: Data type for the header value (e.g., String).

    Supported data types include String, Integer, Number, Boolean, Object, and Form.

  • Required: Indicates whether the header is mandatory for the request to execute.

  • Default: Optional default value.

Endpoint URL

Enter the base URL of the REST API endpoint.

Path Parameter

Used to define dynamic segments of the URL path (e.g., /users/{userId}).

  • Field: The name of the path parameter (e.g., userId).

  • Type: Accepted data type (e.g., String, Integer).

    Supported data types include String, Integer, Number, Boolean, Object, and Form.

  • Required: Specifies if this parameter must be provided.

  • Default: Optional fallback value if not supplied during execution.

Query Parameter

Key-value pairs appended to the endpoint URL (e.g., ?contactId=123).

  • Field: Name of the query parameter (e.g., contactId).

  • Type: Supported types include String, Integer, Number, Boolean, Object, Form.

  • Required: Indicates whether the parameter is required.

  • Default: Default value to be used if no input is provided.

Request Body

Defines the structure of the payload sent in the request body (typically for POST/PUT methods).

  • Field: Name of the field in the body.

  • Type: Data type for the field value.

    Supported data types include String, Integer, Number, Boolean, Object, and Form.

  • Multivalued: Specify Yes if the field supports multiple values (array); otherwise, No.

  • Required: Marks the field as mandatory or optional.

  • Default: Default value, if applicable.

Timeout Settings

You can configure custom timeout and retry parameters for External API extensions in the Timeout Settings input pane. These settings allow you to control the behavior of API calls based on your system’s reliability and performance requirements.

Available Configuration Parameters

  • Maximum Retry Attempts: Specifies the maximum number of times the system should retry a failed API request.

  • Retry Backoff Factor: Defines the multiplier applied to the delay between successive retry attempts.

  • Retry Interval (Milliseconds): Sets the initial wait time (in milliseconds) before the first retry attempt is made.

  • Connection Timeout (Milliseconds): Determines the maximum duration (in milliseconds) to wait while establishing a connection to the external API.

  • Read Timeout (Milliseconds): Specifies the maximum time (in milliseconds) to wait for a response after a successful connection is established.

These configurable parameters offer improved control and fault tolerance—particularly useful in environments with high latency or intermittent connectivity.

Request Adapter

A transformation layer that allows you to format or modify the request payload before it's sent to the API.

Response Adapter

Processes and transforms the API response before it is consumed within the platform.

Parameter Adapter

Dynamically transforms or maps query/path parameters before the request is executed.

Header Adapter

Enables dynamic generation or transformation of request headers.

Request via Proxy (Checkbox)

Enable this option to route the API request through a proxy server. Ensure that the Sprinklr Static IP Addresses for Receiving API Calls are whitelisted.

Proxy Host

Enter the hostname or IP address of the proxy server.

Required only if Request via Proxy is enabled.

Proxy Port

Enter the port number used by the proxy server to route the request.

Click ‘Save’ after configuring all the elements with the required data. Your SOAP API connection has been successfully created.

Automated Groovy Generator for REST API

In 19.8 release, we have introduced an Automated Groovy Generator that streamlines the process of configuring REST-based external APIs by automatically generating the necessary Groovy script for request adapters.

How it Works?

When configuring a REST API, you can use the Generate Adapter button. Upon clicking this button, the system will automatically generate the Groovy script tailored to your specific API configuration. This script will then be directly pasted into the request adapter text box, eliminating the need for manual coding.

Groovy generator.

This feature enhances the overall user experience by making REST API configuration more efficient and less prone to manual errors.

Bulk Import REST API Endpoints

To import REST API endpoints in bulk, follow these steps:

  • In the record manager, click the + Import button at the top.

  • In the pop-up window, either drag and drop your file or click Browse to upload it from your local machine.

    Supported file formats: .json, .jsonl

  • After uploading the file, click Submit.

  • A confirmation message will appear once the endpoints are successfully imported.

Bulk Export REST API Endpoints

To export REST API endpoints in bulk, follow these steps:

  1. In the record manager, select the API endpoints you want to export by checking the box next to each API name.

    • To select all endpoints, use the checkbox at the top of the list.

  2. Click the Export button located on the black action bar at the bottom of the screen.

  3. A notification will confirm that your export request has been received.

4. Once the export is complete, you will receive a download link in your Sprinklr Notification Center.