Skip to main content
GET
/
generativeagent
/
v1
/
state
Get GenerativeAgent state
curl --request GET \
  --url https://api.sandbox.asapp.com/generativeagent/v1/state \
  --header 'asapp-api-id: <api-key>' \
  --header 'asapp-api-secret: <api-key>'
import requests

url = "https://api.sandbox.asapp.com/generativeagent/v1/state"

headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>"
}

response = requests.get(url, headers=headers)

print(response.text)
const options = {
method: 'GET',
headers: {'asapp-api-id': '<api-key>', 'asapp-api-secret': '<api-key>'}
};

fetch('https://api.sandbox.asapp.com/generativeagent/v1/state', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.asapp.com/generativeagent/v1/state",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"asapp-api-id: <api-key>",
"asapp-api-secret: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.sandbox.asapp.com/generativeagent/v1/state"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.sandbox.asapp.com/generativeagent/v1/state")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sandbox.asapp.com/generativeagent/v1/state")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "state": "ready",
  "lastGenerativeAgentMessageId": "01HWXSGMT91HCS18BV0CRGEKY8",
  "currentTaskName": "PaymentDetails",
  "inputVariables": {
    "input-context": "Customer chatted in to check the details of their last payment.",
    "last-customer-purchase": "2024-05-07"
  }
}

Authorizations

asapp-api-id
string
header
required
asapp-api-secret
string
header
required

Query Parameters

criteria
object

Search criteria

Response

200 - application/json

Successfully fetched state of generative agent for a conversation

state
enum<string>

The last status of the conversation:

  • ready - GenerativeAgent is ready to respond to requests
  • processing - GenerativeAgent is actively processing the conversation
  • waitingForConfirmation - GenerativeAgent is expecting an explicit confirmation on the next message
  • waitingForAuth - GenerativeAgent is waiting for the user to login before proceeding
  • transferredToAgent - GenerativeAgent is no longer able to provide meaningful responses and has requested the conversation be transferred to a human agent
  • transferredToSystem - GenerativeAgent has transferred control of this conversation back to the caller system. However, it will respond if new analyze requests are made
Available options:
ready,
processing,
waitingForConfirmation,
waitingForAuth,
transferredToAgent,
transferredToSystem
lastGenerativeAgentMessageId
string

ULID identifier of the last asynchronous response that was sent to the customer

currentTaskName
string

Current task TaskBot is executing

inputVariables
object

Last input variables