REST API
REST API documentation for NLX's API communication channel
Last updated
REST API documentation for NLX's API communication channel
Last updated
The API key and deployed URL can be found by navigating to your application's deployment:
Navigate to Applications in workspace menu > Select application
Choose your application's Deployment tab
Click Details on the latest deployment
Expand the Setup instructions for the API channel
Copy the Application URL and API key
Modalities that have been set on a conversation flow node will come back in the response under the modalities
property as an object where each key is the name of the modality you have created.
For example, if you wanted to display a video as a message within your client application, you could define a Video modality like so:
When the conversation reaches the node where the Video modality is enabled, the API response may contain the following:
The modalities can then be interpreted by the client application and a video may be displayed.
A node payload that has been set on a conversation flow node will come back in the response under the payload
property as a string.
For example, if you wanted to apply a confetti effect to the client application upon completing a purchase, you could send the following payload:
When the conversation reaches the last node where the node payload is set, the API response may contain the following:
The payload can then be interpreted by the client application and a confetti effect could be triggered along with the confirmation message.
Custom slot values can contain a predefined choice payload, which can be especially useful to sort values within your client application.
For example, assume you want to display a list of 10 countries for the end user to choose from. But, you have a slot value called "Other" which needs to always appear last in the list, no matter the language your application is using, while the rest of the values follow an alphabetical order. You could add isLastValue
to the choice payload field of the custom slot value:
When a conversation reaches a User choice node (make sure the Show choices toggle is on) with a custom slot that contains a choice payload for at least one of the values, the API response may contain the following:
Within your client application, you could sort the choices
array and always have the value with choicePayload=isLastValue
appended at the end of the list, no matter what the choiceText
value is.
Context variables that have been set throughout the course of a conversation can be appended to the API response any time the Send context functionality is enabled on a conversation flow node. The context will come back in the response under the context
property like so:
The ID of the deployment.
The ID of the channel.
Unique ID for the conversation. / It will be auto-generated if not provided.
ID for the user. / It will be auto-generated if not provided.