PATCH /contacts/:uuid
Updates an existing contact.
Required Parameters
Parameter | Type | Description |
---|---|---|
uuid | string | The identifier of the contact (e.g. phone number in WhatsApp) |
Optional Parameters
Parameter | Type | Description |
---|---|---|
tags | string[] | A list of comma-separated values (e.g ['Call back', 'Interested'] ) |
custom_fields | string{} | An object with the custom fields (e.g. {'Billing Address': 'Main Street 1} ) |
name | string | The name of the contact |
assigned_user | String | Email of the the collaborator that you want to assign to a contact |
unassign_user | Boolean | true is you want to remove the assigned collaborator from a contact |
team_uuid | String | UUID of the team that you want to assign to a contact |
bot_status | String | The status of the bot for this contact. Accepts either bot_start or bot_end . |
info
When passing bot_status
make sure that the bot is enabled in your account. Visit bots in your Callbell account to create and enable one.
If you have a bot enabled, the default status is bot_start
.
attention
Ensure that custom_fields
and tags
already exist in your account before passing them. Visit tags and custom_fields in your settings for more information.
Similarly, for assigned_user
and team_uuid
, use a valid email address associated with a user in your account or reference an existing team.
Example Request
- cURL
- Node
- Ruby
- Go
- PHP
- Python
- C#
- Java
- Rust
curl -X PATCH "https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json" \
-d '{
"name": "Joe Doe NEW",
"custom_fields": {
"orderNumber": 123,
"zipCode": "98765430"
}
}'
import axios from 'axios';
const response = await axios.patch(
'https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8',
// '{\n "name": "Joe Doe NEW",\n "custom_fields": {\n "orderNumber": 123,\n "zipCode": "98765430"\n }\n }',
{
'name': 'Joe Doe NEW',
'custom_fields': {
'orderNumber': 123,
'zipCode': '98765430'
}
},
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
require 'json'
uri = URI('https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8')
req = Net::HTTP::Patch.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
# The object won't be serialized exactly like this
# req.body = "{\n \"name\": \"Joe Doe NEW\",\n \"custom_fields\": {\n \"orderNumber\": 123,\n \"zipCode\": \"98765430\"\n }\n }"
req.body = {
'name' => 'Joe Doe NEW',
'custom_fields' => {
'orderNumber' => 123,
'zipCode' => '98765430'
}
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{
"name": "Joe Doe NEW",
"custom_fields": {
"orderNumber": 123,
"zipCode": "98765430"
}
}`)
req, err := http.NewRequest("PATCH", "https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"name\": \"Joe Doe NEW\",\n \"custom_fields\": {\n \"orderNumber\": 123,\n \"zipCode\": \"98765430\"\n }\n }");
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
json_data = {
'name': 'Joe Doe NEW',
'custom_fields': {
'orderNumber': 123,
'zipCode': '98765430',
},
}
response = requests.patch('https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "name": "Joe Doe NEW",\n "custom_fields": {\n "orderNumber": 123,\n "zipCode": "98765430"\n }\n }'
#response = requests.patch('https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8', headers=headers, data=data)
using System.Net.Http;
using System.Net.Http.Headers;
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Patch, "https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8");
request.Headers.Add("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM");
request.Content = new StringContent("{\n \"name\": \"Joe Doe NEW\",\n \"custom_fields\": {\n \"orderNumber\": 123,\n \"zipCode\": \"98765430\"\n }\n }");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("PATCH");
httpConn.setRequestProperty("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{\n \"name\": \"Joe Doe NEW\",\n \"custom_fields\": {\n \"orderNumber\": 123,\n \"zipCode\": \"98765430\"\n }\n }");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
extern crate reqwest;
use reqwest::header;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut headers = header::HeaderMap::new();
headers.insert("Authorization", "Bearer test_gshuPaZoeEG6ovbc8M79w0QyM".parse().unwrap());
headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::blocking::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.build()
.unwrap();
let res = client.patch("https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8")
.headers(headers)
.body(r#"
{
"name": "Joe Doe NEW",
"custom_fields": {
"orderNumber": 123,
"zipCode": "98765430"
}
}
"#
)
.send()?
.text()?;
println!("{}", res);
Ok(())
}
Response
Parameter | Type | Description |
---|---|---|
contact | Contact | The contact which has been updated. |
Example Response
response.json
{
"contact": [
{
"uuid": "414a6d692bd645ed803f2e7ce360d4c8",
"name": "UPDATE Doe",
"phoneNumber": "123456789",
"avatarUrl": null,
"createdAt": "2020-11-13T21:08:53Z",
"source": "whatsapp",
"href": "https://dash.callbell.eu/contacts/414a6d692bd645ed803f2e7ce360d4c8",
"conversationHref": "https://dash.callbell.eu/chat/f3670b13446b412796238b1cd78899f9",
"tags": [],
"assignedUser": "jane.doe@email.com",
"customFields": {}
}
]
}