Create a Campaign
Create a Campaign
POST
https://api.ocamba.com/v1/hood/campaigns
Creates a new campaign with the provided data. All required fields must be included in the request body. Upon successful creation, the new campaign is persisted and the full campaign object is returned in the response.
Rate limits:
Burst: 10/s
Steady: 150/m
Request schema
bodyResponse schemas
›
200
application/json
›
400
application/json
›
500
application/json
POST https://api.ocamba.com/v1/hood/campaigns HTTP/1.1
Host: api.ocamba.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
{
"name": "My First Campaign",
"description": "This is my first campaign on the Hood application.",
"labels": [
"cars",
"bwm",
"audi",
"volkswagen"
],
"metadata": {},
"ab_test": {},
"messages": [
{}
],
"recurrence": {},
"utm_tracking": {},
"is_draft": true,
"send_in_profile_time_zone": true,
"send_if_profile_time_passed": true,
"quiet_hours": {},
"targeting": {},
"deal_id": "1000251",
"run_immediately": null
}
curl -X POST "https://api.ocamba.com/v1/hood/campaigns" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"My First Campaign","description":"This is my first campaign on the Hood application.","labels":["cars","bwm","audi","volkswagen"],"metadata":{},"ab_test":{},"messages":[{}],"recurrence":{},"utm_tracking":{},"is_draft":true,"send_in_profile_time_zone":true,"send_if_profile_time_passed":true,"quiet_hours":{},"targeting":{},"deal_id":"1000251","run_immediately":null}'
fetch("https://api.ocamba.com/v1/hood/campaigns", {
method: "POST",
headers: { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json" },
body: JSON.stringify(
{
"name": "My First Campaign",
"description": "This is my first campaign on the Hood application.",
"labels": [
"cars",
"bwm",
"audi",
"volkswagen"
],
"metadata": {},
"ab_test": {},
"messages": [
{}
],
"recurrence": {},
"utm_tracking": {},
"is_draft": true,
"send_in_profile_time_zone": true,
"send_if_profile_time_passed": true,
"quiet_hours": {},
"targeting": {},
"deal_id": "1000251",
"run_immediately": null
}
)
}).then(r => r.json());
$ch = curl_init("https://api.ocamba.com/v1/hood/campaigns");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $token",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
[
"name" => "My First Campaign",
"description" => "This is my first campaign on the Hood application.",
"labels" => [
"cars",
"bwm",
"audi",
"volkswagen"
],
"metadata" => [],
"ab_test" => [],
"messages" => [
[]
],
"recurrence" => [],
"utm_tracking" => [],
"is_draft" => true,
"send_in_profile_time_zone" => true,
"send_if_profile_time_passed" => true,
"quiet_hours" => [],
"targeting" => [],
"deal_id" => "1000251",
"run_immediately" => null
]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
Responses
200 OK
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "1017164",
"company_id": "6197120",
"creator_id": "1000223",
"name": "Example Campaign",
"messages": [
{
"id": "2588",
"company_id": "6197120",
"name": "dva",
"campaign_id": "1017164",
"channel": "email",
"integration_id": "1990",
"template_id": "1084",
"email": {
"sender_name": "nikola",
"sender_email": "[email protected]",
"subject": "Prikolice",
"preheader": "Nove prikolice 40%",
"html": {
"en": "Html document example",
"es": "Ejemplo de documento HTML"
}
},
"winner": 0,
"primary_lang": "en"
}
],
"utm_tracking": {
"enabled": 1,
"utm_source": "${OCMH_UTM_SOURCE}",
"utm_medium": "${OCMH_UTM_MEDIUM}",
"utm_campaign": "${OCMH_CAMPAIGN_NAME}"
},
"status": "active",
"effective_status": "active",
"send_in_profile_time_zone": false,
"send_if_profile_time_passed": false,
"score": 0
}
400 Bad Request
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"code": 400,
"title": "Bad request.",
"message": "The request body is not valid.",
"trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}
500 Internal Server Error
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
{
"code": 500,
"title": "Internal server error.",
"trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}
Responses
Note
1
If you pass multiple messages of the same channel, then the ab_test field is required. You can add up to 4 messages of the same channel, and they will be distributed evenly when in testing phase.
2
Features like multichannel are available to premium users only. If you find these features interesting, contact us to upgrade your plan!
Tip
1
If you don’t want to lose progress on a campaign, you can save it as a draft, by adding ‘draft’ as status field.
Warning
1
If you pass the run_immediately field as 1, the campaign will execute automatically upon it’s creation.