Send
Core library Send — create and manage sends, cancel a send, and retrieve aggregate or per-send tracking.
The Send namespace covers user-initiated sends: creating sends from an email and lists, retrieving send rows, listing targeted lists, canceling a send, and accessing tracking (including static Send.Tracking.Retrieve and instance helpers on send.Tracking).
Requires Platform.Load("core", "1.1.5") before use.
Methods
| Method | Returns | Description |
|---|---|---|
Send.Init(id) |
SendInstance | Bind to a send by numeric ID |
Send.Add(emailKey, listIds[, options]) |
string | Create a send |
Send.Retrieve(filter) |
object[] | Query sends |
Send.RetrieveLists(filter) |
object[] | Lists targeted by matching sends |
<SendInstance>.Remove() |
string | Delete the bound send |
<SendInstance>.CancelSend() |
string | Attempt to cancel the send |
Send.Tracking.Retrieve(filter) |
object[] | Tracking rows (static; no Send.Init required) |
<SendInstance>.Tracking.ClickRetrieve(filter) |
object[] | Click tracking for this send |
<SendInstance>.Tracking.TotalByIntervalRetrieve(type, startDate, endDate, groupBy) |
object[] | Aggregated tracking by interval |
Send.Init
Initializes a send instance from its numeric send ID. Required before calling instance methods such as Remove(), CancelSend(), or Tracking.*.
Syntax
Send.Init(id)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
number | Yes | Numeric ID of the send |
Return value
SendInstance
Examples
Platform.Load("core", "1");
var s = Send.Init(12345);
Send.Add
Creates a send for the given email customer key and list IDs. Optional options can override From name, From address, subject, send time, etc.
Syntax
Send.Add(emailKey, listIds[, options])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
emailKey |
string | Yes | Customer key of the email |
listIds |
array | Yes | Array of list IDs |
options |
object | No | Send-time overrides |
Return value
"OK" on success.
Examples
Platform.Load("core", "1.1.5");
var status = Send.Add("test_email", [12345, 12346]);
var options = {
FromName: "JSON Specified Name",
FromAddress: "aruiz@example.com",
Subject: "JSON Test Mail"
};
var status2 = Send.Add("test_email", [12345, 12346], options);
Send.Retrieve
Returns send objects matching the supplied filter.
Syntax
Send.Retrieve(filter)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
filter |
object | Yes | WSProxy-style filter (simple or compound) |
Return value
object[]
Examples
Platform.Load("core", "1.1.5");
var sends = Send.Retrieve({ Property: "ID", SimpleOperator: "equals", Value: 12345 });
Send.RetrieveLists
Returns the lists that were targeted by the sends matching the filter. The filter must restrict to specific send ID(s).
Syntax
Send.RetrieveLists(filter)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
filter |
object | Yes | Filter on send ID(s) |
Return value
object[] — list objects for matching sends.
Examples
Platform.Load("core", "1.1.5");
var listsSentTo = Send.RetrieveLists({
Property: "SendID",
SimpleOperator: "equals",
Value: 12345
});
<SendInstance>.Remove
Deletes the send record bound to this instance.
Syntax
<SendInstance>.Remove()
Return value
"OK" on success.
Examples
Platform.Load("core", "1.1.5");
var s = Send.Init(12345);
s.Remove();
<SendInstance>.CancelSend
Attempts to cancel the bound send.
Syntax
<SendInstance>.CancelSend()
Return value
"OK" on success.
Examples
Platform.Load("core", "1.1.5");
var mySend = Send.Init(12345);
var status = mySend.CancelSend();
Send.Tracking.Retrieve
Static tracking retrieval — no Send.Init() required. Returns tracking rows matching the filter.
Syntax
Send.Tracking.Retrieve(filter)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
filter |
object | Yes | WSProxy-style filter |
Return value
object[]
Examples
Platform.Load("core", "1.1.5");
var sendTracking = Send.Tracking.Retrieve({
Property: "SendID",
SimpleOperator: "equals",
Value: 12345
});
<SendInstance>.Tracking.ClickRetrieve
Returns click-tracking rows for the bound send that match the filter.
Syntax
<SendInstance>.Tracking.ClickRetrieve(filter)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
filter |
object | Yes | Restricts click rows |
Return value
object[]
Examples
Platform.Load("core", "1.1.5");
var singleSend = Send.Init(12345);
var results = singleSend.Tracking.ClickRetrieve({
Property: "ID",
SimpleOperator: "equals",
Value: 12345
});
<SendInstance>.Tracking.TotalByIntervalRetrieve
Aggregates tracking by type over the date range, grouped by groupBy ("day" or "hour"). Dates use MM-DD-YYYY.
Syntax
<SendInstance>.Tracking.TotalByIntervalRetrieve(type, startDate, endDate, groupBy)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
type |
string | Yes | "Send", "Open", "Click", "Bounce", or "Unsubscribe" |
startDate |
string | Yes | Start (MM-DD-YYYY) |
endDate |
string | Yes | End (MM-DD-YYYY) |
groupBy |
string | Yes | "day" or "hour" |
Return value
object[]
Examples
Platform.Load("core", "1.1.5");
var singleSend = Send.Init(12345);
var results = singleSend.Tracking.TotalByIntervalRetrieve(
"Click",
"07-01-2010",
"07-31-2010",
"day"
);