Create Campaign
The Create Campaign API is used to create a new campaign with email, SMS, and voice channels.
Endpoint
POST /api/campaign
Request Example
- cURL
- Node.js
curl --location 'https://beta.intelsend.com/api/campaign' \\ --header 'x-user-id: 648b80839b30ddb88cdbab11' \\ --header 'Content-Type: application/json' \\ --header 'Cookie: __Secure-next-auth.session-token=YOUR_SESSION_TOKEN' \\ --data-raw '{ "campaignId": null, "name": "campaign Template", "settings": { "email": { "fromEmail": "info@intelsend.com", "templateId": "66d845e99bb64dbbd0d449d8", "version": 1 }, "sms": { "shortCode": "9498671145", "templateId": "6708a567654ca1d854afa3bd", "version": 1 }, "voice": { "callerId": "9498671008", "templateId": "67077eb17f4a5560aa9c3ea8", "version": 1 } }, "channel": ["email","sms","voice"], "contactListId": [ "687a0f67137b4868f1b1eaea", "6889fa1e53d9e06f64c13d59", "683d77584efab5b960439970" ] }'
import fetch from "node-fetch";
const response = await fetch("https://beta.intelsend.com/api/campaign
", {
method: "POST",
headers: {
"x-user-id": "648b80839b30ddb88cdbab11",
"Content-Type": "application/json",
"Cookie": "__Secure-next-auth.session-token=YOUR_SESSION_TOKEN"
},
body: JSON.stringify({
campaignId: null,
name: "campaign Template",
settings: {
email: {
fromEmail: "info@intelsend.com
",
templateId: "66d845e99bb64dbbd0d449d8",
version: 1
},
sms: {
shortCode: "9498671145",
templateId: "6708a567654ca1d854afa3bd",
version: 1
},
voice: {
callerId: "9498671008",
templateId: "67077eb17f4a5560aa9c3ea8",
version: 1
}
},
channel: ["email","sms","voice"],
contactListId: [
"687a0f67137b4868f1b1eaea",
"6889fa1e53d9e06f64c13d59",
"683d77584efab5b960439970"
]
})
});
const data = await response.json();
console.log(data);
Headers
| Header | Type | Required | Description |
|---|---|---|---|
x-user-id | string | ✅ | User identifier |
Content-Type | string | ✅ | Must be application/json |
Cookie | string | ✅ | Authentication session token |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
campaignId | string|null | ❌ | Pass null for new campaigns |
name | string | ✅ | Campaign name |
settings | object | ✅ | Contains channel-specific settings |
channel | string[] | ✅ | Channels to include (email, sms, voice) |
contactListId | string[] | ✅ | Array of contact list IDs |
Settings Object
| Channel | Field | Type | Required | Description |
|---|---|---|---|---|
email | fromEmail | string | ✅ | Sender email |
templateId | string | ✅ | Email template ID | |
version | number | ✅ | Template version | |
sms | shortCode | string | ✅ | Sender shortcode |
templateId | string | ✅ | SMS template ID | |
version | number | ✅ | Template version | |
voice | callerId | string | ✅ | Caller ID number |
templateId | string | ✅ | Voice template ID | |
version | number | ✅ | Template version |
Example Response
{ "result": "success" }
Tip
Ensure that the contact lists and templates exist before creating a campaign. Otherwise, the request may fail with validation errors.