cURL
curl --request POST \
--url https://protegee.ai/voice/api/v1/twilio/set-context \
--header 'Content-Type: application/json' \
--data '
{
"caller": "+16151231234",
"description": "Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345",
"price": "10.00",
"vendor": "example-co",
"customer_id": "",
"persona": "english-jessica",
"callback": "+14155552671",
"email": "my_customer@company.com",
"full_name": "John Doe",
"transaction_type": "once",
"memory": "<string>"
}
'import requests
url = "https://protegee.ai/voice/api/v1/twilio/set-context"
payload = {
"caller": "+16151231234",
"description": "Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345",
"price": "10.00",
"vendor": "example-co",
"customer_id": "",
"persona": "english-jessica",
"callback": "+14155552671",
"email": "my_customer@company.com",
"full_name": "John Doe",
"transaction_type": "once",
"memory": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
caller: '+16151231234',
description: 'Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345',
price: '10.00',
vendor: 'example-co',
customer_id: '',
persona: 'english-jessica',
callback: '+14155552671',
email: 'my_customer@company.com',
full_name: 'John Doe',
transaction_type: 'once',
memory: '<string>'
})
};
fetch('https://protegee.ai/voice/api/v1/twilio/set-context', 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://protegee.ai/voice/api/v1/twilio/set-context",
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([
'caller' => '+16151231234',
'description' => 'Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345',
'price' => '10.00',
'vendor' => 'example-co',
'customer_id' => '',
'persona' => 'english-jessica',
'callback' => '+14155552671',
'email' => 'my_customer@company.com',
'full_name' => 'John Doe',
'transaction_type' => 'once',
'memory' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://protegee.ai/voice/api/v1/twilio/set-context"
payload := strings.NewReader("{\n \"caller\": \"+16151231234\",\n \"description\": \"Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345\",\n \"price\": \"10.00\",\n \"vendor\": \"example-co\",\n \"customer_id\": \"\",\n \"persona\": \"english-jessica\",\n \"callback\": \"+14155552671\",\n \"email\": \"my_customer@company.com\",\n \"full_name\": \"John Doe\",\n \"transaction_type\": \"once\",\n \"memory\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://protegee.ai/voice/api/v1/twilio/set-context")
.header("Content-Type", "application/json")
.body("{\n \"caller\": \"+16151231234\",\n \"description\": \"Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345\",\n \"price\": \"10.00\",\n \"vendor\": \"example-co\",\n \"customer_id\": \"\",\n \"persona\": \"english-jessica\",\n \"callback\": \"+14155552671\",\n \"email\": \"my_customer@company.com\",\n \"full_name\": \"John Doe\",\n \"transaction_type\": \"once\",\n \"memory\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://protegee.ai/voice/api/v1/twilio/set-context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"caller\": \"+16151231234\",\n \"description\": \"Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345\",\n \"price\": \"10.00\",\n \"vendor\": \"example-co\",\n \"customer_id\": \"\",\n \"persona\": \"english-jessica\",\n \"callback\": \"+14155552671\",\n \"email\": \"my_customer@company.com\",\n \"full_name\": \"John Doe\",\n \"transaction_type\": \"once\",\n \"memory\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": {}
}{
"status": "error",
"message": {}
}Endpoint Examples
Twilio - Set Context
Sets context for a Twilio voice call with the provided details
POST
/
voice
/
api
/
v1
/
twilio
/
set-context
cURL
curl --request POST \
--url https://protegee.ai/voice/api/v1/twilio/set-context \
--header 'Content-Type: application/json' \
--data '
{
"caller": "+16151231234",
"description": "Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345",
"price": "10.00",
"vendor": "example-co",
"customer_id": "",
"persona": "english-jessica",
"callback": "+14155552671",
"email": "my_customer@company.com",
"full_name": "John Doe",
"transaction_type": "once",
"memory": "<string>"
}
'import requests
url = "https://protegee.ai/voice/api/v1/twilio/set-context"
payload = {
"caller": "+16151231234",
"description": "Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345",
"price": "10.00",
"vendor": "example-co",
"customer_id": "",
"persona": "english-jessica",
"callback": "+14155552671",
"email": "my_customer@company.com",
"full_name": "John Doe",
"transaction_type": "once",
"memory": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
caller: '+16151231234',
description: 'Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345',
price: '10.00',
vendor: 'example-co',
customer_id: '',
persona: 'english-jessica',
callback: '+14155552671',
email: 'my_customer@company.com',
full_name: 'John Doe',
transaction_type: 'once',
memory: '<string>'
})
};
fetch('https://protegee.ai/voice/api/v1/twilio/set-context', 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://protegee.ai/voice/api/v1/twilio/set-context",
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([
'caller' => '+16151231234',
'description' => 'Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345',
'price' => '10.00',
'vendor' => 'example-co',
'customer_id' => '',
'persona' => 'english-jessica',
'callback' => '+14155552671',
'email' => 'my_customer@company.com',
'full_name' => 'John Doe',
'transaction_type' => 'once',
'memory' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://protegee.ai/voice/api/v1/twilio/set-context"
payload := strings.NewReader("{\n \"caller\": \"+16151231234\",\n \"description\": \"Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345\",\n \"price\": \"10.00\",\n \"vendor\": \"example-co\",\n \"customer_id\": \"\",\n \"persona\": \"english-jessica\",\n \"callback\": \"+14155552671\",\n \"email\": \"my_customer@company.com\",\n \"full_name\": \"John Doe\",\n \"transaction_type\": \"once\",\n \"memory\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://protegee.ai/voice/api/v1/twilio/set-context")
.header("Content-Type", "application/json")
.body("{\n \"caller\": \"+16151231234\",\n \"description\": \"Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345\",\n \"price\": \"10.00\",\n \"vendor\": \"example-co\",\n \"customer_id\": \"\",\n \"persona\": \"english-jessica\",\n \"callback\": \"+14155552671\",\n \"email\": \"my_customer@company.com\",\n \"full_name\": \"John Doe\",\n \"transaction_type\": \"once\",\n \"memory\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://protegee.ai/voice/api/v1/twilio/set-context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"caller\": \"+16151231234\",\n \"description\": \"Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345\",\n \"price\": \"10.00\",\n \"vendor\": \"example-co\",\n \"customer_id\": \"\",\n \"persona\": \"english-jessica\",\n \"callback\": \"+14155552671\",\n \"email\": \"my_customer@company.com\",\n \"full_name\": \"John Doe\",\n \"transaction_type\": \"once\",\n \"memory\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": {}
}{
"status": "error",
"message": {}
}Query Parameters
API token to authenticate the request
Body
application/json
Phone number of the caller (your customer)
description
string
default:Reservation for two at The Gourmet Bistro, 7:30 PM on December 30th, 2024, Table 12, Indoor seating, Special request: Window view, Confirmation number: 12345
required
Details about the purchase
Price of the item (in USD), e.g. 10.50
Who this payment should be sent to - please refer to the /vendors page to find the full list
To specify the processor-specific customer ID (if you have it). Only used if processor is Authorize.net.
Which voice to use - currently available: 'english-jessica'
Phone number to hand the call back to after the payment is processed, e.g. +14155552671
Email of the caller (your customer)
Name of the caller (your customer)
How to process the transaction
Available options:
once, subscription, authorize Literally anything. Typically used to share information across agents.
⌘I
