Connections - Property Types
Overview
When defining an action for a custom connection, these types of properties are accepted:
- String.
- Integer.
- Number.
- Boolean.
- Array.
- Object.
- Not all of them can be defined on Talkdesk Studio™.
- The array and object types can only be used in the input and output schemas, not in the query params schema.
Regardless of the type of the property, two fields are mandatory when defining it within the schema:
type
- the type of the property, from the previous list.title
- the name of the property.
String
Apart from the mandatory fields, minLength
and maxLength
fields can be defined.
They indicate the min
and max
length for a string property, respectively.
"name": {
"type": "string",
"title": "Name of the User",
"minLenght": 2,
"maxLength": 60
}
Integer
Apart from the mandatory fields, minimum and maximum values can be defined for a string property (both values are included in the acceptable range of values).
"age": {
"type": "integer",
"title": "Age of the user",
"min": 0,
"max": 150
}
Number
The same as integer, but it also accepts decimal values.
In the example, the min
and max
examples have decimal values, but they could be integer values.
"weight": {
"type": "number",
"title": "Weight of the user",
"min": 0.1,
"max": 200.25
}
Boolean
Only the type
and title
are accepted in this type.
"active": {
"type": "boolean",
"title": "Indicates if an user is active"
}
Array
The definition of a property of the type array is a bit different as shown in the following code snippet.
Apart from the type
and title
, the items
field is required, which defines the type of object that will be received.
The example is for an array of strings, but it could be anything else, including an array of objects.
"cases": {
"type": "array",
"title": "A list of cases",
"items": {
"type": "string",
"title": "Name of a case"
}
}
Even though arrays can be configured in the input/output schema of an action, to use them it is necessary to use the
Run Function
Studio component.
Object
An object type is the same as the root object that has been sent, but with several levels.
If a schema is defined with no property of the type object, then the equivalent payload would be something like:
{
"name": "John Smith",
"age": 32,
"active": true,
"cases": ["Discovery of new world", "Discovery of new people", "Discovery of new realities"]
}
Property of the type object
{
"error": {
"reason": "Not at home",
"somethingElse": {
"example": 12,
"active": false
}
}
}
For this example, the corresponding schema would be:
"error": {
"type": "object",
"title": "Error Delivering",
"properties": {
"reason": {
"type": "string",
"title": "Reason for missing the delivery"
},
"somethingElse": {
"type": "object",
"title": "Title of something else",
"required": ["example"]
"properties": {
"example": {
"type": integer,
"title": "A simple example"
},
"active": {
"type": "boolean",
"title": "Is it active or not?"
}
}
}
}
}
All the property types that are defined in this page can be used within an object, even other objects.
The restrictions of length and value can also be applied, as well as the definition of required fields.
In the previous snippet, the somethingElse
object defined the example property as required.
Even though Studio supports complex objects, the user will not be able to directly map an internal object.
For instance, in the example above, you can map somethingElse.example
to a Studio context variable, but you can't map somethingElse
to anything.
Troubleshooting
If you have questions or technical issues, please open a ticket using this form.
Updated about 1 year ago