0

How to send to multiple subscribers using Triggered send API in the same API call?

I'm trying to send multiple email in the same triggered send API call. I'm getting a bad request error when i execute my request. I'm trying it with multiple "TO" objects in my request. Can this be even done? or this is technically not feasible?

{
    "To":{
        "ContactAttributes":{
            "SubscriberAttributes":{
                "Version_Number":"02/17"
            }
        },
        "Address":"xyz@yopmail.com",
        "SubscriberKey":"12344"
    },
    {
        "ContactAttributes":{
            "SubscriberAttributes":{
                "Version_Number":"02/17"
            }
        },
        "Address":"abc@yopmail.com",
        "SubscriberKey":"abc@yopmail.com"
    },              
    "From":{
        "Name":"",
        "Address":""
    }
}
2

You can. You just need to send them as an array:

[{
    "From": {
        "Address": "me@here.com",
        "Name": "Me Here"
    },
    "To": {
        "Address": "you@there.com",
        "SubscriberKey": "you@there.com",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "City": "There",
                "State": "NY"
            }
        }
    }
}, {
    "From": {
        "Address": "notMe@here.com",
        "Name": "NotMe Here"
    },
    "To": {
        "Address": "youToo@there.com",
        "SubscriberKey": "youToo@there.com",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "City": "Anytowne",
                "State": "IA"
            }
        }
    }
}]

Also, you need to use the batch send, instead of the single send endpoint. Details here:

[I'm having trouble finding the link to the documentation. Will update here. I believe it's just the regular email endpoint, but instead of using /send at the end, use /sendBatch.]

  • Thanks for your comment. The link you shared is for Push. Im trying to find something similar for email but unable to. Im using this. – Sanjay Oct 3 '18 at 23:19
  • Oops! I'll correct that. I'm having trouble finding the documentation for this, but I know I've seen it. What does the endpoint URI look like for email? messaging/v1/messageDefinitionSends/key:{your key}/send? – Shane Steinfeld Oct 4 '18 at 0:04
  • 1
    Thanks, per your recommendation i changed the send to sendBatch and it worked. – Sanjay Oct 4 '18 at 4:57

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.