curl --request POST \
--url https://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"opt_in": true
}'import requests
url = "https://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in"
payload = { "opt_in": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({opt_in: true})
};
fetch('https://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in', 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://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in",
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([
'opt_in' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in"
payload := strings.NewReader("{\n \"opt_in\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"opt_in\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"opt_in\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"name": "John Doe",
"blocked": true,
"date_of_birth": "1970-01-01",
"phone_number": "+4915224367929",
"email": "jsmith@example.com",
"address": "<string>",
"custom_1": "<string>",
"custom_2": "<string>",
"custom_3": "<string>",
"custom_4": "<string>",
"custom_5": "<string>",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z",
"customers": [
{
"id": 123,
"display_id": 4915223567929,
"canonical_id": "DE.abc123",
"name": "John Doe",
"username": "john_doe",
"profile": {
"id": 123,
"name": "John Doe",
"blocked": true,
"date_of_birth": "1970-01-01",
"phone_number": "+4915224367929",
"email": "jsmith@example.com",
"address": "<string>",
"custom_1": "<string>",
"custom_2": "<string>",
"custom_3": "<string>",
"custom_4": "<string>",
"custom_5": "<string>",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
},
"conversations": [
{
"id": 123
}
]
}
]
}
}Update the current marketing opt in or opt out for a profile. This will generate an activity.
The current opt in or opt out status can be determined by looking at activities or using the GET request on this endpoint. If there is an activity of type “marketing_opt_in” and no “marketing_opt_out” after that, the profile is opted in.
curl --request POST \
--url https://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"opt_in": true
}'import requests
url = "https://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in"
payload = { "opt_in": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({opt_in: true})
};
fetch('https://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in', 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://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in",
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([
'opt_in' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in"
payload := strings.NewReader("{\n \"opt_in\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"opt_in\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant_domain}/third-party/v1/profiles/{id}/marketing-opt-in")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"opt_in\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"name": "John Doe",
"blocked": true,
"date_of_birth": "1970-01-01",
"phone_number": "+4915224367929",
"email": "jsmith@example.com",
"address": "<string>",
"custom_1": "<string>",
"custom_2": "<string>",
"custom_3": "<string>",
"custom_4": "<string>",
"custom_5": "<string>",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z",
"customers": [
{
"id": 123,
"display_id": 4915223567929,
"canonical_id": "DE.abc123",
"name": "John Doe",
"username": "john_doe",
"profile": {
"id": 123,
"name": "John Doe",
"blocked": true,
"date_of_birth": "1970-01-01",
"phone_number": "+4915224367929",
"email": "jsmith@example.com",
"address": "<string>",
"custom_1": "<string>",
"custom_2": "<string>",
"custom_3": "<string>",
"custom_4": "<string>",
"custom_5": "<string>",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
},
"conversations": [
{
"id": 123
}
]
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
If a profile is not currently opted in and this field is true, the profile will be opted in. If a profile is already opted in and this field is true, nothing will change. Same applies to setting this field to false and therefore opting out.
Response
Success
Profile data of a customer. A profile can have many customers. A customer belongs to one profile. Can be used to connect a real person with multiple messengers (aka customers) to one profile.
Show child attributes
Show child attributes