Implementation

Set up a static or external response for your data request in your NLX workspace

What's the Implementation of a Data request?

A Data request's Implementation is where you'll set up a static response or external integration for your Data request. When a user arrives at a Data request node in a flow, it triggers the static response or HTTP method for engaging with your data.

Once invoked using a Data request node in your flow, information from your data source can then be relayed in messaging or used in conditional logic in subsequent nodes of the flow.

Implementation tab of a Data request

External implementation

External mode is used when data is hosted externally and can be reached through API:

  • Set the implementation toggle to External

  • Select the appropriate HTTP method from the Method dropdown

  • Expand endpoint section > Enter the URL

  • Use NLX's AWS CloudFormation template provided within the Instructions section

  • Click Save

Whether you have sensitive data or frequently enter the same URL string, try setting up a Secret in your workspace for enhanced security and efficiency.

Optional:

  • Headers: expand section > Click + Add header > Enter the Name and static Value to be sent with the request. Useful for custom headers such as an API key, content type, content length, etc.

  • Dynamic: Enabling the toggle allows you to view the header and provide it a custom value on the Data request node's side panel when referencing information from a Data request in a flow

  • Development endpoint: For situations where multiple URLs are used by the environment


Static response

Static mode is used in cases where the response is unchanging, which may be particularly useful for building demos or for early testing. Switch the implementation's toggle to Static to begin:

  • Enter the data array or objects in JSON structure

  • Click Save


Production and Development environments

Data requests can be configured with two different endpoints to allow for better flexibility and control during testing and development of your applications. Either setup allows you to change the URL, URL parameters, and Headers for each:

To swap from Production to Development environment while testing in your NLX workspace, select the settings gear from your Test widget and choose Development in the Environment dropdown:

Configure environments while testing conversations or flows

API spec

HTTP payloads that are delivered to your Data request's configured URL endpoint contain several headers, including:

Header
Value
Description

Content-Type

application/json

The only content type currently supported is JSON

nlx-webhook-version

v3

The version associated with the data request configuration

x-nlx-botId

<uuid>

A unique identifier of an application

x-nlx-channelId

<uuid>

A unique identifier of the channel associated with an application

x-nlx-channelType

string

A human friendly label indicating the channel type in use such as API, AmazonChime or Genesys

x-nlx-conversationId

<uuid>

A unique identifier of the conversation that triggered this data request

x-nlx-correlationId

<uuid>

A unique identifier that can be used for debugging

x-nlx-deploymentKey

<uuid>

A unique identifier of the deployment associated with the application

x-nlx-intentId

string

The intent ID from where the data request has triggered

x-nlx-languageCode

string

The application's language code used in the current conversation

x-nlx-userId

string

A user identifier such as a E.164 format phone number, UUID or other formats depending on the channel type.

The body of the request your API receives may contain the conversation context (nlx_context) if the send context option is enabled in the data request settings. It will always include the properties defined in the Data request's request model.

Name
Type
Description

nlx_context

object

The conversation context containing essential values such as the conversationId and any context variables that have been set up to this point in the conversation

nlx_context.botId

string

A unique identifier of the application

nlx_context.channelType

string

A human friendly label indicating the channel type in use such as API, AmazonChime or Genesys

nlx_context.channelId

string

A unique identifier of the channel associated with the application

nlx_context.conversationId

string

A unique identifier of the conversation that triggered this data request

nlx_context.languageCode

string

The application's language code used in the current conversation

nlx_context.<attributeName>

string, number or boolean

A set value of a custom context attribute. The attribute name can be an alphanumeric string with dashes and underscores

<propertyName>

any

One or more set values corresponding to the schema defined in the data request's request model

The response body of your Data request should include the properties defined by the response model. Optionally, it can include the context object:

Name
Type
Description

context

object

A map of key value pairs that you would like to be set as context attributes

context.<attributeName>

string, number or boolean

A set value of a custom context attribute. The attribute name can be an alphanumeric string with dashes and underscores

<propertyName>

any

One or more set values corresponding to the schema defined in the data request's response model

For example, the response body of a Data request may look like this:

{
    "Profile": {
        "FirstName": "Alice",
        "Preferences": ["window seat", "aisle seat"]
    }
}

Last updated