{
  "name": "sample-connect-code-engine-fun-action",
  "type": "action",
  "valid": true,
  "status": "Available",
  "created": "2024-05-13T08:51:33.885Z",
  "updated": "2024-05-13T11:59:45.754Z",
  "language": "en",
  "skill_id": "226f36e9-2be7-4f49-96d6-fb22cb2646cd",
  "workspace": {
    "actions": [
      {
        "type": "standard",
        "steps": [
          {
            "step": "step_695",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text_expression": {
                        "concat": [
                          {
                            "scalar": "Enter first name:"
                          }
                        ]
                      }
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "question": {
              "free_text": true
            },
            "resolver": {
              "type": "continue"
            },
            "variable": "step_695",
            "next_step": "step_904"
          },
          {
            "step": "step_904",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text_expression": {
                        "concat": [
                          {
                            "scalar": "Enter last name:"
                          }
                        ]
                      }
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "question": {
              "free_text": true
            },
            "resolver": {
              "type": "continue"
            },
            "variable": "step_904",
            "next_step": "step_460"
          },
          {
            "step": "step_460",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text_expression": {
                        "concat": [
                          {
                            "scalar": "Invoking extension to Code engine function..."
                          }
                        ]
                      }
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "callout",
              "callout": {
                "path": "/",
                "type": "integration_interaction",
                "method": "POST",
                "internal": {
                  "spec_hash_id": "f4950e52962186b7d154657356da9422e8bd84c960e282d5aebbeb37b7b90731",
                  "catalog_item_id": "ce3cd44d-8e68-456c-8958-cfcf79473721"
                },
                "request_mapping": {
                  "query": [
                    {
                      "value": {
                        "variable": "step_695"
                      },
                      "parameter": "first_name"
                    },
                    {
                      "value": {
                        "variable": "step_904"
                      },
                      "parameter": "last_name"
                    }
                  ]
                },
                "result_variable": "step_460_result_1"
              }
            },
            "variable": "step_460",
            "next_step": "step_625"
          },
          {
            "step": "step_625",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text_expression": {
                        "concat": [
                          {
                            "scalar": "**Response from extension:**\n\nMethod: "
                          },
                          {
                            "variable": "step_460_result_1",
                            "variable_path": "body.__ce_method"
                          },
                          {
                            "scalar": "\n\nFirst name: "
                          },
                          {
                            "variable": "step_460_result_1",
                            "variable_path": "body.first_name"
                          },
                          {
                            "scalar": "\n\nLast name: "
                          },
                          {
                            "variable": "step_460_result_1",
                            "variable_path": "body.last_name"
                          }
                        ]
                      }
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "context": {
              "variables": []
            },
            "handlers": [],
            "resolver": {
              "type": "end_action"
            },
            "variable": "step_625",
            "condition": {
              "eq": [
                {
                  "variable": "step_460_result_1",
                  "variable_path": "success"
                },
                {
                  "scalar": true
                }
              ]
            },
            "next_step": "step_641"
          },
          {
            "step": "step_641",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text_expression": {
                        "concat": [
                          {
                            "scalar": "Some error occurred while calling the extension! Please inspect & fix the issue."
                          }
                        ]
                      }
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "end_action"
            },
            "variable": "step_641",
            "condition": {
              "eq": [
                {
                  "variable": "step_460_result_1",
                  "variable_path": "success"
                },
                {
                  "scalar": false
                }
              ]
            }
          }
        ],
        "title": "invoke code engine function",
        "action": "action_24797",
        "boosts": [],
        "handlers": [],
        "condition": {
          "intent": "action_24797_intent_38855"
        },
        "variables": [
          {
            "title": "Invoking extension to Code engine function...",
            "privacy": {
              "enabled": false
            },
            "variable": "step_460",
            "data_type": "any"
          },
          {
            "privacy": {
              "enabled": false
            },
            "variable": "step_460_result_1",
            "data_type": "any"
          },
          {
            "title": "**Response from extension:** Method: {variable} First name: {var",
            "privacy": {
              "enabled": false
            },
            "variable": "step_625",
            "data_type": "any"
          },
          {
            "title": "Some error occurred while calling the extension! Please inspect ",
            "privacy": {
              "enabled": false
            },
            "variable": "step_641",
            "data_type": "any"
          },
          {
            "title": "Enter first name:",
            "privacy": {
              "enabled": false
            },
            "variable": "step_695",
            "data_type": "any"
          },
          {
            "title": "Enter last name:",
            "privacy": {
              "enabled": false
            },
            "variable": "step_904",
            "data_type": "any"
          }
        ],
        "launch_mode": "learning",
        "next_action": "fallback",
        "topic_switch": {
          "allowed_from": true,
          "allowed_into": true,
          "never_return": false
        },
        "disambiguation_opt_out": false
      },
      {
        "type": "standard",
        "steps": [
          {
            "step": "step_001",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": "I'm afraid I don't understand. Please rephrase your question."
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "end_action"
            },
            "variable": "step_001",
            "condition": {
              "lte": [
                {
                  "system_variable": "no_action_matches_count"
                },
                {
                  "scalar": 3
                }
              ]
            },
            "next_step": "step_002"
          },
          {
            "step": "step_002",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": ""
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "invoke_another_action_and_end",
              "invoke_action": {
                "action": "fallback",
                "policy": "default",
                "parameters": null,
                "result_variable": "step_002_result_1"
              }
            },
            "variable": "step_002",
            "condition": {
              "gt": [
                {
                  "system_variable": "no_action_matches_count"
                },
                {
                  "scalar": 3
                }
              ]
            }
          }
        ],
        "title": "No matches",
        "action": "anything_else",
        "boosts": [],
        "handlers": [],
        "condition": {
          "expression": "anything_else"
        },
        "variables": [
          {
            "title": "I am afraid I do not understand what you are asking, please re-p",
            "variable": "step_001",
            "data_type": "any"
          },
          {
            "variable": "step_002",
            "data_type": "any"
          },
          {
            "variable": "step_002_result_1",
            "data_type": "any"
          }
        ],
        "disambiguation_opt_out": true
      },
      {
        "type": "standard",
        "steps": [
          {
            "step": "digression_failure",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": "Sorry I couldn't confirm if you wanted to return to previous topic, let me connect to an agent."
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "connect_to_agent",
              "response": {
                "transfer_info": {
                  "target": {}
                },
                "agent_available": {
                  "message": "Let's send you to an available agent."
                },
                "agent_unavailable": {
                  "message": "There are no agents available at this time. When one becomes available, we'll connect you."
                },
                "message_to_human_agent": ""
              }
            },
            "variable": "digression_failure",
            "condition": {
              "eq": [
                {
                  "system_variable": "fallback_reason"
                },
                {
                  "scalar": "Failed to confirm topic return"
                }
              ]
            },
            "next_step": "step_001"
          },
          {
            "step": "step_001",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": "I'm afraid I don't understand. I can connect you to an agent."
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "connect_to_agent",
              "response": {
                "transfer_info": {
                  "target": {}
                },
                "agent_available": {
                  "message": "Let's send you to an available agent."
                },
                "agent_unavailable": {
                  "message": "There are no agents available at this time. When one becomes available, we'll connect you."
                },
                "message_to_human_agent": ""
              }
            },
            "variable": "step_001",
            "condition": {
              "eq": [
                {
                  "system_variable": "fallback_reason"
                },
                {
                  "scalar": "Step validation failed"
                }
              ]
            },
            "next_step": "step_002"
          },
          {
            "step": "step_002",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": "Sorry I couldn't assist you. I will connect you to an agent right away."
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "connect_to_agent",
              "response": {
                "transfer_info": {
                  "target": {}
                },
                "agent_available": {
                  "message": "Let's send you to an available agent."
                },
                "agent_unavailable": {
                  "message": "There are no agents available at this time. When one becomes available, we'll connect you."
                },
                "message_to_human_agent": ""
              }
            },
            "variable": "step_002",
            "condition": {
              "eq": [
                {
                  "system_variable": "fallback_reason"
                },
                {
                  "scalar": "Agent requested"
                }
              ]
            },
            "next_step": "step_003"
          },
          {
            "step": "step_003",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": "I am afraid I do not understand what you are asking, let me connect you to an agent."
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "connect_to_agent",
              "response": {
                "transfer_info": {
                  "target": {}
                },
                "agent_available": {
                  "message": "Let's send you to an available agent."
                },
                "agent_unavailable": {
                  "message": "There are no agents available at this time. When one becomes available, we'll connect you."
                },
                "message_to_human_agent": ""
              }
            },
            "variable": "step_003",
            "condition": {
              "eq": [
                {
                  "system_variable": "fallback_reason"
                },
                {
                  "scalar": "No action matches"
                }
              ]
            },
            "next_step": "step_004"
          },
          {
            "step": "step_004",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": "It seems this conversation would be best managed by a human agent. Let me connect you to one of our agents."
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "connect_to_agent",
              "response": {
                "transfer_info": {
                  "target": {}
                },
                "agent_available": {
                  "message": "Let's send you to an available agent."
                },
                "agent_unavailable": {
                  "message": "There are no agents available at this time. When one becomes available, we'll connect you."
                },
                "message_to_human_agent": ""
              }
            },
            "variable": "step_004",
            "condition": {
              "eq": [
                {
                  "system_variable": "fallback_reason"
                },
                {
                  "scalar": "Danger word detected"
                }
              ]
            },
            "next_step": "step_005"
          },
          {
            "step": "step_005",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": "It seems this conversation would be best managed by a human agent. Let me connect you to one of our agents."
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "connect_to_agent",
              "response": {
                "transfer_info": {
                  "target": {}
                },
                "agent_available": {
                  "message": "Let's send you to an available agent."
                },
                "agent_unavailable": {
                  "message": "There are no agents available at this time. When one becomes available, we'll connect you."
                },
                "message_to_human_agent": ""
              }
            },
            "variable": "step_005",
            "condition": {
              "eq": [
                {
                  "system_variable": "fallback_reason"
                },
                {
                  "scalar": "Profanity detected"
                }
              ]
            }
          }
        ],
        "title": "Fallback",
        "action": "fallback",
        "boosts": [],
        "handlers": [],
        "condition": {
          "intent": "fallback_connect_to_agent"
        },
        "variables": [
          {
            "title": "Topic return failed",
            "variable": "digression_failure",
            "data_type": "any"
          },
          {
            "title": "I'm afraid I don't understand. I can connect you to an agent.",
            "variable": "step_001",
            "data_type": "any"
          },
          {
            "title": "Sorry I couldn't assist you. I will connect you to an agent righ",
            "variable": "step_002",
            "data_type": "any"
          },
          {
            "title": "I am afraid I do not understand what you are asking, let me conn",
            "variable": "step_003",
            "data_type": "any"
          },
          {
            "title": "It seems this conversation would be best managed",
            "variable": "step_004",
            "data_type": "any"
          },
          {
            "title": "Profanity - It seems this conversation",
            "variable": "step_005",
            "data_type": "any"
          }
        ],
        "next_action": "run_always",
        "disambiguation_opt_out": true
      },
      {
        "type": "standard",
        "steps": [
          {
            "step": "danger_word_detected",
            "title": "Connect to agent",
            "handlers": [],
            "resolver": {
              "type": "fallback"
            },
            "variable": "danger_word_detected_variable",
            "condition": {
              "entity": "danger_words"
            },
            "next_step": "profanity_detected"
          },
          {
            "step": "profanity_detected",
            "title": "Show warning",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text_expression": {
                        "concat": [
                          {
                            "scalar": "Please use appropriate language when interacting with the assistant."
                          }
                        ]
                      }
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [
              {
                "type": "max_hits",
                "handler": "max_hits_handler",
                "resolver": {
                  "type": "fallback"
                }
              }
            ],
            "max_hits": 2,
            "resolver": {
              "type": "end_action"
            },
            "variable": "profanity_detected_variable",
            "condition": {
              "entity": "profane_words"
            }
          }
        ],
        "title": "Trigger word detected",
        "action": "run_always",
        "boosts": [],
        "handlers": [],
        "variables": [
          {
            "title": "Profanity detected",
            "variable": "danger_word_detected_variable",
            "data_type": "any"
          },
          {
            "title": "Profane word detected",
            "variable": "profanity_detected_variable",
            "data_type": "any"
          }
        ],
        "next_action": "anything_else"
      },
      {
        "type": "standard",
        "steps": [
          {
            "step": "step_001",
            "output": {
              "generic": [
                {
                  "values": [
                    {
                      "text": "Welcome, how can I assist you?"
                    }
                  ],
                  "response_type": "text",
                  "selection_policy": "sequential"
                }
              ]
            },
            "handlers": [],
            "resolver": {
              "type": "end_action"
            },
            "variable": "step_001"
          }
        ],
        "title": "Greet customer",
        "action": "welcome",
        "boosts": [],
        "handlers": [],
        "condition": {
          "expression": "welcome"
        },
        "variables": [
          {
            "variable": "step_001",
            "data_type": "any"
          }
        ],
        "next_action": "action_24797",
        "disambiguation_opt_out": true
      }
    ],
    "intents": [
      {
        "intent": "action_24797_intent_38855",
        "examples": [
          {
            "text": "call code engine"
          },
          {
            "text": "invoke"
          },
          {
            "text": "invoke ce"
          },
          {
            "text": "invoke code engine function"
          }
        ]
      },
      {
        "intent": "fallback_connect_to_agent",
        "examples": [
          {
            "text": "Agent help"
          },
          {
            "text": "Call agent"
          },
          {
            "text": "Can I connect to an agent?"
          },
          {
            "text": "I would like to speak to a human"
          },
          {
            "text": "I would like to speak to someone"
          }
        ],
        "description": "Please transfer me to an agent"
      }
    ],
    "entities": [
      {
        "entity": "danger_words",
        "values": [],
        "fuzzy_match": false
      },
      {
        "entity": "profane_words",
        "values": [],
        "fuzzy_match": false
      },
      {
        "entity": "sys-yes-no",
        "values": []
      }
    ],
    "metadata": {
      "api_version": {
        "major_version": "v2",
        "minor_version": "2018-11-08"
      }
    },
    "variables": [],
    "data_types": [],
    "collections": [],
    "counterexamples": [],
    "system_settings": {
      "nlp": {
        "model": "latest"
      },
      "variable": {
        "format": {
          "time": {
            "pattern": "short"
          },
          "currency": {
            "fraction_digits": 2
          }
        }
      },
      "off_topic": {
        "enabled": true
      },
      "auto_learn": {
        "apply": true
      },
      "launch_mode": {
        "default": "learning",
        "enabled": false,
        "learning": {
          "step_retry_threshold": 2,
          "use_connect_to_support": "more_often",
          "single_answer_clarification": "more_often",
          "disambiguation_clarification": "more_often"
        },
        "confident": {
          "step_retry_threshold": 4,
          "use_connect_to_support": "sometimes",
          "single_answer_clarification": "sometimes",
          "disambiguation_clarification": "sometimes"
        }
      },
      "topic_switch": {
        "enabled": true,
        "messages": {
          "enable_confirmation": true,
          "confirmation_failure": {
            "generic": [
              {
                "values": [
                  {
                    "text_expression": {
                      "concat": [
                        {
                          "scalar": "I'm sorry, I did not catch that, please confirm."
                        }
                      ]
                    }
                  }
                ],
                "response_type": "text",
                "selection_policy": "sequential"
              }
            ]
          },
          "confirmation_request": {
            "generic": [
              {
                "values": [
                  {
                    "text_expression": {
                      "concat": [
                        {
                          "scalar": "Do you want to continue with the previous topic: "
                        },
                        {
                          "system_variable": "digressed_from"
                        },
                        {
                          "scalar": "?"
                        }
                      ]
                    }
                  }
                ],
                "response_type": "text",
                "selection_policy": "sequential"
              },
              {
                "options": [
                  {
                    "label": "Yes",
                    "value": {
                      "input": {
                        "text": "Yes"
                      }
                    }
                  },
                  {
                    "label": "No",
                    "value": {
                      "input": {
                        "text": "No"
                      }
                    }
                  }
                ],
                "response_type": "option",
                "repeat_on_reprompt": true
              }
            ]
          }
        },
        "max_tries": 3
      },
      "generative_ai": {
        "slot_filling": {
          "enabled": false
        }
      },
      "disambiguation": {
        "prompt": "Did you mean:",
        "enabled": true,
        "randomize": true,
        "max_suggestions": 5,
        "suggestion_text_policy": "title",
        "none_of_the_above_prompt": "None of the above",
        "use_connect_to_support_prompt": "Connect to support",
        "single_answer_clarification_prompt": "Something else"
      },
      "search_routing": {
        "target": "conversational_search"
      },
      "spelling_auto_correct": false
    },
    "learning_opt_out": false
  },
  "description": "created for assistant 75e6d427-89f0-4ecf-8460-eb4c97826ee6",
  "assistant_id": "75e6d427-89f0-4ecf-8460-eb4c97826ee6",
  "workspace_id": "226f36e9-2be7-4f49-96d6-fb22cb2646cd",
  "dialog_settings": {},
  "next_snapshot_version": "1",
  "environment_id": "0bccc38e-28c0-4a7c-b4ae-80a5f3adee56"
}