1

Is there a way to send an email to multiple recipients via a the RESTful API call. Here is our current JSON we are using for sending emails to a single user.

{
    "From": {
        "Address": "code@exacttarget.com",
        "Name": "EmailTest"
    },
    "To": {
        "Address": "recipient@email.com",
        "SubscriberKey": "recipient@email.com",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "content" : "hello"
            }
        }
    }
}

The only answers to this I could find are a couple of years old.

0

The REST API does allow you to send to multiple recipients in one go, you achieve this by passing an array of subscribers and appending sendBatch to the endpoint URL.

There are a few posts that detail the syntax - eg. Multiple sends through MessageDefinitionSends

Annoyingly, the documentation doesn't seem to offer anything on it.

0

If you are looking for a new way to send email by calling the salesforce REST api, you could use the Salesforce Actions for sending emails which became available in api version 32.0.

$ curl -H 'Authorization: Bearer SessionId' -H 'X-PrettyPrint:1' -H 'Content-Type: application/json' -d @jsonfile BaseURL/services/data/v36.0/actions/standard/emailSimple

./jsonfile

{
  "inputs" : [
    {
      "emailBody" : "This is the body of the email",
      "emailAddresses" : "user1@email.com,user2@email.com",
      "emailSubject" : "An email from salesforce",
      "senderType" : "CurrentUser"
    }
  ]
}

Emails sent this way will count against the "DailyWorkflowEmails" and "DailyApiRequests" limits.

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.