Create a contact
curl --request POST \
--url https://api.hilos.io/api/contact \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"meta": {},
"external_url": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "website",
"created_on": "2023-11-07T05:31:56Z",
"tags": [
{
"name": "<string>"
}
],
"default_assignees": [
123
],
"overwrite_tags": false,
"overwrite_default_assignees": false,
"overwrite_meta": false
}
'import requests
url = "https://api.hilos.io/api/contact"
payload = {
"phone": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"meta": {},
"external_url": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "website",
"created_on": "2023-11-07T05:31:56Z",
"tags": [{ "name": "<string>" }],
"default_assignees": [123],
"overwrite_tags": False,
"overwrite_default_assignees": False,
"overwrite_meta": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '<string>',
first_name: '<string>',
last_name: '<string>',
email: 'jsmith@example.com',
meta: {},
external_url: '<string>',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
source: 'website',
created_on: '2023-11-07T05:31:56Z',
tags: [{name: '<string>'}],
default_assignees: [123],
overwrite_tags: false,
overwrite_default_assignees: false,
overwrite_meta: false
})
};
fetch('https://api.hilos.io/api/contact', 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.hilos.io/api/contact",
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([
'phone' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'email' => 'jsmith@example.com',
'meta' => [
],
'external_url' => '<string>',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'source' => 'website',
'created_on' => '2023-11-07T05:31:56Z',
'tags' => [
[
'name' => '<string>'
]
],
'default_assignees' => [
123
],
'overwrite_tags' => false,
'overwrite_default_assignees' => false,
'overwrite_meta' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.hilos.io/api/contact"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"meta\": {},\n \"external_url\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": \"website\",\n \"created_on\": \"2023-11-07T05:31:56Z\",\n \"tags\": [\n {\n \"name\": \"<string>\"\n }\n ],\n \"default_assignees\": [\n 123\n ],\n \"overwrite_tags\": false,\n \"overwrite_default_assignees\": false,\n \"overwrite_meta\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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.hilos.io/api/contact")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"meta\": {},\n \"external_url\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": \"website\",\n \"created_on\": \"2023-11-07T05:31:56Z\",\n \"tags\": [\n {\n \"name\": \"<string>\"\n }\n ],\n \"default_assignees\": [\n 123\n ],\n \"overwrite_tags\": false,\n \"overwrite_default_assignees\": false,\n \"overwrite_meta\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hilos.io/api/contact")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"meta\": {},\n \"external_url\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": \"website\",\n \"created_on\": \"2023-11-07T05:31:56Z\",\n \"tags\": [\n {\n \"name\": \"<string>\"\n }\n ],\n \"default_assignees\": [\n 123\n ],\n \"overwrite_tags\": false,\n \"overwrite_default_assignees\": false,\n \"overwrite_meta\": false\n}"
response = http.request(request)
puts response.read_body{
"canonical_phone": "<string>",
"created_by": 123,
"phone": "<string>",
"id": "<string>",
"last_updated_on": "2023-11-07T05:31:56Z",
"source": "<string>",
"tags": [
{
"id": 123,
"name": "<string>"
}
],
"default_assignees": [
{
"id": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"account": 123,
"profile_image": "<string>",
"date_joined": "2023-11-07T05:31:56Z"
}
],
"inbox_contacts": [
{
"url": "<string>",
"channel": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"default_conversation_url": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"meta": {},
"external_url": "<string>",
"created_on": "2023-11-07T05:31:56Z"
}Contacts
Create or Update a contact
When you POST a new Contact, we’ll first check if another contact exists with the same phone. If it does, we’ll do a partial update to the existing contact with this new information. We do this so you don’t end up with duplicate contacts in your account.
You can set arbitrary attributes for a contact in the meta object, using meta={custom_property_1: 'some value', another_property: 'another value ...', ...}. We parse all these attributes as strings for now.
We append the received meta, tags and default_assignees properties with the contact current ones, if you want to delete some key inside the meta or a tags you have to use the overwrite_meta or overwrite_tags attributes in the request body.
POST
/
api
/
contact
Create a contact
curl --request POST \
--url https://api.hilos.io/api/contact \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"meta": {},
"external_url": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "website",
"created_on": "2023-11-07T05:31:56Z",
"tags": [
{
"name": "<string>"
}
],
"default_assignees": [
123
],
"overwrite_tags": false,
"overwrite_default_assignees": false,
"overwrite_meta": false
}
'import requests
url = "https://api.hilos.io/api/contact"
payload = {
"phone": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"meta": {},
"external_url": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "website",
"created_on": "2023-11-07T05:31:56Z",
"tags": [{ "name": "<string>" }],
"default_assignees": [123],
"overwrite_tags": False,
"overwrite_default_assignees": False,
"overwrite_meta": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '<string>',
first_name: '<string>',
last_name: '<string>',
email: 'jsmith@example.com',
meta: {},
external_url: '<string>',
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
source: 'website',
created_on: '2023-11-07T05:31:56Z',
tags: [{name: '<string>'}],
default_assignees: [123],
overwrite_tags: false,
overwrite_default_assignees: false,
overwrite_meta: false
})
};
fetch('https://api.hilos.io/api/contact', 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.hilos.io/api/contact",
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([
'phone' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'email' => 'jsmith@example.com',
'meta' => [
],
'external_url' => '<string>',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'source' => 'website',
'created_on' => '2023-11-07T05:31:56Z',
'tags' => [
[
'name' => '<string>'
]
],
'default_assignees' => [
123
],
'overwrite_tags' => false,
'overwrite_default_assignees' => false,
'overwrite_meta' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.hilos.io/api/contact"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"meta\": {},\n \"external_url\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": \"website\",\n \"created_on\": \"2023-11-07T05:31:56Z\",\n \"tags\": [\n {\n \"name\": \"<string>\"\n }\n ],\n \"default_assignees\": [\n 123\n ],\n \"overwrite_tags\": false,\n \"overwrite_default_assignees\": false,\n \"overwrite_meta\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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.hilos.io/api/contact")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"meta\": {},\n \"external_url\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": \"website\",\n \"created_on\": \"2023-11-07T05:31:56Z\",\n \"tags\": [\n {\n \"name\": \"<string>\"\n }\n ],\n \"default_assignees\": [\n 123\n ],\n \"overwrite_tags\": false,\n \"overwrite_default_assignees\": false,\n \"overwrite_meta\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hilos.io/api/contact")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"meta\": {},\n \"external_url\": \"<string>\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": \"website\",\n \"created_on\": \"2023-11-07T05:31:56Z\",\n \"tags\": [\n {\n \"name\": \"<string>\"\n }\n ],\n \"default_assignees\": [\n 123\n ],\n \"overwrite_tags\": false,\n \"overwrite_default_assignees\": false,\n \"overwrite_meta\": false\n}"
response = http.request(request)
puts response.read_body{
"canonical_phone": "<string>",
"created_by": 123,
"phone": "<string>",
"id": "<string>",
"last_updated_on": "2023-11-07T05:31:56Z",
"source": "<string>",
"tags": [
{
"id": 123,
"name": "<string>"
}
],
"default_assignees": [
{
"id": 123,
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"account": 123,
"profile_image": "<string>",
"date_joined": "2023-11-07T05:31:56Z"
}
],
"inbox_contacts": [
{
"url": "<string>",
"channel": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"default_conversation_url": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"meta": {},
"external_url": "<string>",
"created_on": "2023-11-07T05:31:56Z"
}Authorizations
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Response
201 - application/json
Was this page helpful?

