Contacts
Upsert a contact by identifier
POST
/
v1
/
contacts
/
{identifier}
/
upsert
Upsert a contact by identifier
curl --request POST \
--url https://app.chatbotx.io/api/v1/contacts/{identifier}/upsert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"firstName": "<string>",
"lastName": "<string>",
"email": "<unknown>",
"phoneNumber": "<string>",
"avatar": "<string>"
}
'import requests
url = "https://app.chatbotx.io/api/v1/contacts/{identifier}/upsert"
payload = {
"firstName": "<string>",
"lastName": "<string>",
"email": "<unknown>",
"phoneNumber": "<string>",
"avatar": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: '<string>',
lastName: '<string>',
email: '<unknown>',
phoneNumber: '<string>',
avatar: '<string>'
})
};
fetch('https://app.chatbotx.io/api/v1/contacts/{identifier}/upsert', 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://app.chatbotx.io/api/v1/contacts/{identifier}/upsert",
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([
'firstName' => '<string>',
'lastName' => '<string>',
'email' => '<unknown>',
'phoneNumber' => '<string>',
'avatar' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.chatbotx.io/api/v1/contacts/{identifier}/upsert"
payload := strings.NewReader("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<unknown>\",\n \"phoneNumber\": \"<string>\",\n \"avatar\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.chatbotx.io/api/v1/contacts/{identifier}/upsert")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<unknown>\",\n \"phoneNumber\": \"<string>\",\n \"avatar\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatbotx.io/api/v1/contacts/{identifier}/upsert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<unknown>\",\n \"phoneNumber\": \"<string>\",\n \"avatar\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"avatar": "<string>",
"phoneNumber": "<string>",
"email": "<string>",
"emailVerified": true,
"emailOptIn": true,
"firstName": "<string>",
"lastName": "<string>",
"fullName": "<string>",
"lastReadAt": "2023-11-07T05:31:56Z",
"ref": "<string>",
"country": "<string>",
"state": "<string>",
"city": "<string>",
"location": "<string>",
"locale": "<string>",
"timezone": "<string>",
"subscribedAt": "2023-11-07T05:31:56Z",
"broadcastSubscribedAt": "2023-11-07T05:31:56Z",
"blockedAt": "2023-11-07T05:31:56Z",
"workspaceId": "<string>",
"contactCustomFields": [
{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"value": "<string>",
"contactId": "<string>",
"customFieldId": "<string>"
}
],
"tags": [
{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"deletedAt": "2023-11-07T05:31:56Z",
"folderId": "<string>",
"workspaceId": "<string>"
}
],
"contactNotes": [
{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"text": "<string>",
"contactId": "<string>",
"createdById": "<string>"
}
],
"contactInboxes": [
{
"id": "<string>",
"contactId": "<string>",
"inboxId": "<string>",
"channel": "<string>",
"inbox": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"channel": "<string>",
"sourceId": "<string>",
"workspaceId": "<string>",
"status": "<string>"
}
}
],
"conversation": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"botEnabled": true,
"botResumeAt": "2023-11-07T05:31:56Z",
"archivedAt": "2023-11-07T05:31:56Z",
"additionalAttributes": "<string>",
"contactLastReadAt": "2023-11-07T05:31:56Z",
"agentLastReadAt": "2023-11-07T05:31:56Z",
"lastActivityAt": "2023-11-07T05:31:56Z",
"followed": true,
"workspaceId": "<string>",
"contactId": "<string>",
"adminRepliedAt": "2023-11-07T05:31:56Z",
"contactRepliedAt": "2023-11-07T05:31:56Z",
"aiContextLastMessageId": null,
"assignedUserId": null,
"assignedInboxTeamId": null,
"assignedUser": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"email": "<string>",
"emailVerified": true,
"image": "<string>",
"isAnonymous": true
},
"assignedInboxTeam": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"workspaceId": "<string>",
"name": "<string>"
},
"inbox": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"channel": "<string>",
"sourceId": "<string>",
"workspaceId": "<string>",
"status": "<string>"
}
}
}Authorizations
developerAccessTokentokenInSearchParams
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Minimum string length:
1Body
application/json
Response
200 - application/json
OK
Available options:
male, female, unknown Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Upsert a contact by identifier
curl --request POST \
--url https://app.chatbotx.io/api/v1/contacts/{identifier}/upsert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"firstName": "<string>",
"lastName": "<string>",
"email": "<unknown>",
"phoneNumber": "<string>",
"avatar": "<string>"
}
'import requests
url = "https://app.chatbotx.io/api/v1/contacts/{identifier}/upsert"
payload = {
"firstName": "<string>",
"lastName": "<string>",
"email": "<unknown>",
"phoneNumber": "<string>",
"avatar": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
firstName: '<string>',
lastName: '<string>',
email: '<unknown>',
phoneNumber: '<string>',
avatar: '<string>'
})
};
fetch('https://app.chatbotx.io/api/v1/contacts/{identifier}/upsert', 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://app.chatbotx.io/api/v1/contacts/{identifier}/upsert",
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([
'firstName' => '<string>',
'lastName' => '<string>',
'email' => '<unknown>',
'phoneNumber' => '<string>',
'avatar' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.chatbotx.io/api/v1/contacts/{identifier}/upsert"
payload := strings.NewReader("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<unknown>\",\n \"phoneNumber\": \"<string>\",\n \"avatar\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.chatbotx.io/api/v1/contacts/{identifier}/upsert")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<unknown>\",\n \"phoneNumber\": \"<string>\",\n \"avatar\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatbotx.io/api/v1/contacts/{identifier}/upsert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<unknown>\",\n \"phoneNumber\": \"<string>\",\n \"avatar\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"avatar": "<string>",
"phoneNumber": "<string>",
"email": "<string>",
"emailVerified": true,
"emailOptIn": true,
"firstName": "<string>",
"lastName": "<string>",
"fullName": "<string>",
"lastReadAt": "2023-11-07T05:31:56Z",
"ref": "<string>",
"country": "<string>",
"state": "<string>",
"city": "<string>",
"location": "<string>",
"locale": "<string>",
"timezone": "<string>",
"subscribedAt": "2023-11-07T05:31:56Z",
"broadcastSubscribedAt": "2023-11-07T05:31:56Z",
"blockedAt": "2023-11-07T05:31:56Z",
"workspaceId": "<string>",
"contactCustomFields": [
{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"value": "<string>",
"contactId": "<string>",
"customFieldId": "<string>"
}
],
"tags": [
{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"deletedAt": "2023-11-07T05:31:56Z",
"folderId": "<string>",
"workspaceId": "<string>"
}
],
"contactNotes": [
{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"text": "<string>",
"contactId": "<string>",
"createdById": "<string>"
}
],
"contactInboxes": [
{
"id": "<string>",
"contactId": "<string>",
"inboxId": "<string>",
"channel": "<string>",
"inbox": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"channel": "<string>",
"sourceId": "<string>",
"workspaceId": "<string>",
"status": "<string>"
}
}
],
"conversation": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"botEnabled": true,
"botResumeAt": "2023-11-07T05:31:56Z",
"archivedAt": "2023-11-07T05:31:56Z",
"additionalAttributes": "<string>",
"contactLastReadAt": "2023-11-07T05:31:56Z",
"agentLastReadAt": "2023-11-07T05:31:56Z",
"lastActivityAt": "2023-11-07T05:31:56Z",
"followed": true,
"workspaceId": "<string>",
"contactId": "<string>",
"adminRepliedAt": "2023-11-07T05:31:56Z",
"contactRepliedAt": "2023-11-07T05:31:56Z",
"aiContextLastMessageId": null,
"assignedUserId": null,
"assignedInboxTeamId": null,
"assignedUser": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"email": "<string>",
"emailVerified": true,
"image": "<string>",
"isAnonymous": true
},
"assignedInboxTeam": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"workspaceId": "<string>",
"name": "<string>"
},
"inbox": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"channel": "<string>",
"sourceId": "<string>",
"workspaceId": "<string>",
"status": "<string>"
}
}
}