Create communication campaign
curl --request POST \
--url https://api.ecomailhub.younegotiate.com/communications/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template_id": 15,
"group_id": 21,
"frequency": "weekly",
"start_date": "2026-07-13",
"end_date": "2026-08-13",
"day_of_week": 1
}
'import requests
url = "https://api.ecomailhub.younegotiate.com/communications/campaigns"
payload = {
"template_id": 15,
"group_id": 21,
"frequency": "weekly",
"start_date": "2026-07-13",
"end_date": "2026-08-13",
"day_of_week": 1
}
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({
template_id: 15,
group_id: 21,
frequency: 'weekly',
start_date: '2026-07-13',
end_date: '2026-08-13',
day_of_week: 1
})
};
fetch('https://api.ecomailhub.younegotiate.com/communications/campaigns', 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://api.ecomailhub.younegotiate.com/communications/campaigns",
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([
'template_id' => 15,
'group_id' => 21,
'frequency' => 'weekly',
'start_date' => '2026-07-13',
'end_date' => '2026-08-13',
'day_of_week' => 1
]),
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://api.ecomailhub.younegotiate.com/communications/campaigns"
payload := strings.NewReader("{\n \"template_id\": 15,\n \"group_id\": 21,\n \"frequency\": \"weekly\",\n \"start_date\": \"2026-07-13\",\n \"end_date\": \"2026-08-13\",\n \"day_of_week\": 1\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://api.ecomailhub.younegotiate.com/communications/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": 15,\n \"group_id\": 21,\n \"frequency\": \"weekly\",\n \"start_date\": \"2026-07-13\",\n \"end_date\": \"2026-08-13\",\n \"day_of_week\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ecomailhub.younegotiate.com/communications/campaigns")
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 \"template_id\": 15,\n \"group_id\": 21,\n \"frequency\": \"weekly\",\n \"start_date\": \"2026-07-13\",\n \"end_date\": \"2026-08-13\",\n \"day_of_week\": 1\n}"
response = http.request(request)
puts response.read_body{
"message": "Campaign created.",
"data": {
"id": 33,
"template_id": 15,
"group_id": 21,
"template": {
"id": 15,
"name": "Welcome Creditor"
},
"group": {
"id": 21,
"name": "Active Members"
},
"frequency": {
"value": "weekly",
"label": "Weekly"
},
"start_date": "2026-07-13",
"end_date": "2026-08-13",
"day_of_week": 1,
"day_of_month": null,
"terms": "Weekly on Monday",
"is_run_immediately": false,
"created_at": "2026-07-06T12:00:00.000000Z",
"updated_at": "2026-07-06T12:00:00.000000Z"
}
}{
"message": "Unauthenticated."
}{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required."
]
}
}Create communication campaign
Create a scheduled EcoMail Hub communication campaign. Recurring campaigns require end_date; weekly campaigns require day_of_week; monthly campaigns require day_of_month.
POST
/
communications
/
campaigns
Create communication campaign
curl --request POST \
--url https://api.ecomailhub.younegotiate.com/communications/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template_id": 15,
"group_id": 21,
"frequency": "weekly",
"start_date": "2026-07-13",
"end_date": "2026-08-13",
"day_of_week": 1
}
'import requests
url = "https://api.ecomailhub.younegotiate.com/communications/campaigns"
payload = {
"template_id": 15,
"group_id": 21,
"frequency": "weekly",
"start_date": "2026-07-13",
"end_date": "2026-08-13",
"day_of_week": 1
}
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({
template_id: 15,
group_id: 21,
frequency: 'weekly',
start_date: '2026-07-13',
end_date: '2026-08-13',
day_of_week: 1
})
};
fetch('https://api.ecomailhub.younegotiate.com/communications/campaigns', 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://api.ecomailhub.younegotiate.com/communications/campaigns",
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([
'template_id' => 15,
'group_id' => 21,
'frequency' => 'weekly',
'start_date' => '2026-07-13',
'end_date' => '2026-08-13',
'day_of_week' => 1
]),
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://api.ecomailhub.younegotiate.com/communications/campaigns"
payload := strings.NewReader("{\n \"template_id\": 15,\n \"group_id\": 21,\n \"frequency\": \"weekly\",\n \"start_date\": \"2026-07-13\",\n \"end_date\": \"2026-08-13\",\n \"day_of_week\": 1\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://api.ecomailhub.younegotiate.com/communications/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": 15,\n \"group_id\": 21,\n \"frequency\": \"weekly\",\n \"start_date\": \"2026-07-13\",\n \"end_date\": \"2026-08-13\",\n \"day_of_week\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ecomailhub.younegotiate.com/communications/campaigns")
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 \"template_id\": 15,\n \"group_id\": 21,\n \"frequency\": \"weekly\",\n \"start_date\": \"2026-07-13\",\n \"end_date\": \"2026-08-13\",\n \"day_of_week\": 1\n}"
response = http.request(request)
puts response.read_body{
"message": "Campaign created.",
"data": {
"id": 33,
"template_id": 15,
"group_id": 21,
"template": {
"id": 15,
"name": "Welcome Creditor"
},
"group": {
"id": 21,
"name": "Active Members"
},
"frequency": {
"value": "weekly",
"label": "Weekly"
},
"start_date": "2026-07-13",
"end_date": "2026-08-13",
"day_of_week": 1,
"day_of_month": null,
"terms": "Weekly on Monday",
"is_run_immediately": false,
"created_at": "2026-07-06T12:00:00.000000Z",
"updated_at": "2026-07-06T12:00:00.000000Z"
}
}{
"message": "Unauthenticated."
}{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required."
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Example:
15
Example:
21
Available options:
once, daily, weekly, monthly Example:
"weekly"
Must be tomorrow or later and no more than one year from today.
Example:
"2026-07-13"
Required for daily, weekly, and monthly campaigns. Must be on or after start_date and no more than one year after start_date.
Example:
"2026-08-13"
Required when frequency is weekly. Uses 0 for Sunday through 6 for Saturday.
Required range:
0 <= x <= 6Example:
1
Required when frequency is monthly.
Required range:
0 <= x <= 31Example:
15
Last modified on July 19, 2026
Was this page helpful?
⌘I

