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": "[email protected]",
        "Name": "EmailTest"
    },
    "To": {
        "Address": "[email protected]",
        "SubscriberKey": "[email protected]",
        "ContactAttributes": {
            "SubscriberAttributes": {
                "content" : "hello"
            }
        }
    }
}

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

2

2 Answers 2

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" : "[email protected],[email protected]",
      "emailSubject" : "An email from salesforce",
      "senderType" : "CurrentUser"
    }
  ]
}

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

You must log in to answer this question.

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