Kata Documentations
Username
Kata Platform Documentations
Introduction
What is Kata Platform
Benefits with Kata Platform
Kata Platform Features
Use Case
All Use Cases
Documentation Content

How-to Guides

FAQs
General FAQs
Bot Development FAQs
Glossary
General
Kata Platform
Inside Kata Flow
Coming Soon
Release Notes

Using Async API to Access Third-Party Application

In this guidance, you will be able to implement a bot that uses an action type Async API. Async API is used to make the response API send via command without waiting for the API results to move to the next state (a more seamless API call process).

Introduction

For using an API to access third-party applications from your chatbot, you will need to create an action API. Also, a state must be created before creating an action

How to Use

In this guidance, you will learn how to integrate NLU in your chatbot to recognize specific end-users input. Before you start, you will need to create at least one entity and it is already trained.

  1. Go to your project, then click Flow.
  2. Create a state, for example a apiExample state. Click + icon in bottom right to create new state
  3. Click + in the action box to create a new action.
  4. When all actions available are shown, then choose API
  5. Click tab Async API

Each field explanation:

Field Name
Description
Action name Name of your action. Max. 30 characters with alphanumeric.
Condition Which condition can trigger this action
URI Your API URL
Method Choose POST or GET
Body Input API body by creating key and value.
Headers Input API headers by creating key and value.
Headers Input API headers by creating key and value.
Query -
Form Data -
Result Path -
Command The API result will be sent to command.
  1. Click the Create Action button to create action.
  2. Click the Create to finalize state creation.

How to Collect Async API Result

If you want to collect API results, you just need to create an Intent to receive results from Command. For example:

Image 1 Alt
Figure 1Example of Intent Command type with the condition to get the API result

To access the value, the API result can be stored in payload, then you can access it by writing payload. For example:

Image 2 Alt
Figure 2Example of the API result storage in payload
todoList:
  active: true
  volatile: true
  intents:
    todoListIntent:
      type: text
      initial: true
      fallback: false
      condition: 'content === "#todoList"'
    freeTextIntent:
      type: text
      initial: false
      fallback: false
    apiResultIntent:
      type: command
      initial: true
      fallback: false
      condition: 'content === "apiResult"'
  states:
    init:
      transitions:
        inputTask:
          condition: 'intent === "todoListIntent"'
        apiResultState:
          condition: 'intent === "apiResultIntent"'
      initial: true
    saveTask:
      transitions: {}
      action: addTodoList
      end: true
    inputTask:
      transitions:
        saveTask:
          condition: 'intent === "freeTextIntent"'
          mapping:
            payload.task: content
      action: inputTask
    apiResultState:
      transitions: {}
      action: apiResult
      end: true
  actions:
    addTodoList:
      type: asyncApi
      options:
        uri: 'http://www.example.com/api/v1/todo'
        method: POST
        body:
          - key: task
            value: $(payload.task)
        headers: []
        command: apiResult
    inputTask:
      type: text
      options:
        text: 'Enter a new task'
    apiResult:
      type: text
      options:
        text: $(payload.status)
  methods: {}

Figure 3 Example of Async API use in YAML codes

This is the end of the guidance. You can contact support@kata.ai if you have any difficulties when implementing this.

© 2025 Kata.ai. All rights reserved.

Version v4.0.0. Last updated 15 March 2022.

  • Twitter
  • GitHub
  • LinkedIn
  • Medium