5

Is there currently a way to batch triggered send requests through the REST API? All I'm finding in the documentation is triggering one at a time.

Code Sample (removing the array and only sending one element works as expected):

fuel({
        method: 'POST',
        url: 'https://www.exacttargetapis.com/messaging/v1/messageDefinitionSends/key:33/send',
        json: true,
        body: [{
                From:{
                    Address:"[email protected]",
                    Name:"David"
                },
                To:{
                    Address:"[email protected]",
                    SubscriberKey:"[email protected]",
                    ContactAttributes:{
                        SubscriberAttributes:{
                                CusField1:"My Custom Field 1",
                                CusField2:"My Custom Field 2",
                                CusField3:"My Custom Field 3"
                            }
                    }
                }
            },{
                From:{
                    Address:"[email protected]",
                    Name:"David"
                },
                To:{
                    Address:"[email protected]",
                    SubscriberKey:"[email protected]",
                        ContactAttributes:{
                            SubscriberAttributes:{
                                CusField1:"My Custom Field 1",
                                CusField2:"My Custom Field 2",
                                CusField3:"My Custom Field 3"
                            }
                        }
                    }
        }]  
    }, function (error, request, body) {
        console.log("response: " + JSON.stringify(body));
    });

console: < response: {"message":"Problem initating message send during deserialization of JSON payload.","errorcode":10004,"documentation":""}

I have tried different variations of the above code like sending just the "To" section as an array and encapsulating the array in parent brackets. I used fuel for ease of example, but the same error can be achieved in Postman.

7
  • since you have tried some code already - it would be helpful to provide the code, json and error you have received, so we can start from there. The answer provided should work, but if you had an issue, it may be a problem with your JSON specifically. the more details you can provide, the better. Thanks! Feb 18, 2014 at 19:23
  • I just edited to include example utilizing fuel. I appreciate your help with this!
    – David
    Feb 18, 2014 at 20:17
  • Your body json doesn't lint properly. Try adding the quotes to the keys. Feb 18, 2014 at 20:22
  • Same response after quotes.
    – David
    Feb 18, 2014 at 20:31
  • Did you start the message definition in the application? In other words - you can send one, but not multiple? Feb 18, 2014 at 20:33

1 Answer 1

3

Batch them by sending in as an array to

https://www.exacttargetapis.com/messaging/v1/messageDefinitionSends/key:{your key}/sendBatch

[{
    "From": {
        "Address": "[email protected]",
        "Name": "Code@"
    },
    "To": {
        "Address": "[email protected]",
        "SubscriberKey": "[email protected]",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "Region": "West",
                "City": "Indianapolis",
                "State": "IN"
            }
        }
    }
}, {
    "From": {
        "Address": "[email protected]",
        "Name": "Code@"
    },
    "To": {
        "Address": "[email protected]",
        "SubscriberKey": "[email protected]",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "Region": "East",
                "City": "Indianapolis",
                "State": "IN"
            }
        }
    }
}]
3
  • 1
    I tried this in postman yesterday before asking and got this: { "message": "Problem initating message send during deserialization of JSON payload.", "errorcode": 10004, "documentation": "" }
    – David
    Feb 18, 2014 at 16:33
  • 1
    url path change was the fix! thanks for your help!
    – David
    Feb 18, 2014 at 21:05
  • 1
    The recommended option for sending multiple emails using a single API requests through the Marketing Cloud would be to use the SOAP API. The sendBatch option above is not documented.
    – Mac
    Mar 16, 2017 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .