curl --request POST \
--url https://api.sandbox.asapp.com/generativeagent/v1/call-transfers \
--header 'Content-Type: application/json' \
--header 'asapp-api-id: <api-key>' \
--header 'asapp-api-secret: <api-key>' \
--data '
{
"id": "0867617078-0032318833-2221801472-0002236962",
"externalConversationId": "0867617078-0032318833-2221801472-0002236962",
"type": "PHONE_NUMBER",
"phoneNumber": {
"country": "US"
},
"inputContext": {
"taskName": "Welcome",
"inputVariables": {
"email": "example@gmail.com",
"name": "name"
}
}
}
'import requests
url = "https://api.sandbox.asapp.com/generativeagent/v1/call-transfers"
payload = {
"id": "0867617078-0032318833-2221801472-0002236962",
"externalConversationId": "0867617078-0032318833-2221801472-0002236962",
"type": "PHONE_NUMBER",
"phoneNumber": { "country": "US" },
"inputContext": {
"taskName": "Welcome",
"inputVariables": {
"email": "example@gmail.com",
"name": "name"
}
}
}
headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'asapp-api-id': '<api-key>',
'asapp-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: '0867617078-0032318833-2221801472-0002236962',
externalConversationId: '0867617078-0032318833-2221801472-0002236962',
type: 'PHONE_NUMBER',
phoneNumber: {country: 'US'},
inputContext: {
taskName: 'Welcome',
inputVariables: {email: 'example@gmail.com', name: 'name'}
}
})
};
fetch('https://api.sandbox.asapp.com/generativeagent/v1/call-transfers', 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/call-transfers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '0867617078-0032318833-2221801472-0002236962',
'externalConversationId' => '0867617078-0032318833-2221801472-0002236962',
'type' => 'PHONE_NUMBER',
'phoneNumber' => [
'country' => 'US'
],
'inputContext' => [
'taskName' => 'Welcome',
'inputVariables' => [
'email' => 'example@gmail.com',
'name' => 'name'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.asapp.com/generativeagent/v1/call-transfers"
payload := strings.NewReader("{\n \"id\": \"0867617078-0032318833-2221801472-0002236962\",\n \"externalConversationId\": \"0867617078-0032318833-2221801472-0002236962\",\n \"type\": \"PHONE_NUMBER\",\n \"phoneNumber\": {\n \"country\": \"US\"\n },\n \"inputContext\": {\n \"taskName\": \"Welcome\",\n \"inputVariables\": {\n \"email\": \"example@gmail.com\",\n \"name\": \"name\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.asapp.com/generativeagent/v1/call-transfers")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"0867617078-0032318833-2221801472-0002236962\",\n \"externalConversationId\": \"0867617078-0032318833-2221801472-0002236962\",\n \"type\": \"PHONE_NUMBER\",\n \"phoneNumber\": {\n \"country\": \"US\"\n },\n \"inputContext\": {\n \"taskName\": \"Welcome\",\n \"inputVariables\": {\n \"email\": \"example@gmail.com\",\n \"name\": \"name\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.asapp.com/generativeagent/v1/call-transfers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"0867617078-0032318833-2221801472-0002236962\",\n \"externalConversationId\": \"0867617078-0032318833-2221801472-0002236962\",\n \"type\": \"PHONE_NUMBER\",\n \"phoneNumber\": {\n \"country\": \"US\"\n },\n \"inputContext\": {\n \"taskName\": \"Welcome\",\n \"inputVariables\": {\n \"email\": \"example@gmail.com\",\n \"name\": \"name\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "0867617078-0032318833-2221801472-0002236962",
"externalConversationId": "0867617078-0032318833-2221801472-0002236962",
"type": "PHONE_NUMBER",
"phoneNumber": {
"transferNumber": "+19995550199",
"country": "US",
"expiresAt": "2024-06-01T12:34:56Z"
},
"inputContext": {
"taskName": "Welcome",
"inputVariables": {
"email": "example@gmail.com",
"name": "name"
}
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "400-01",
"message": "Bad request"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "401-01",
"message": "Unauthorized"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "403-01",
"message": "Forbidden Response"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "404-01",
"message": "Not Found"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "409-01",
"message": "Conflict"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "413-01",
"message": "Request Entity Too Large"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "422-01",
"message": "Unprocessable Entity"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "429-01",
"message": "Too Many Requests"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "503-01",
"message": "Service Unavailable"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "500-01",
"message": "Internal server error"
}
}Create Call Transfer
Creates a new Call Transfer resource that represents an attempt to transfer a call from your IVR or CCaaS to ASAPP.
The type indicates the type of call transfer:
PHONE_NUMBER: A temporary phone number is assigned for the transfer.SIP: Session Initiation Protocol (SIP) transfer.
You can optionally provide inputContext to provide context for the conversation. This is passed to GenerativeAgent.
curl --request POST \
--url https://api.sandbox.asapp.com/generativeagent/v1/call-transfers \
--header 'Content-Type: application/json' \
--header 'asapp-api-id: <api-key>' \
--header 'asapp-api-secret: <api-key>' \
--data '
{
"id": "0867617078-0032318833-2221801472-0002236962",
"externalConversationId": "0867617078-0032318833-2221801472-0002236962",
"type": "PHONE_NUMBER",
"phoneNumber": {
"country": "US"
},
"inputContext": {
"taskName": "Welcome",
"inputVariables": {
"email": "example@gmail.com",
"name": "name"
}
}
}
'import requests
url = "https://api.sandbox.asapp.com/generativeagent/v1/call-transfers"
payload = {
"id": "0867617078-0032318833-2221801472-0002236962",
"externalConversationId": "0867617078-0032318833-2221801472-0002236962",
"type": "PHONE_NUMBER",
"phoneNumber": { "country": "US" },
"inputContext": {
"taskName": "Welcome",
"inputVariables": {
"email": "example@gmail.com",
"name": "name"
}
}
}
headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'asapp-api-id': '<api-key>',
'asapp-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: '0867617078-0032318833-2221801472-0002236962',
externalConversationId: '0867617078-0032318833-2221801472-0002236962',
type: 'PHONE_NUMBER',
phoneNumber: {country: 'US'},
inputContext: {
taskName: 'Welcome',
inputVariables: {email: 'example@gmail.com', name: 'name'}
}
})
};
fetch('https://api.sandbox.asapp.com/generativeagent/v1/call-transfers', 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/call-transfers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '0867617078-0032318833-2221801472-0002236962',
'externalConversationId' => '0867617078-0032318833-2221801472-0002236962',
'type' => 'PHONE_NUMBER',
'phoneNumber' => [
'country' => 'US'
],
'inputContext' => [
'taskName' => 'Welcome',
'inputVariables' => [
'email' => 'example@gmail.com',
'name' => 'name'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.asapp.com/generativeagent/v1/call-transfers"
payload := strings.NewReader("{\n \"id\": \"0867617078-0032318833-2221801472-0002236962\",\n \"externalConversationId\": \"0867617078-0032318833-2221801472-0002236962\",\n \"type\": \"PHONE_NUMBER\",\n \"phoneNumber\": {\n \"country\": \"US\"\n },\n \"inputContext\": {\n \"taskName\": \"Welcome\",\n \"inputVariables\": {\n \"email\": \"example@gmail.com\",\n \"name\": \"name\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.asapp.com/generativeagent/v1/call-transfers")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"0867617078-0032318833-2221801472-0002236962\",\n \"externalConversationId\": \"0867617078-0032318833-2221801472-0002236962\",\n \"type\": \"PHONE_NUMBER\",\n \"phoneNumber\": {\n \"country\": \"US\"\n },\n \"inputContext\": {\n \"taskName\": \"Welcome\",\n \"inputVariables\": {\n \"email\": \"example@gmail.com\",\n \"name\": \"name\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.asapp.com/generativeagent/v1/call-transfers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"0867617078-0032318833-2221801472-0002236962\",\n \"externalConversationId\": \"0867617078-0032318833-2221801472-0002236962\",\n \"type\": \"PHONE_NUMBER\",\n \"phoneNumber\": {\n \"country\": \"US\"\n },\n \"inputContext\": {\n \"taskName\": \"Welcome\",\n \"inputVariables\": {\n \"email\": \"example@gmail.com\",\n \"name\": \"name\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "0867617078-0032318833-2221801472-0002236962",
"externalConversationId": "0867617078-0032318833-2221801472-0002236962",
"type": "PHONE_NUMBER",
"phoneNumber": {
"transferNumber": "+19995550199",
"country": "US",
"expiresAt": "2024-06-01T12:34:56Z"
},
"inputContext": {
"taskName": "Welcome",
"inputVariables": {
"email": "example@gmail.com",
"name": "name"
}
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "400-01",
"message": "Bad request"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "401-01",
"message": "Unauthorized"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "403-01",
"message": "Forbidden Response"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "404-01",
"message": "Not Found"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "409-01",
"message": "Conflict"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "413-01",
"message": "Request Entity Too Large"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "422-01",
"message": "Unprocessable Entity"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "429-01",
"message": "Too Many Requests"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "503-01",
"message": "Service Unavailable"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "500-01",
"message": "Internal server error"
}
}Body
Post Call Transfer Request
A unique identifier for this call transfer request. This should be different for each transfer attempt.
"0867617078-0032318833-2221801472-0002236962"
The unique identifier of the call in your call system. Multiple call transfers using the same externalConversationId will be treated as a single conversation.
This is the primary identifier for conversations within ASAPP and is reflected in reporting.
"0867617078-0032318833-2221801472-0002236962"
The type of call transfer being made. Currently supports:
PHONE_NUMBER: A temporary phone number is assigned for the transfer.SIP: Session Initiation Protocol (SIP) transfer.
PHONE_NUMBER, SIP Configuration information for requesting a phone number. Mandatory if type is PHONE_NUMBER.
Show child attributes
Show child attributes
Configuration for SIP transfers. Defines how the call will be transferred back when the Generative Agent finishes the conversation.
Transfer Types:
BYE: Ends the call with a SIP BYE message. Use for supervised transfers to Generative Agent. Default value if returnTransferType is not provided.REFER: Sends a SIP REFER message with the return URI in the Refer-To header. Use for blind transfers to another system.INVITE: Initiates a new SIP INVITE to the return URI, ASAPP will continue to transcribe the call until the call is ended.
Show child attributes
Show child attributes
{ "returnTransferType": "REFER", "returnUri": "sip:transfer@your-company.com:5060" }
Optional context information to pass to the Generative Agent when the call is received.
Show child attributes
Show child attributes
Response
Successful response
Post Call Transfer Response
The unique identifier for this call transfer request, matching the ID provided in the request.
"0867617078-0032318833-2221801472-0002236962"
The unique identifier of the call in your call system. This will be referenced in ASAPP reporting. Usually this is the same value as the call transfer ID.
"0867617078-0032318833-2221801472-0002236962"
The type of call transfer method being used.
PHONE_NUMBER, SIP The current status of the call transfer request.
On creation, the status is ACTIVE and is waiting for your system to transfer the call.
ACTIVE, ONGOING, COMPLETED, EXPIRED Details about the assigned phone number for the transfer. Available only if type is PHONE_NUMBER.
Show child attributes
Show child attributes
Configuration for SIP transfers. Defines how the call will be transferred back when the Generative Agent finishes the conversation.
Transfer Types:
BYE: Ends the call with a SIP BYE message. Use for supervised transfers to Generative Agent. Default value if returnTransferType is not provided.REFER: Sends a SIP REFER message with the return URI in the Refer-To header. Use for blind transfers to another system.INVITE: Initiates a new SIP INVITE to the return URI, ASAPP will continue to transcribe the call until the call is ended.
Show child attributes
Show child attributes
{ "returnTransferType": "REFER", "returnUri": "sip:transfer@your-company.com:5060" }
The context information that will be passed to the Generative Agent when the call is received.
Show child attributes
Show child attributes
Was this page helpful?