Profile Requirements

To deliver a message to a recipient over SparkPost, Courier must be provided the recipient’s email address. This value should be included in the recipient profile as email.

{
  "message": {
    // Recipient Profile
    "to": {
      "email": "example@example.com"
    }

    // ... rest of message definition
  }
}

Override

You can use a provider override to replace what we send to SparkPost’s Transmissions API. For example, you can add an attachment to your request:

{
  "message": {
    "template": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
    "to": {
      "email": "example@example.com"
    },
    "providers": {
      "sparkpost": {
        "override": {
          "body": {
            "content": {
              "attachments": [
                {
                  "name": "billing.pdf",
                  "type": "application/pdf",
                  "data": "Q29uZ3JhdHVsYXRpb25zLCB5b3UgY2FuIGJhc2U2NCBkZWNvZGUh"
                }
              ]
            }
          }
        }
      }
    }
  }
}

Everything inside of message.providers.sparkpost.override will replace what we send to SparkPost’s Transmissions API. You can see all the available options by visiting SparkPost API docs.