/apispaces/{apiSpaceId}/messages/batch

📘

Use this method for any sends to multiple recipients

Use the batch method to submit messages when their is more than one recipient as it will be much more efficient than calling the single send method multiple times.

Use this method to send batches of messages to the Enterprise Communications API.

Request

The body of the HTTP POST should be an array of message requests as defined for the single send method e.g.

[
	{
	  "body": "This is message 1",
	  "to": {
	    "profileId": "[email protected]",
	    "phoneNumber": "447123123123"
	  },
	  "rules": [
	    "fbMessenger",
	    "sms"
	  ]
	},
	{
	  "body": "This is message 2",
	  "to": {
	    "profileId": "[email protected]",
	    "phoneNumber": "447234234234"
	  },
	  "rules": [
	    "fbMessenger",
	    "sms"
	  ]
	}
]

Response

When submitting a batch of messages they are accepted by the platform and then rapidly sent, so the method returns a HTTP 204 Accepted response code.

The body of the response if successful will be an array of message ids with a index property which indicates which request they correlate with from the request array e.g.

[
  {
    "index": 0,
    "messageId": "07f7af42-0ee5-45a5-834e-c98a28003b7c"
  },
  {
    "index": 1,
    "messageId": "dd6f4341-70e0-4307-8408-5ac88b8c836a"
  }
]

Receipts

To receive status updates for the submitted messages it is recommended you use the webhooks to receive receipts and inbounds in real-time.

❗️

Maximum request size

Please note your request JSON cannot exceed 10MB in size and no more than 5000 items in a batch.