Loading...
Loading...
Loading...
Special considerations apply when defining the success schema of a data action that returns data to an outbound dialing rule.
When constructing its output contact (success schema), it is imperative to nest properties when necessary. If an output field from /execute is a complex object, the corresponding property in the schema should be a nested schema, and not a string that assumes “flattened” output. Outbound already uses ?flatten=true to flatten output.
Un-nested property example
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"data.my data field": {
"type": "string",
}
}
}The above example specifies a “data.my data field” in the success schema of a data action. The resulting action won’t work if it used by an outbound dialing data action rule. Outbound will be unable to find the field in the /actions/{actionId}/execute response. It will skip calls with a result of ININ-OUTBOUND-RULE-ERROR-SKIPPED.
To avoid this problem, make “my data field” a nested property of the “data” field:
Properly nested example
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"my data field": {
"type": "string"
}
}
}
}
}In general, your output schema should have the same structure as the properties you care about getting back from the /execute request.
Consider this simple object, and how the output schema returns it:
A simple object
{
"foo": {
"bat": "bar"
}
}Output schema of simple object
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"foo": {
"type": "string"
}
}
}To make this compatible with Outbound, modify simple object’s output schema to nest the property:
Properly nested simple object
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"foo": {
"type": "object",
"properties": {
"bat": {
"type": "string"
}
}
}
}
}This schema will return:
{
"foo": {
"bat": "bar"
}
}If there are fields that your data action requires, mark those fields as required in the success schema.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"required": [
"contact_id",
"phone_number"
],
"properties": {
...
},
Get user feedback about articles.