POST /contacts
Creates a new contact.
Required Parameters
Parameter | Type | Description |
---|---|---|
identifier | String | The identifier of the contact (e.g. phone number in WhatsApp) |
source | Source | The source of the contact (e.g. whatsapp ) |
name | String | The name of the contact |
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} ) |
assigned_user | String | Email of the user that you want to assign to a contact |
caution
When passing custom_fields
or tags
make sure that they exist in your account. See tags and custom_fields in your settings.
Same applies for assigned_user
, must be a valid email of a user in your account.
Example Request
- cURL
- Node
- Ruby
- Go
- PHP
- Python
curl -X POST "https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8" \
-H "Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM" \
-H "Content-Type: application/json"
-d '{
"source": "whatsapp",
"identifier": "123456789",
"name": "John Doe"
}'
const axios = require('axios');
const response = await axios.post(
'https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8',
'',
{
headers: {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json'
}
}
);
require 'net/http'
uri = URI('https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM'
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"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("POST", "https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8", nil)
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, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'Authorization': 'Bearer test_gshuPaZoeEG6ovbc8M79w0QyM',
'Content-Type': 'application/json',
}
response = requests.post('https://api.callbell.eu/v1/contacts/414a6d692bd645ed803f2e7ce360d4c8', headers=headers)
Response
Parameter | Type | Description |
---|---|---|
contact | Contact | The contact which was created. |
Example Response
response.json
{
"contact": [
{
"uuid": "414a6d692bd645ed803f2e7ce360d4c8",
"name": "John Doe",
"phoneNumber": "123456789",
"avatarUrl": null,
"createdAt": "2020-11-13T21:08:53Z",
"source": "whatsapp",
"href": "https://dash.callbell.eu/contacts/414a6d692bd645ed803f2e7ce360d4c8",
"tags": [],
"assignedUser": null,
"customFields": {}
}
]
}