Implementation
Set up a static or external response for your data request in your NLX workspace
Last updated
Set up a static or external response for your data request in your NLX workspace
Last updated
Implementation is where you'll set up a static response or external webhook/API for your data request. When a user arrives at a Data request node in an intent flow, it triggers the static response or HTTP method for engaging your data to be brought into the conversation.
Once invoked using a Data request node in your intent flow, information from your data source can then be relayed in messaging or used in conditional logic in subsequent nodes of the flow.
To access this feature, click the Implementation tab of your data request:
External mode is used when data is hosted externally and when a specific API/webhook can be reached through a URL:
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 parameter in your workspace for enhanced security and efficiency.
Optional setup
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 the data request in an intent flow
Development endpoint: For situations where multiple URLs are used by the environment
Now that your implementation setup is complete, you may move on to configuring your request and/or response models.
Static mode is used in cases where the data 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
Now that your implementation setup is complete, you may move on to configuring your request and/or response models.
HTTP payloads that are delivered to your data request's configured URL endpoint will contain several headers, including:
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 the bot.
x-nlx-channelId
<uuid>
A unique identifier of the channel associated with the bot.
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-deploymentKey
<uuid>
A unique identifier of the deployment associated with the bot.
x-nlx-intentId
string
The intent ID from where the data request has triggered.
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 webhook will receive 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.
nlx_context
object
The conversation context containing essential values such as the conversationId
and any context attributes that have been set up to this point in the conversation.
nlx_context.botId
string
A unique identifier of the bot.
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 bot.
nlx_context.conversationId
string
A unique identifier of the conversation that triggered this data request.
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:
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: