Start a public Agent conversation
curl --request POST \
--url https://api.contactbutton.com/v1/public/agents/{agent}/conversations \
--header 'Content-Type: application/json' \
--data '
{
"visitor_name": "<string>",
"visitor_email": "jsmith@example.com",
"visitor_phone": "<string>",
"phone_country": "<string>",
"subject": "<string>",
"message": "<string>",
"suggested_reply_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"button": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"app": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"chat_consent": true
}
'import requests
url = "https://api.contactbutton.com/v1/public/agents/{agent}/conversations"
payload = {
"visitor_name": "<string>",
"visitor_email": "jsmith@example.com",
"visitor_phone": "<string>",
"phone_country": "<string>",
"subject": "<string>",
"message": "<string>",
"suggested_reply_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"button": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"app": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"chat_consent": True
}
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({
visitor_name: '<string>',
visitor_email: 'jsmith@example.com',
visitor_phone: '<string>',
phone_country: '<string>',
subject: '<string>',
message: '<string>',
suggested_reply_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
button: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
app: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
chat_consent: true
})
};
fetch('https://api.contactbutton.com/v1/public/agents/{agent}/conversations', 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.contactbutton.com/v1/public/agents/{agent}/conversations",
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([
'visitor_name' => '<string>',
'visitor_email' => 'jsmith@example.com',
'visitor_phone' => '<string>',
'phone_country' => '<string>',
'subject' => '<string>',
'message' => '<string>',
'suggested_reply_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'button' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'app' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'chat_consent' => true
]),
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://api.contactbutton.com/v1/public/agents/{agent}/conversations"
payload := strings.NewReader("{\n \"visitor_name\": \"<string>\",\n \"visitor_email\": \"jsmith@example.com\",\n \"visitor_phone\": \"<string>\",\n \"phone_country\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"suggested_reply_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"button\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"app\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"chat_consent\": true\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://api.contactbutton.com/v1/public/agents/{agent}/conversations")
.header("Content-Type", "application/json")
.body("{\n \"visitor_name\": \"<string>\",\n \"visitor_email\": \"jsmith@example.com\",\n \"visitor_phone\": \"<string>\",\n \"phone_country\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"suggested_reply_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"button\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"app\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"chat_consent\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contactbutton.com/v1/public/agents/{agent}/conversations")
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 \"visitor_name\": \"<string>\",\n \"visitor_email\": \"jsmith@example.com\",\n \"visitor_phone\": \"<string>\",\n \"phone_country\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"suggested_reply_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"button\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"app\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"chat_consent\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"handoff": {
"status": "unavailable",
"available": true,
"can_request": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trigger": "explicit_request",
"reason": "<string>",
"review_url": "<string>",
"offered_at": "2023-11-07T05:31:56Z",
"requested_at": "2023-11-07T05:31:56Z",
"joined_at": "2023-11-07T05:31:56Z"
},
"lead_capture": {
"version": 1,
"timing": "required_before_chat",
"fields": [
"name"
],
"contact_requirement": "either",
"state": "ready",
"input_schema": {},
"default_phone_country": "<string>",
"request_message": "<string>",
"success_with_name": "<string>",
"success_without_name": "<string>",
"requires_consent": true,
"consent_text": "<string>",
"privacy_url": "<string>",
"captured": true,
"success_message": "<string>"
},
"follow_up": {
"enabled": true,
"opted_out": true,
"status": "scheduled"
},
"analytics_events": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "opened",
"protocol": "web",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"capability_id": "<string>",
"page_context": "<string>"
}
],
"protocol_contract": {
"version": "2026-08-05",
"protocol": "web",
"states": {},
"review": {
"contactbutton_owned": true,
"external_client_can_approve": true,
"external_client_receives_otp": false,
"material_actions_require_verification": true
}
}
},
"meta": {
"request_id": "<string>",
"next_cursor": "<string>"
}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"instance": "<string>",
"request_id": "<string>",
"errors": {}
}Start a public Agent conversation
POST
/
public
/
agents
/
{agent}
/
conversations
Start a public Agent conversation
curl --request POST \
--url https://api.contactbutton.com/v1/public/agents/{agent}/conversations \
--header 'Content-Type: application/json' \
--data '
{
"visitor_name": "<string>",
"visitor_email": "jsmith@example.com",
"visitor_phone": "<string>",
"phone_country": "<string>",
"subject": "<string>",
"message": "<string>",
"suggested_reply_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"button": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"app": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"chat_consent": true
}
'import requests
url = "https://api.contactbutton.com/v1/public/agents/{agent}/conversations"
payload = {
"visitor_name": "<string>",
"visitor_email": "jsmith@example.com",
"visitor_phone": "<string>",
"phone_country": "<string>",
"subject": "<string>",
"message": "<string>",
"suggested_reply_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"button": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"app": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"chat_consent": True
}
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({
visitor_name: '<string>',
visitor_email: 'jsmith@example.com',
visitor_phone: '<string>',
phone_country: '<string>',
subject: '<string>',
message: '<string>',
suggested_reply_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
button: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
app: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
chat_consent: true
})
};
fetch('https://api.contactbutton.com/v1/public/agents/{agent}/conversations', 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.contactbutton.com/v1/public/agents/{agent}/conversations",
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([
'visitor_name' => '<string>',
'visitor_email' => 'jsmith@example.com',
'visitor_phone' => '<string>',
'phone_country' => '<string>',
'subject' => '<string>',
'message' => '<string>',
'suggested_reply_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'button' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'app' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'chat_consent' => true
]),
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://api.contactbutton.com/v1/public/agents/{agent}/conversations"
payload := strings.NewReader("{\n \"visitor_name\": \"<string>\",\n \"visitor_email\": \"jsmith@example.com\",\n \"visitor_phone\": \"<string>\",\n \"phone_country\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"suggested_reply_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"button\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"app\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"chat_consent\": true\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://api.contactbutton.com/v1/public/agents/{agent}/conversations")
.header("Content-Type", "application/json")
.body("{\n \"visitor_name\": \"<string>\",\n \"visitor_email\": \"jsmith@example.com\",\n \"visitor_phone\": \"<string>\",\n \"phone_country\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"suggested_reply_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"button\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"app\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"chat_consent\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contactbutton.com/v1/public/agents/{agent}/conversations")
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 \"visitor_name\": \"<string>\",\n \"visitor_email\": \"jsmith@example.com\",\n \"visitor_phone\": \"<string>\",\n \"phone_country\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"suggested_reply_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"button\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"app\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"chat_consent\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"handoff": {
"status": "unavailable",
"available": true,
"can_request": true,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trigger": "explicit_request",
"reason": "<string>",
"review_url": "<string>",
"offered_at": "2023-11-07T05:31:56Z",
"requested_at": "2023-11-07T05:31:56Z",
"joined_at": "2023-11-07T05:31:56Z"
},
"lead_capture": {
"version": 1,
"timing": "required_before_chat",
"fields": [
"name"
],
"contact_requirement": "either",
"state": "ready",
"input_schema": {},
"default_phone_country": "<string>",
"request_message": "<string>",
"success_with_name": "<string>",
"success_without_name": "<string>",
"requires_consent": true,
"consent_text": "<string>",
"privacy_url": "<string>",
"captured": true,
"success_message": "<string>"
},
"follow_up": {
"enabled": true,
"opted_out": true,
"status": "scheduled"
},
"analytics_events": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "opened",
"protocol": "web",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"capability_id": "<string>",
"page_context": "<string>"
}
],
"protocol_contract": {
"version": "2026-08-05",
"protocol": "web",
"states": {},
"review": {
"contactbutton_owned": true,
"external_client_can_approve": true,
"external_client_receives_otp": false,
"material_actions_require_verification": true
}
}
},
"meta": {
"request_id": "<string>",
"next_cursor": "<string>"
}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"resolution": "<string>",
"instance": "<string>",
"request_id": "<string>",
"errors": {}
}Headers
Stable 8–120 character key for safe mutation retries.
Required string length:
8 - 120Set to rest for direct REST callers. Hosted and embedded ContactButton chat omit this header and are attributed to web.
Available options:
rest Path Parameters
Body
application/json
Provide message or suggested_reply_id. Suggested reply messages and event labels are always resolved server-side.
Available options:
human, agent_assisted, agent_to_agent Maximum string length:
40Maximum string length:
4Maximum string length:
10000Optional active Button context for an embedded Agent Chat App.
Optional published Agent Chat App attached to button.
Available options:
human, agent Show child attributes
Show child attributes
Was this page helpful?