Contacts and enrollments
Enroll a contact in a campaign
Enrolls one contact, by contactId or sent inline as contact (created or updated first, as the contacts endpoint does), in a launched campaign that keeps open for new contacts. variables are written onto the contact’s attributes and kept on the enrollment. A contact already enrolled answers with its enrollment and 200; another contact with the same number is refused with 409. Needs a Full access key.
POST
/
api
/
v2
/
campaigns
/
{campaignId}
/
enrollments
Enroll a contact in a campaign
curl --request POST \
--url https://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"contact": {
"attributes": {},
"email": "jsmith@example.com",
"name": "<string>",
"phone": "<string>",
"timeZone": "<string>"
},
"contactId": "<string>",
"variables": {}
}
'import requests
url = "https://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments"
payload = {
"contact": {
"attributes": {},
"email": "jsmith@example.com",
"name": "<string>",
"phone": "<string>",
"timeZone": "<string>"
},
"contactId": "<string>",
"variables": {}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
contact: {
attributes: {},
email: 'jsmith@example.com',
name: '<string>',
phone: '<string>',
timeZone: '<string>'
},
contactId: '<string>',
variables: {}
})
};
fetch('https://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments', 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.cntillion.com/api/v2/campaigns/{campaignId}/enrollments",
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([
'contact' => [
'attributes' => [
],
'email' => 'jsmith@example.com',
'name' => '<string>',
'phone' => '<string>',
'timeZone' => '<string>'
],
'contactId' => '<string>',
'variables' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.cntillion.com/api/v2/campaigns/{campaignId}/enrollments"
payload := strings.NewReader("{\n \"contact\": {\n \"attributes\": {},\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"timeZone\": \"<string>\"\n },\n \"contactId\": \"<string>\",\n \"variables\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contact\": {\n \"attributes\": {},\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"timeZone\": \"<string>\"\n },\n \"contactId\": \"<string>\",\n \"variables\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact\": {\n \"attributes\": {},\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"timeZone\": \"<string>\"\n },\n \"contactId\": \"<string>\",\n \"variables\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"attempts": 123,
"campaignId": "<string>",
"contactId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"lastError": "<string>",
"nextAttemptAt": "2023-11-07T05:31:56Z",
"outcome": "reactivated",
"outcomeAt": "2023-11-07T05:31:56Z",
"outcomeDetail": "<string>",
"repliedAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"status": "queued",
"updatedAt": "2023-11-07T05:31:56Z",
"variables": {},
"voiceCallId": "<string>"
}
}{
"data": {
"attempts": 123,
"campaignId": "<string>",
"contactId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"lastError": "<string>",
"nextAttemptAt": "2023-11-07T05:31:56Z",
"outcome": "reactivated",
"outcomeAt": "2023-11-07T05:31:56Z",
"outcomeDetail": "<string>",
"repliedAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"status": "queued",
"updatedAt": "2023-11-07T05:31:56Z",
"variables": {},
"voiceCallId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
workspaceApiKeyworkspaceApiKeyHeader
Headers
Body
application/json
⌘I
Enroll a contact in a campaign
curl --request POST \
--url https://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"contact": {
"attributes": {},
"email": "jsmith@example.com",
"name": "<string>",
"phone": "<string>",
"timeZone": "<string>"
},
"contactId": "<string>",
"variables": {}
}
'import requests
url = "https://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments"
payload = {
"contact": {
"attributes": {},
"email": "jsmith@example.com",
"name": "<string>",
"phone": "<string>",
"timeZone": "<string>"
},
"contactId": "<string>",
"variables": {}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
contact: {
attributes: {},
email: 'jsmith@example.com',
name: '<string>',
phone: '<string>',
timeZone: '<string>'
},
contactId: '<string>',
variables: {}
})
};
fetch('https://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments', 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.cntillion.com/api/v2/campaigns/{campaignId}/enrollments",
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([
'contact' => [
'attributes' => [
],
'email' => 'jsmith@example.com',
'name' => '<string>',
'phone' => '<string>',
'timeZone' => '<string>'
],
'contactId' => '<string>',
'variables' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.cntillion.com/api/v2/campaigns/{campaignId}/enrollments"
payload := strings.NewReader("{\n \"contact\": {\n \"attributes\": {},\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"timeZone\": \"<string>\"\n },\n \"contactId\": \"<string>\",\n \"variables\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contact\": {\n \"attributes\": {},\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"timeZone\": \"<string>\"\n },\n \"contactId\": \"<string>\",\n \"variables\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cntillion.com/api/v2/campaigns/{campaignId}/enrollments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact\": {\n \"attributes\": {},\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"timeZone\": \"<string>\"\n },\n \"contactId\": \"<string>\",\n \"variables\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"attempts": 123,
"campaignId": "<string>",
"contactId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"lastError": "<string>",
"nextAttemptAt": "2023-11-07T05:31:56Z",
"outcome": "reactivated",
"outcomeAt": "2023-11-07T05:31:56Z",
"outcomeDetail": "<string>",
"repliedAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"status": "queued",
"updatedAt": "2023-11-07T05:31:56Z",
"variables": {},
"voiceCallId": "<string>"
}
}{
"data": {
"attempts": 123,
"campaignId": "<string>",
"contactId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"lastError": "<string>",
"nextAttemptAt": "2023-11-07T05:31:56Z",
"outcome": "reactivated",
"outcomeAt": "2023-11-07T05:31:56Z",
"outcomeDetail": "<string>",
"repliedAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"status": "queued",
"updatedAt": "2023-11-07T05:31:56Z",
"variables": {},
"voiceCallId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}