Customer CDP
Create a membership program
Requires contacts:write, Customer CDP, Membership and a current administrator. Active programs require terms and at least one benefit.
POST
/
api
/
v2
/
accounts
/
{accountId}
/
cdp
/
membership
/
programs
Create a membership program
curl --request POST \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/cdp/membership/programs \
--header 'Content-Type: application/json' \
--data '
{
"benefits": [
{
"allowance": 4,
"description": "<string>",
"key": "free_delivery",
"name": "Free delivery",
"points_cost": 0
}
],
"description": "<string>",
"experience": {
"allow_redemption": true,
"show_benefits": true,
"team_help": true,
"welcome": "<string>"
},
"inbox_id": 17,
"name": "Gold Club",
"points_enabled": true,
"points_label": "Points",
"status": "active",
"template_language": "ar",
"template_name": "<string>",
"term_days": 365,
"terms": "<string>",
"version": 4
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/cdp/membership/programs"
payload = {
"benefits": [
{
"allowance": 4,
"description": "<string>",
"key": "free_delivery",
"name": "Free delivery",
"points_cost": 0
}
],
"description": "<string>",
"experience": {
"allow_redemption": True,
"show_benefits": True,
"team_help": True,
"welcome": "<string>"
},
"inbox_id": 17,
"name": "Gold Club",
"points_enabled": True,
"points_label": "Points",
"status": "active",
"template_language": "ar",
"template_name": "<string>",
"term_days": 365,
"terms": "<string>",
"version": 4
}
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({
benefits: [
{
allowance: 4,
description: '<string>',
key: 'free_delivery',
name: 'Free delivery',
points_cost: 0
}
],
description: '<string>',
experience: {
allow_redemption: true,
show_benefits: true,
team_help: true,
welcome: '<string>'
},
inbox_id: 17,
name: 'Gold Club',
points_enabled: true,
points_label: 'Points',
status: 'active',
template_language: 'ar',
template_name: '<string>',
term_days: 365,
terms: '<string>',
version: 4
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/cdp/membership/programs', 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}/cdp/membership/programs",
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([
'benefits' => [
[
'allowance' => 4,
'description' => '<string>',
'key' => 'free_delivery',
'name' => 'Free delivery',
'points_cost' => 0
]
],
'description' => '<string>',
'experience' => [
'allow_redemption' => true,
'show_benefits' => true,
'team_help' => true,
'welcome' => '<string>'
],
'inbox_id' => 17,
'name' => 'Gold Club',
'points_enabled' => true,
'points_label' => 'Points',
'status' => 'active',
'template_language' => 'ar',
'template_name' => '<string>',
'term_days' => 365,
'terms' => '<string>',
'version' => 4
]),
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}/cdp/membership/programs"
payload := strings.NewReader("{\n \"benefits\": [\n {\n \"allowance\": 4,\n \"description\": \"<string>\",\n \"key\": \"free_delivery\",\n \"name\": \"Free delivery\",\n \"points_cost\": 0\n }\n ],\n \"description\": \"<string>\",\n \"experience\": {\n \"allow_redemption\": true,\n \"show_benefits\": true,\n \"team_help\": true,\n \"welcome\": \"<string>\"\n },\n \"inbox_id\": 17,\n \"name\": \"Gold Club\",\n \"points_enabled\": true,\n \"points_label\": \"Points\",\n \"status\": \"active\",\n \"template_language\": \"ar\",\n \"template_name\": \"<string>\",\n \"term_days\": 365,\n \"terms\": \"<string>\",\n \"version\": 4\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}/cdp/membership/programs")
.header("Content-Type", "application/json")
.body("{\n \"benefits\": [\n {\n \"allowance\": 4,\n \"description\": \"<string>\",\n \"key\": \"free_delivery\",\n \"name\": \"Free delivery\",\n \"points_cost\": 0\n }\n ],\n \"description\": \"<string>\",\n \"experience\": {\n \"allow_redemption\": true,\n \"show_benefits\": true,\n \"team_help\": true,\n \"welcome\": \"<string>\"\n },\n \"inbox_id\": 17,\n \"name\": \"Gold Club\",\n \"points_enabled\": true,\n \"points_label\": \"Points\",\n \"status\": \"active\",\n \"template_language\": \"ar\",\n \"template_name\": \"<string>\",\n \"term_days\": 365,\n \"terms\": \"<string>\",\n \"version\": 4\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/cdp/membership/programs")
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 \"benefits\": [\n {\n \"allowance\": 4,\n \"description\": \"<string>\",\n \"key\": \"free_delivery\",\n \"name\": \"Free delivery\",\n \"points_cost\": 0\n }\n ],\n \"description\": \"<string>\",\n \"experience\": {\n \"allow_redemption\": true,\n \"show_benefits\": true,\n \"team_help\": true,\n \"welcome\": \"<string>\"\n },\n \"inbox_id\": 17,\n \"name\": \"Gold Club\",\n \"points_enabled\": true,\n \"points_label\": \"Points\",\n \"status\": \"active\",\n \"template_language\": \"ar\",\n \"template_name\": \"<string>\",\n \"term_days\": 365,\n \"terms\": \"<string>\",\n \"version\": 4\n}"
response = http.request(request)
puts response.read_body{}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}Path Parameters
HueChat account ID
Body
application/json
Membership program
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Example:
17
Example:
"Gold Club"
Example:
"Points"
Available options:
draft, active, paused, archived Example:
"active"
Example:
"ar"
Example:
365
Example:
4
Response
OK
The response is of type object.
⌘I
Create a membership program
curl --request POST \
--url https://app.huechat.ai/api/v2/accounts/{accountId}/cdp/membership/programs \
--header 'Content-Type: application/json' \
--data '
{
"benefits": [
{
"allowance": 4,
"description": "<string>",
"key": "free_delivery",
"name": "Free delivery",
"points_cost": 0
}
],
"description": "<string>",
"experience": {
"allow_redemption": true,
"show_benefits": true,
"team_help": true,
"welcome": "<string>"
},
"inbox_id": 17,
"name": "Gold Club",
"points_enabled": true,
"points_label": "Points",
"status": "active",
"template_language": "ar",
"template_name": "<string>",
"term_days": 365,
"terms": "<string>",
"version": 4
}
'import requests
url = "https://app.huechat.ai/api/v2/accounts/{accountId}/cdp/membership/programs"
payload = {
"benefits": [
{
"allowance": 4,
"description": "<string>",
"key": "free_delivery",
"name": "Free delivery",
"points_cost": 0
}
],
"description": "<string>",
"experience": {
"allow_redemption": True,
"show_benefits": True,
"team_help": True,
"welcome": "<string>"
},
"inbox_id": 17,
"name": "Gold Club",
"points_enabled": True,
"points_label": "Points",
"status": "active",
"template_language": "ar",
"template_name": "<string>",
"term_days": 365,
"terms": "<string>",
"version": 4
}
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({
benefits: [
{
allowance: 4,
description: '<string>',
key: 'free_delivery',
name: 'Free delivery',
points_cost: 0
}
],
description: '<string>',
experience: {
allow_redemption: true,
show_benefits: true,
team_help: true,
welcome: '<string>'
},
inbox_id: 17,
name: 'Gold Club',
points_enabled: true,
points_label: 'Points',
status: 'active',
template_language: 'ar',
template_name: '<string>',
term_days: 365,
terms: '<string>',
version: 4
})
};
fetch('https://app.huechat.ai/api/v2/accounts/{accountId}/cdp/membership/programs', 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}/cdp/membership/programs",
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([
'benefits' => [
[
'allowance' => 4,
'description' => '<string>',
'key' => 'free_delivery',
'name' => 'Free delivery',
'points_cost' => 0
]
],
'description' => '<string>',
'experience' => [
'allow_redemption' => true,
'show_benefits' => true,
'team_help' => true,
'welcome' => '<string>'
],
'inbox_id' => 17,
'name' => 'Gold Club',
'points_enabled' => true,
'points_label' => 'Points',
'status' => 'active',
'template_language' => 'ar',
'template_name' => '<string>',
'term_days' => 365,
'terms' => '<string>',
'version' => 4
]),
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}/cdp/membership/programs"
payload := strings.NewReader("{\n \"benefits\": [\n {\n \"allowance\": 4,\n \"description\": \"<string>\",\n \"key\": \"free_delivery\",\n \"name\": \"Free delivery\",\n \"points_cost\": 0\n }\n ],\n \"description\": \"<string>\",\n \"experience\": {\n \"allow_redemption\": true,\n \"show_benefits\": true,\n \"team_help\": true,\n \"welcome\": \"<string>\"\n },\n \"inbox_id\": 17,\n \"name\": \"Gold Club\",\n \"points_enabled\": true,\n \"points_label\": \"Points\",\n \"status\": \"active\",\n \"template_language\": \"ar\",\n \"template_name\": \"<string>\",\n \"term_days\": 365,\n \"terms\": \"<string>\",\n \"version\": 4\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}/cdp/membership/programs")
.header("Content-Type", "application/json")
.body("{\n \"benefits\": [\n {\n \"allowance\": 4,\n \"description\": \"<string>\",\n \"key\": \"free_delivery\",\n \"name\": \"Free delivery\",\n \"points_cost\": 0\n }\n ],\n \"description\": \"<string>\",\n \"experience\": {\n \"allow_redemption\": true,\n \"show_benefits\": true,\n \"team_help\": true,\n \"welcome\": \"<string>\"\n },\n \"inbox_id\": 17,\n \"name\": \"Gold Club\",\n \"points_enabled\": true,\n \"points_label\": \"Points\",\n \"status\": \"active\",\n \"template_language\": \"ar\",\n \"template_name\": \"<string>\",\n \"term_days\": 365,\n \"terms\": \"<string>\",\n \"version\": 4\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.huechat.ai/api/v2/accounts/{accountId}/cdp/membership/programs")
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 \"benefits\": [\n {\n \"allowance\": 4,\n \"description\": \"<string>\",\n \"key\": \"free_delivery\",\n \"name\": \"Free delivery\",\n \"points_cost\": 0\n }\n ],\n \"description\": \"<string>\",\n \"experience\": {\n \"allow_redemption\": true,\n \"show_benefits\": true,\n \"team_help\": true,\n \"welcome\": \"<string>\"\n },\n \"inbox_id\": 17,\n \"name\": \"Gold Club\",\n \"points_enabled\": true,\n \"points_label\": \"Points\",\n \"status\": \"active\",\n \"template_language\": \"ar\",\n \"template_name\": \"<string>\",\n \"term_days\": 365,\n \"terms\": \"<string>\",\n \"version\": 4\n}"
response = http.request(request)
puts response.read_body{}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}{
"code": "plan_disabled",
"error": "Record not found or unavailable",
"feature": "customer_cdp"
}
