Create a contact
curl --request POST \
--url https://web-api.clerk.chat/public/contacts \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"name": "John Doe",
"email": "johndoe@example.com",
"phone": "+1234567890",
"public": false,
"data": {}
}
'import requests
url = "https://web-api.clerk.chat/public/contacts"
payload = {
"name": "John Doe",
"email": "johndoe@example.com",
"phone": "+1234567890",
"public": False,
"data": {}
}
headers = {
"apiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apiKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'John Doe',
email: 'johndoe@example.com',
phone: '+1234567890',
public: false,
data: {}
})
};
fetch('https://web-api.clerk.chat/public/contacts', 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://web-api.clerk.chat/public/contacts",
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([
'name' => 'John Doe',
'email' => 'johndoe@example.com',
'phone' => '+1234567890',
'public' => false,
'data' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <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://web-api.clerk.chat/public/contacts"
payload := strings.NewReader("{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@example.com\",\n \"phone\": \"+1234567890\",\n \"public\": false,\n \"data\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<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://web-api.clerk.chat/public/contacts")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@example.com\",\n \"phone\": \"+1234567890\",\n \"public\": false,\n \"data\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web-api.clerk.chat/public/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@example.com\",\n \"phone\": \"+1234567890\",\n \"public\": false,\n \"data\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "1",
"teamId": "1",
"createdByUserId": "1",
"name": "John Doe",
"phone": "+1234567890",
"email": "johndoe@example.com",
"externalId": "1234",
"avatarURL": "https://example.com/avatar.jpg",
"public": false,
"data": {},
"attributes": [],
"created": "2021-01-01T00:00:00.000Z",
"updated": "2021-01-01T00:00:00.000Z"
}
}Contacts
Create a contact
Create a contact for the active team
POST
/
public
/
contacts
Create a contact
curl --request POST \
--url https://web-api.clerk.chat/public/contacts \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"name": "John Doe",
"email": "johndoe@example.com",
"phone": "+1234567890",
"public": false,
"data": {}
}
'import requests
url = "https://web-api.clerk.chat/public/contacts"
payload = {
"name": "John Doe",
"email": "johndoe@example.com",
"phone": "+1234567890",
"public": False,
"data": {}
}
headers = {
"apiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apiKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'John Doe',
email: 'johndoe@example.com',
phone: '+1234567890',
public: false,
data: {}
})
};
fetch('https://web-api.clerk.chat/public/contacts', 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://web-api.clerk.chat/public/contacts",
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([
'name' => 'John Doe',
'email' => 'johndoe@example.com',
'phone' => '+1234567890',
'public' => false,
'data' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <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://web-api.clerk.chat/public/contacts"
payload := strings.NewReader("{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@example.com\",\n \"phone\": \"+1234567890\",\n \"public\": false,\n \"data\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<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://web-api.clerk.chat/public/contacts")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@example.com\",\n \"phone\": \"+1234567890\",\n \"public\": false,\n \"data\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web-api.clerk.chat/public/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"John Doe\",\n \"email\": \"johndoe@example.com\",\n \"phone\": \"+1234567890\",\n \"public\": false,\n \"data\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "1",
"teamId": "1",
"createdByUserId": "1",
"name": "John Doe",
"phone": "+1234567890",
"email": "johndoe@example.com",
"externalId": "1234",
"avatarURL": "https://example.com/avatar.jpg",
"public": false,
"data": {},
"attributes": [],
"created": "2021-01-01T00:00:00.000Z",
"updated": "2021-01-01T00:00:00.000Z"
}
}Authorizations
Body
application/json
The name of the contact
Example:
"John Doe"
The email address of the contact
Example:
"johndoe@example.com"
The phone number of the contact
Example:
"+1234567890"
Whether the contact is public
Example:
false
Additional metadata for the contact
Example:
{}
Response
The created contact
Show child attributes
Show child attributes
⌘I