Retrieve a Triggered Send definition's summary verified

Learn how to retrieve a TriggeredSend Definition's summary (tracking) in Salesforce Marketing Cloud (SFMC) with SSJS (server-side JavaScript). Code snippets include the WSProxy and Core methods.

Core

var customerKey = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";

var tsd = TriggeredSend.Init(customerKey);

var result = tsd.Tracking.Retrieve();
<script runat="server">

    Platform.Load("core", "1");

    try {

        var customerKey = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";

        var tsd = TriggeredSend.Init(customerKey);

        var result = tsd.Tracking.Retrieve();

        Write(Stringify(result));

    } catch (error) {

        Write(Stringify(error));

    }

</script>
[
  {
    "Client": {
      "ID": 100000000
    },
    "CustomerKey": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
    "Name": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
    "ObjectID": "ac483156-585f-ed11-b844-48df37dc126a",
    "LastSent": "2022-11-29T03:27:02.517",
    "Sends": {
      "Total": 1025
    },
    "Bounces": {
      "Total": 0,
      "HardBounces": 0,
      "SoftBounces": 0,
      "BlockBounces": 0,
      "TechnicalBounces": 0,
      "UnknownBounces": 0
    },
    "Clicks": {
      "Total": 55,
      "Unique": 3
    },
    "Opens": {
      "Total": 100,
      "Unique": 67
    },
    "Unsubscribes": {
      "Unique": 0
    }
  }
]

WSProxy

var api = new Script.Util.WSProxy();

var request = api.retrieve("TriggeredSendDefinition", ["ObjectID"], {
    Property: "Name",
    SimpleOperator: "equals",
    Value: "MyTriggeredSend"
});

var objectId = request.Results[0].ObjectID;

var cols = [
    "Sent", 
    "CustomerKey", 
    "NotSentDueToOptOut", 
    "NotSentDueToUndeliverable", 
    "Bounces", 
    "Opens", 
    "UniqueOpens", 
    "Clicks", 
    "UniqueClicks", 
    "OptOuts", 
    "SurveyResponses", 
    "FTAFRequests", 
    "FTAFEmailsSent", 
    "FTAFOptIns", 
    "Conversions", 
    "UniqueConversions", 
    "InProcess", 
    "NotSentDueToError", 
    "Queued"
];

var result = api.retrieve("TriggeredSendSummary", cols, {
    Property: "TriggeredSendDefinition.ObjectID",
    SimpleOperator: "equals",
    Value: objectId
});
<script runat="server">

    Platform.Load("core", "1");

    var api = new Script.Util.WSProxy();

    try {

        var request = api.retrieve("TriggeredSendDefinition", ["ObjectID"], {
            Property: "Name",
            SimpleOperator: "equals",
            Value: "MyTriggeredSend"
        });

        var objectId = request.Results[0].ObjectID;

        var cols = [
            "Sent", 
            "CustomerKey", 
            "NotSentDueToOptOut", 
            "NotSentDueToUndeliverable", 
            "Bounces", 
            "Opens", 
            "UniqueOpens", 
            "Clicks", 
            "UniqueClicks", 
            "OptOuts", 
            "SurveyResponses", 
            "FTAFRequests", 
            "FTAFEmailsSent", 
            "FTAFOptIns", 
            "Conversions", 
            "UniqueConversions", 
            "InProcess", 
            "NotSentDueToError", 
            "Queued"
        ];

        var result = api.retrieve("TriggeredSendSummary", cols, {
            Property: "TriggeredSendDefinition.ObjectID",
            SimpleOperator: "equals",
            Value: objectId
        });

        Write(Stringify(result));

    } catch (error) {

        Write(Stringify(error));

    }

</script>
{
    "Status": "OK",
    "RequestID": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
    "Results": [
        {
            "ObjectID": null,
            "CustomerKey": "12345",
            "Sent": 5,
            "NotSentDueToOptOut": 0,
            "NotSentDueToUndeliverable": 0,
            "NotSentDueToError": 0,
            "Bounces": 0,
            "OptOuts": 0,
            "InProcess": 0,
            "Queued": 0,
            "TriggeredSendDefinition": null,
            "Opens": 4,
            "Clicks": 1,
            "UniqueOpens": 4,
            "UniqueClicks": 1,
            "SurveyResponses": 0,
            "FTAFRequests": 0,
            "FTAFEmailsSent": 0,
            "FTAFOptIns": 0,
            "Conversions": 0,
            "UniqueConversions": 0,
            "Client": null,
            "PartnerKey": null,
            "PartnerProperties": null,
            "CreatedDate": "0001-01-01T00:00:00.000",
            "ModifiedDate": null,
            "ID": 0,
            "Owner": null,
            "CorrelationID": null,
            "ObjectState": null,
            "IsPlatformObject": false
        }
    ],
    "HasMoreRows": false
}

Reference

Ressources and references related to the current methods.

Official documentation
SOAP object

Last Updated: