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":"[email protected]",
        "SubscriberKey":"12344"
    },
    {
        "ContactAttributes":{
            "SubscriberAttributes":{
                "Version_Number":"02/17"
            }
        },
        "Address":"[email protected]",
        "SubscriberKey":"[email protected]"
    },              
    "From":{
        "Name":"",
        "Address":""
    }
}

1 Answer 1

3

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

[{
    "From": {
        "Address": "[email protected]",
        "Name": "Me Here"
    },
    "To": {
        "Address": "[email protected]",
        "SubscriberKey": "[email protected]",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "City": "There",
                "State": "NY"
            }
        }
    }
}, {
    "From": {
        "Address": "[email protected]",
        "Name": "NotMe Here"
    },
    "To": {
        "Address": "[email protected]",
        "SubscriberKey": "[email protected]",
        "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.]

3
  • 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
    Commented Oct 3, 2018 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? Commented Oct 4, 2018 at 0:04
  • 1
    Thanks, per your recommendation i changed the send to sendBatch and it worked.
    – Sanjay
    Commented Oct 4, 2018 at 4:57

You must log in to answer this question.

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