Postmark
Profile Requirements
To deliver a message to a recipient over Postmark, 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 Postmark's Email API. For example, you can add MessageStream and an attachment to your request:
{
"message": {
"template": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"to": {
"email": "example@example.com"
},
"providers": {
"postmark": {
"override": {
"config": {
"MessageStream": "message_stream_id"
},
"body": {
"Attachments": [
{
"Name": "readme.txt",
"Content": "dGVzdCBjb250ZW50",
"ContentType": "text/plain"
}
]
}
}
}
}
}
}
The message.providers.postmark.override
property can be used to replace what we send to Postmark's Email API. Note: the override does not replace the entire object, only the elements that you define in the body of the override. You can see all the available options by visiting the Postmark API docs.
Using Postmark Templates
{
"message": {
"to": {
"email": "rodrigo@courier.com"
},
"template": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"providers": {
"postmark": {
"override": {
"config": {
"url": "https://api.postmarkapp.com/email/withTemplate"
},
"body": {
"TemplateId": "123456",
"TemplateModel": {
"product_url": "product_url_Value",
"product_name": "product_name_Value",
"name": "name_Value",
"action_url": "action_url_Value",
"login_url": "login_url_Value",
"username": "username_Value",
"trial_length": "trial_length_Value",
"trial_start_date": "trial_start_date_Value",
"trial_end_date": "trial_end_date_Value",
"support_email": "support_email_Value",
"live_chat_url": "live_chat_url_Value",
"sender_name": "sender_name_Value",
"help_url": "help_url_Value",
"company_name": "company_name_Value",
"company_address": "company_address_Value"
}
}
}
}
}
}
}
The message.providers.postmark.override.config
property can be used to override Courier templates and use Postmark's Templates API.
Be sure to include the https://api.postmarkapp.com/email/withTemplate
URL in the config object along with the TemplateId
and TemplateModel
in the the body.
When using Postmark templates - make sure your request uses a template
parameter instead of content
. Otherwise the content
object will take presedence over the Postmark override. The template_id
must be valid or an error will occur.