Contacts
Record contact consent
Requires contacts:write, a current administrator and the Customer CDP plan feature. Evidence is bound to the contact’s current email or phone address. expected_version prevents overwriting newer evidence; a WhatsApp marketing revocation also updates the durable broadcast suppression.
POST
/
api
/
v2
/
accounts
/
{accountId}
/
contacts
/
{contactId}
/
consent
Record contact consent
curl --request POST \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent \
--header 'Content-Type: application/json' \
--data '
{
"channel": "whatsapp",
"evidence": "Consent recorded in CRM form 8842",
"expected_version": 0,
"purpose": "marketing",
"status": "granted"
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent"
payload = {
"channel": "whatsapp",
"evidence": "Consent recorded in CRM form 8842",
"expected_version": 0,
"purpose": "marketing",
"status": "granted"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
channel: 'whatsapp',
evidence: 'Consent recorded in CRM form 8842',
expected_version: 0,
purpose: 'marketing',
status: 'granted'
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent', 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.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent",
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([
'channel' => 'whatsapp',
'evidence' => 'Consent recorded in CRM form 8842',
'expected_version' => 0,
'purpose' => 'marketing',
'status' => 'granted'
]),
CURLOPT_HTTPHEADER => [
"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.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent"
payload := strings.NewReader("{\n \"channel\": \"whatsapp\",\n \"evidence\": \"Consent recorded in CRM form 8842\",\n \"expected_version\": 0,\n \"purpose\": \"marketing\",\n \"status\": \"granted\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent")
.header("Content-Type", "application/json")
.body("{\n \"channel\": \"whatsapp\",\n \"evidence\": \"Consent recorded in CRM form 8842\",\n \"expected_version\": 0,\n \"purpose\": \"marketing\",\n \"status\": \"granted\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel\": \"whatsapp\",\n \"evidence\": \"Consent recorded in CRM form 8842\",\n \"expected_version\": 0,\n \"purpose\": \"marketing\",\n \"status\": \"granted\"\n}"
response = http.request(request)
puts response.read_body{}{}{}{}{}{}{}{}{}{}Body
application/json
Consent evidence
Available options:
whatsapp, email Example:
"whatsapp"
Example:
"Consent recorded in CRM form 8842"
Example:
0
Available options:
marketing, service Example:
"marketing"
Available options:
granted, revoked, unknown Example:
"granted"
Response
OK
The response is of type object.
⌘I
Record contact consent
curl --request POST \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent \
--header 'Content-Type: application/json' \
--data '
{
"channel": "whatsapp",
"evidence": "Consent recorded in CRM form 8842",
"expected_version": 0,
"purpose": "marketing",
"status": "granted"
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent"
payload = {
"channel": "whatsapp",
"evidence": "Consent recorded in CRM form 8842",
"expected_version": 0,
"purpose": "marketing",
"status": "granted"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
channel: 'whatsapp',
evidence: 'Consent recorded in CRM form 8842',
expected_version: 0,
purpose: 'marketing',
status: 'granted'
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent', 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.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent",
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([
'channel' => 'whatsapp',
'evidence' => 'Consent recorded in CRM form 8842',
'expected_version' => 0,
'purpose' => 'marketing',
'status' => 'granted'
]),
CURLOPT_HTTPHEADER => [
"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.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent"
payload := strings.NewReader("{\n \"channel\": \"whatsapp\",\n \"evidence\": \"Consent recorded in CRM form 8842\",\n \"expected_version\": 0,\n \"purpose\": \"marketing\",\n \"status\": \"granted\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent")
.header("Content-Type", "application/json")
.body("{\n \"channel\": \"whatsapp\",\n \"evidence\": \"Consent recorded in CRM form 8842\",\n \"expected_version\": 0,\n \"purpose\": \"marketing\",\n \"status\": \"granted\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/contacts/{contactId}/consent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel\": \"whatsapp\",\n \"evidence\": \"Consent recorded in CRM form 8842\",\n \"expected_version\": 0,\n \"purpose\": \"marketing\",\n \"status\": \"granted\"\n}"
response = http.request(request)
puts response.read_body{}{}{}{}{}{}{}{}{}{}
