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:"myFromAddress@domain.com",
                    Name:"David"
                },
                To:{
                    Address:"myemail_1@domain.com",
                    SubscriberKey:"myemail_1@domain.com",
                    ContactAttributes:{
                        SubscriberAttributes:{
                                CusField1:"My Custom Field 1",
                                CusField2:"My Custom Field 2",
                                CusField3:"My Custom Field 3"
                            }
                    }
                }
            },{
                From:{
                    Address:"myFromAddress@domain.com",
                    Name:"David"
                },
                To:{
                    Address:"myemail_2@domain.com",
                    SubscriberKey:"myemail_2@domain.com",
                        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.

  • 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! – Kelly J Andrews Feb 18 '14 at 19:23
  • I just edited to include example utilizing fuel. I appreciate your help with this! – David Feb 18 '14 at 20:17
  • Your body json doesn't lint properly. Try adding the quotes to the keys. – Kelly J Andrews Feb 18 '14 at 20:22
  • Same response after quotes. – David Feb 18 '14 at 20:31
  • Did you start the message definition in the application? In other words - you can send one, but not multiple? – Kelly J Andrews Feb 18 '14 at 20:33
3

Batch them by sending in as an array to

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

[{
    "From": {
        "Address": "code@exacttarget.com",
        "Name": "Code@"
    },
    "To": {
        "Address": "example@example.com",
        "SubscriberKey": "example@example.com",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "Region": "West",
                "City": "Indianapolis",
                "State": "IN"
            }
        }
    }
}, {
    "From": {
        "Address": "code@exacttarget.com",
        "Name": "Code@"
    },
    "To": {
        "Address": "example2@example.com",
        "SubscriberKey": "example2@example.com",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "Region": "East",
                "City": "Indianapolis",
                "State": "IN"
            }
        }
    }
}]
| improve this answer | |
  • 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 '14 at 16:33
  • 1
    url path change was the fix! thanks for your help! – David Feb 18 '14 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 '17 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.