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
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 |
caution
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
, use a valid email address associated with a user in your account.
Example Request
- cURL
- Node
- Ruby
- Go
- PHP
- Python
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"}'
import axios from 'axios';
const response = await axios.patch(
'https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8',
// '{"name": "Joe Doe NEW"}',
{
'name': 'Joe Doe NEW'
},
{
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 = '{"name": "Joe Doe NEW"}'
req.body = {
'name' => 'Joe Doe NEW'
}.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"}`)
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, '{"name": "Joe Doe NEW"}');
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
# Already added when you pass json=
# 'Content-Type': 'application/json',
}
json_data = {
'name': 'Joe Doe NEW',
}
response = requests.patch('https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8', headers=headers, json=json_data)
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",
"tags": [],
"assignedUser": "jane.doe@email.com",
"customFields": {}
}
]
}