Skip to main content

Creating a Campaign

This endpoint creates a new email campaign in the system that stores details such as:

  • Campaign name
  • Subject line
  • Content (HTML or text)
  • Associated recipient lists

Later, campaigns can be sent using the Send Campaign Endpoint.

Endpoint

POST /campaign/create

Headers

HeaderValueRequired
AuthorizationBearer <your-api-key>✅ Yes
Content-Typeapplication/json✅ Yes

Body Parameters

ParameterTypeRequiredDescription
nameString✅ YesA friendly name for the campaign.
subjectString✅ YesThe subject line of the emails.
contentString❌ OptionalThe HTML or text content of the campaign.
recepientListArray of Strings❌ OptionalIDs of recipient lists to associate with the campaign.

Examples

Request

const response = await fetch("https://api.basicsengage.com/api/v0/dev/campaign/create", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <your-api-key>"
},
body: JSON.stringify({
name: "Weekly Newsletter",
subject: "Our Latest Updates",
content: "<h1>Hello Subscribers</h1>",
recepientList: ["640cfa8d1", "640cfa8d2"]
})
});

const data = await response.json();
console.log(data);

Responses

{
"status": "success",
"data": {
"campaign": {
"_id": "64a55f123...",
"name": "Holiday Sale",
"subject": "Exclusive 50% Off",
"content": "<p>Happy Holidays!</p>"
}
}
}