Input Binding
Last updated
Last updated
This section explains how to configure the Input Binding options for Variables and the Payload Constructor when setting up an API call. By properly configuring these elements, your API requests will include dynamic data derived from the conversation or procedure context.
The Input Binding section allows you to define the data that will be dynamically bound to your API requests. There are two key options for binding data:
Variables
Payload Constructor
These options ensure that your API requests include real-time, dynamic data based on user interactions or system-generated values.
Purpose:
Variables are placeholders that dynamically pull data from the conversation or procedure context. These represent real-time values (e.g., user ID, purchase date) that change based on user input or system events.
How to Configure Variables:
Build Variables in Context
Open the Input Binding Section:
In the API Call configuration screen, scroll down to the Input Binding section.
Select Variables:
From the dropdown, select Variables as the input binding option
Choose Variables from the Global Context or Conversation Context:
Global Context: Refers to data that is stored at the agent level and can be used across different procedures or conversations.
Conversation Context: Refers to data that is gathered during the specific conversation or interaction.
Select Specific Variables:
Check the boxes next to the variables that you want to include in the API request.
Dynamic Binding:
These variables will be dynamically inserted into the API request. For example, if you bind the userid
variable, the request will include the actual user ID value that was provided during the conversation.
Example Configuration for Variables:
If the conversation involves gathering user data to retrieve customer details, you might configure the following:
Variables: userid
, nama_lengkap
, nomor_telepon
These variables will automatically be filled with the user’s input and sent with the API request
Purpose:
The Payload Constructor allows you to structure the data that will be sent in the body of the API request. It maps the variables from the local procedure or global context to the correct fields in the API request payload.This way, when the request is sent, it includes the relevant data to complete the transaction or query. You would map these context variables to the appropriate fields in in the Payload Constructor to ensure that each request contains the correct.
How to Configure the Payload Constructor:
Select the Payload Constructor Option:
In the Input Binding section, select Payload Constructor from the dropdown.
Define the Payload Structure:
The payload should be formatted as a JSON object or other structured format required by the API. You will use variables from the local procedure context to fill the relevant fields.
Mapping Variables to the Payload:
Inside the payload constructor, map the conversation or procedure variables to the API fields. This ensures that the dynamic data from the current interaction or procedure is correctly formatted for the API request.
Example Payload Structure: Here’s how you might configure a payload for submitting a claim:
userid
: Pulls the unique user ID.
kode_barang
: Pulls the product code.
tanggal_pembelian
: Pulls the purchase date.
For example, if the system needs to send a claim request, the user_id, tanggal_pembelian, and kode_barang can be dynamically bound to the request payload.
Payload Auto-Binding:
The variables will dynamically bind to the payload when the API call is made. The values will be pulled from the local procedure context to ensure they reflect the real-time inputs of the current procedure.